php

What risks are there in using extracted PHP superglobals?

Hola usando estas funciones, que riesgo corro en tener problemas de seguridad, es necesesario usar extract() o hay alguna manera mejor de convertir las variables superglobales (array) en trozos de variables. Good, there is some risk in using the function extract in the superglobal variables as $_POS and $_GET, I work of the following ...

Regex for beautify text

HI, I would like to create a function that beautify my text. For this I use a regex who remplace some characters, but it not run. Can you give me the regular expression for this : Replace the first letter by a caps Replace any underscore _ by a space So for example: the_pack_2 will be The pack 2. Thx ...

problem in getting desired date format in loop

Hi there, I have a date format like this : $date1 = "Sun May 09 20:07:50 +0000 2010"; and I have to convert it to: 09-05-2010 I am echoing it with echo date("d-m-Y", strtotime($date1)); When I print this individually it gives proper result but I am using it in loop it gives me results like: 31-12-1969 The loop i am using i...

Initialize static members in PHP

class Person { public static function ShowQualification() { } } class School { public static $Headmaster = new Person(); // NetBeans complains about this line } Why is this not possible? I want to be able to use this like School::Headmaster::ShowQualification(); ..without instantiating any class. How can I do it? Update: Ok...

Search tamil fonts in mysql and php

Hi, How to search tamil fonts and retrieve data from mysql and show the result using php? ...

Retrieve remote XML data with PHP

I'm currently reading a regularly updated XML file with PHP (simpleXML). I'd like to reduce calls to the remote server by reading a cache file on my web server, then after some time, retrieve a new copy of the remote file. Is this an accepted practice for reading remote XML files, then parsing? Can anyone offer some suggestions on how ...

How to allow utf-8 charset in preg_match ???

Hello everone, I am using preg_match() function only to allow specific charachters to accept. It is allowing all alphabates and numbers but along with that i also want to allow utf-8 characters such as "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ" so how can i allow this charachters from preg_match() function.Plase suggest me. Thanks in advance. Regards S...

Magento layout override!

Hi, I'm kind of new to the Magento, so forgive me for my stupid question! As I understand the whole concept of Magento is base on overriding the basic components that's are available with in the Magento. So based on my understanding I've decided to update the layout of onepage checkout in Magento. I've created my own layout and in the ...

Image expire time

The google page speed tool recommends me to set 'Expires' headers for images etc. But what is the most efficient way to set an Expires header for an image? In now redirect all image requests to an imagehandler.php using htaccess: /* HTTP/1.1 404 Not Found, HTTP/1.1 400 Bad Request and content type detection stuff ... */ header( "Conte...

How do I get the current time zone of MySQL ?

Anyone knows if there is such a function in MySQL? UPDATE This doesn't output any valid info: mysql> SELECT @@global.time_zone, @@session.time_zone; +--------------------+---------------------+ | @@global.time_zone | @@session.time_zone | +--------------------+---------------------+ | SYSTEM | SYSTEM | +------...

How UPDATE and SELECT at the same time

I need to update some rows of the tables and then display these rows. Is there a way to do this with one single query and avoid this 2 query ? : UPDATE table SET foo=1 WHERE boo=2 SELECT * from table WHERE ( foo=1 ) AND ( boo=2 ) ...

Best way to send mass email to my subscribers ( BCC or PEAR mail queue ? )

I need to send email to my 5000 subscribers. What is the best way to do this ? 1) By using BCC ?: $from_addr = '[email protected]'; $mailing_list = '[email protected]', '[email protected]', '[email protected]; $message_subject = 'this is a test'; `$headers = array ("From" => $from_addr, "Bcc" => $mailing_lis...

How do I show datetime in the same time zone as user using PHP or javascript?

Suppose now I've got the datetime to show like this: 2010-05-29 15:32:35 The the corresponding time zone can be get by date_default_timezone_get, how do I output the result in the same time zone as user's browser so that users don't get confused? ...

Auto refresh when new user comes online

Hello. I have a table in the database which includes all active users. I then have a user list which needs refreshing to see who is the latest users online. Whats the best way to tackle this? The user list is always just who is in the active_users table. Thanks for reading. ...

How to fetch a random record from SQLite database?

I am working on PHP. I was working with MySQL before. Here is the code I used - $offset_result = mysqli_query($con, " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM students "); $offset_row = mysqli_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysqli_query($con, " SELECT name FROM students LIMIT $offse...

how to find php corse to build website application from a to z

Possible Duplicates: Crash Course in Web Development (PHP+HTML) How to learn web-programming (Javascript, PHP)? hi>>>> i search for cours video or book or web tutorials to teach me how to build website with php mysql css html i need full project from A to Z from the scratch plz if any one know that tell me ...

PHP Time Remaining in Current Day

How can we find out how many time remains to end the current day from current time[date('Y-m-d H:i:s')] in PHP. ...

How to enable and use HTTP PUT and DELETE with Apache2 and PHP?

Hi, It should be so simple. I've followed every tutorial and forum I could find, yet I can't get it to work. I simply want to build a RESTful API in PHP on Apache2. In my VirtualHost directive I say: <Directory /> AllowOverride All <Limit GET HEAD POST PUT DELETE OPTIONS> Order Allow,Deny Allow from all </L...

How to decode Unicode escape sequences like "\u00ed" to proper UTF-8 encoded characters?

Is there a function in PHP that can decode Unicode escape sequences like "\u00ed" to "í" and all other similar occurrences? I found similar question here but is doesn't seem to work. ...

PHP & MySQLi timeout

Whenever I try to create a mysqli object, as in; $mysqli = new mysqli(host, user, pass, database); ...the page just loads for around a minute, then stops, showing all the content of the page up until that line. info() says that MySQLi (and MySQL if that matters) are enabled, and I can access the MySQL CLI. I'm also working on a local...