<?php Header("Location: http://www.php.net"); exit; ?>You find it in Section XIV. It uses a HTTP redirect command to make the users browser access a new location. This is a good example how simple things in PHP3 can be: We will expand it, so that we make a suitable tool for the curious ;).
<?php '$u_target' ?>. (u_ stands for URI/URL, this is a personal way to determine where the variable belongs to that I am using. Others: db_ is for database , p_ for page , f_ for function and so on.)
<?php '$u_referrer' ?>for this purpose. You can use simple keywords like 'homepage', the name of the page example.html or the full address "http://...". It doesn't really matter, but keywords are better to understand on first look. When you skip this parameter,
<?php $HTTP_REFERER ?>is used automatically. Note that if it doesn't exist either,
<?php '$u_referrer' ?>will be set to 'none'.
<?php $REMOTE_ADDR ?>address for this purpose, since Apache and IIS deliver it in nearly 90% of all installations ;).
<?php $REMOTE_HOST ?>is better but since DNS-lookup is switched off sometimes, you'll have to try out on your server yourself. (Use
<?php phpinfo() ?>for this purpose. It's tip I got from Tim and others which lead also to this script. Thanks ;)
<?php time() ?>is all we need.
# Definition # Table structure for table \'redirect\' # CREATE TABLE redirect ( target varchar(80) DEFAULT \'no target\' NOT NULL, referrer varchar(80) DEFAULT \'none\' NOT NULL, client varchar(40) DEFAULT \'no client\' NOT NULL, timeused datetime DEFAULT \'0000-00-00 00:00:00\' NOT NULL );