My php scripts!

php scripts I use.

My Photo
Name:
Location: Bucuresti, Bucuresti, Romania



Sunday, November 27, 2005

PHPSESSID and GOOGLE

PHPSESSID suck when PHP will add a unique PHPSESSID query pair to you links. It's all about session.use_trans_sid that must be off if you want Google to eat your site alive. And guess what! It's easy to set it off.
Just make a blank file with Notepad and rename it .htaccess! Open this file, paste this code:

< if module >
php_flag session.use_trans_sid off
< /if module >


Note: Remove all spaces inside < >!!!!!
... save file, upload it in your root directory.

Have fun :P

Source: Why You Should Disable PHP’s session use_trans_sid


Ah. As a bonus ... if you want .htm and .html files to execute your php scripts please add this code in the same .htaccess file:

AddType application/x-httpd-php .php .html .htm


Dont forget to upload it! :)

Monday, October 24, 2005

[PHP] Page Generation Time

This is a cool script that will help you see the number of seconds needed to load your pages.

/* This part of the script goes at the top of your page */

$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];

/* This part of the script goes where you want load time to be displayed */

$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Page loaded in %.3f seconds.', $totaltime);

Credits:
evidence / http://www.sythe.org/image-vp175499.html