HMV.co.in

September 23, 2008

Page redirect

Filed under: php — Tags: , , , — Harsha M V @ 10:51 pm

Description

If you want a PHP redirect script that redirects visitors from a page to a specific URL then this is it. It sends the user from one web page to a different web page address. It is a good alternative to using the meta tag http-equiv option.

The code


<?php

/**

 * Place in a blank PHP page

 */

// Change to the URL you want to redirect to

$URL="http://www.example.com";

header ("Location: $URL");

?> 

Page load time

Filed under: php — Tags: , , , — Harsha M V @ 10:50 pm

Description

Outputs the time in seconds that it takes for a PHP page to load.

The code


<?php

// Insert this block of code at the very top of your page:

$time microtime();

$time explode(" "$time);

$time $time[1] + $time[0];

$start $time;

// Place this part at the very end of your page

$time microtime();

$time explode(" "$time);

$time $time[1] + $time[0];

$finish $time;

$totaltime = ($finish $start);

printf ("This page took %f seconds to load."$totaltime);

?> 

Blog at WordPress.com.