php

Replace diacritic characters with "equivalent" ASCII in PHP?

Related questions: http://stackoverflow.com/questions/2653739/how-to-replace-characters-in-a-java-string http://stackoverflow.com/questions/2393887/how-to-replace-special-characters-with-their-equivalent-such-as-a-for-a As in the questions above, I'm looking for a reliable, robust way to reduce any unicode character to near-equivalen...

Google Translate translates inline Javascript Code

Hi, I have some PHP code that sends a section of html code including some inline Javascript code by curl to google. When i get it back from Google translated into the language that i chose, the Javascript code has been translated too. Any ideas as to how i can stop Google translating my inline JavaScript code? Thanks, M ...

php: simplexml exception retry

I am querying an API using SimpleXML which will occasionally fail for reasons unknown. I would like to have the script retry up to 5 times. How can I do this? I assume it has something to do with wrapping the object in a try/catch, but I'm not very experienced with this -- have tried to read the manual on exception handling but am sti...

How can I remove sensitive data from the debug_backtrace function?

I am using print_r(debug_backtrace(), true) to retrieve a string representation of the debug backtrace. This works fine, as print_r handles recursion. When I tried to recursively iterate through the debug_backtrace() return array before turning it into a string it ran into recursion and never ended. Is there some simple way I can remo...

Symfony sfPDOSessionStorage - manually destroy / regenerate session

I am using sfPDOSessionStorage with symfony. I need to destroy and regenerate a user's session. Is there any function that allows me to do this? Using session_destroy(); session_regenerate_id(); session_start(); obviously doesn't work because it would bypass the database storage. I've tried directly calling: getContext()->getStorage()...

PHP setting cookies in a child class

I am writing a custom session handler and for the life of me I cannot get a cookie to set in it. I'm not outputting anything to the browser before I set the cookie but it still doesn't work. Its killing me. The cookie will set if I set it in the script I define and call on the session handler with. If necessary I will post code. Any ide...

@readfile in php??

I hate that google can not search for symbols. I saw this in some sample code and wondered why there is an @ sign before the readfile function: @readfile($filename); What does it mean different to without an @ symbol? ...

php smart learner

Is there a possibility to create a html or a php page that will count redirects? I mean, let's say you have a page with a link in it. I want the page to count how many times the link is clicked per ip adress or username. The counting would be reported into a log file or text document. ...

JavaScript array to PHP array then process in PHP and return

Example: javascript: var mycourses=new Array(); mycourses[0]="History"; mycourses[1]="Math"; mycourses[1][0]="Introduction to math"; mycourses[1][1]="Math 2"; mycourses[1][2]="Math 3"; PHP will then run these values through functions (please note values are mostly not strings as in the example above but rather numbers), the ...

regenerate the ID row in a MySQL Table with a Mysql's Script or PHP

Hello, i have a database fill with information of the users who use my webpage. The table as many MySql tables have the ID parameters who is autoincrement. The issue is that when somebody eliminate his account from the site, in the database remain a jump in the sequence that i dont want cuz i have a script who fail if find some jump in t...

Will an Nginx as reverse proxy for Apache help on dynamic content only

I am planning to move all my static content to a CDN so on my server I only have dynamic content left. I now have Nginx set up as reverse proxy to Apache. The static request that came in where directly delivered by Nginx without having to go to Apache. In this case Nginx handled a large portion of the request and I can clearly see the n...

PHP: Sending bulk emails from a query result

How can I send an email to all results from a certain field at once? ...

Regular Expression for $_GET query strings

Hi there! I'm trying to find a regular expression for $_GET query strings. I have an array like this: private $_regexp = array( ':id' => '[0-9]+', ':year' => '[12][0-9]{3}', ':month' => '0[1-9]|1[012]', ':day' => '0[1-9]|[12][0-9]|3[01]', ':slug' => '[a-zA-Z0-9-]+', ':query' => '...' ); and I loop thro...

Mysql : should i put my data into 1 table or split per user?

This data is for a holiday cottage's simple accommodation calendars. The data is simple and stores dates when each cottage is booked. The cols would be cottage_id, booked_from_date, booked_until_date and I would expect around 60 rows per user per year * 200-300 users. I should put this is one table right? ...

The role of PHP jQuery-based HTML editors

I've reviewed a couple options for jquery-based RTE that required PHP. I'm running a MVC/jQuery site on IIS - should i rule out php-based editors just so i can avoid installing PHP? How exactly is the client-side jquery interacting with PHP? ...

How to enable PLAINTEXT support for PHP's oauth extension?

I just installed the PECL oauth extension but when I look at the PHP info output, I see that "PLAINTEXT" support is not supported. It appears that only "HMAC-SHA1 support" is enabled. How can I enable PLAINTEXT support? ...

PHP core function printing debug statements

I'm integrating a framework (Kohana 2.3.4), into a web-app (IPB 2.3.4/2.3.6) via a third party bridge library (IPBWI 2.07), and I began seeing the string NOT FOUND at the top of the web-page output. How can I turn that message off? I narrowed it down to a call to class_exists(...) in IPB. The call is working correctly, except for the p...

'template' .SWF that uses other .swf's and .jpg's in it (by xml generated in .php) works only locally

My problem is that a .swf I would like to put on my website works only when requested locally. When requested from my home web server or company web server it doesn't work. I believe all files are in the proper folders and all links are well, otherwise it wouldn't work locally. Now, the SWF I place on the html page has several shapes, fo...

PHP object cannot find method

Hello, So I have a very simple class that has a method called getThumbUrl() but when I try calling this method on an instance I get Notice: Undefined property: FlickrImage::$getThumbUrl But it is clearly there. Here is the code of the function inside of the FlickrImage class: public function getThumbUrl() { return "http://farm"....

.htaccess makes php files downloadable

I have an .htaccess file with following content: AddHandler x-httpd-php5 .php For some reason, whenever I upload it to the server, Firefox then wants to download PHP files instead of showing them, I think the Apache server has some error. What's wrong? Thanks in advance ^^ ...