You can easily expand the table for additional parameters like Keyword for the link,
User ID’s and more. What follows is the code for the php3-Page: redir.php3
User ID’s and more. What follows is the code for the php3-Page: redir.php3
<?php
// Where did they go today? Version 1.02 - redir.php3
// (c) 1998 by smk_at_well.com
// Set variables for Database Access - you'll have to set up your own
$db_server = "127.0.0.1";
$db_user = "redirector";
$db_pass = "secret";
$db_data = "redir";
$db_table = "redirect";
// First, check target
if (!isset($u_target))
die("Sorry, no link was set in $u_target");
// Second, is the referrer set? Note: HTTP_REFERER and some other variables
//have to be written uppercase or they won't work.
if (!isset($u_referrer)) {
if (!isset($HTTP_REFERER)) {
$u_referrer = "none";
} else {
$u_referrer = $HTTP_REFERER;
};
};
// Now the client address
if (!isset($REMOTE_ADDR)) {
$p_remotehost = "no client address";
} else {
$p_remotehost = $REMOTE_ADDR;
};
// And what time is it now?
$p_timeused = date("Y-m-d H:i:s",time());
// Get connected and transfer data
@mysql_connect("$db_server","$db_user","$db_pass") or
die("Couldn't connect to the database-server!");
@mysql_select_db("$db_data") or
die("Can connect to the server, but not to the table or database itself");
@mysql_db_query($db_data , "insert into $db_table values('$u_target','$u_referrer',
'$p_remotehost','$p_timeused')");
// And now she/he's gone with the wind ;)
Header("Location: $u_target");
exit;
?>