|
Where Did They Go Today? Knowing Where People Go When They Leave Your Site.
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
<?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;
?>
| Comments: | ||
| PHP problem | Viktor Stevich | 12/10/05 07:42 |
| RE: how to build a search engine | daren | 06/15/05 13:26 |
| RE: What if they type url in browser? | James | 06/27/03 05:56 |
| RE: how to build a search engine | Josh Petrovich | 09/20/02 23:21 |
| Header error | Surya | 08/10/02 12:35 |
| IP Address | Greg | 03/07/02 08:55 |
| RE: I don't get it | Jack | 10/04/01 07:06 |
| RE: how to build a search engine | PyroX | 10/01/01 15:42 |
| another possiblity? | David Rossiter | 09/20/01 09:50 |
| RE: I don't get it | Olivier Hill | 06/17/01 18:18 |
| how to build a search engine | colin kelly | 05/28/01 08:22 |
| What time is it now() ? | Rob Halff | 05/15/01 01:04 |
| RE: I don't get it | David Davis | 02/02/01 14:07 |
| RE: What if they type url in browser? | David Davis | 02/02/01 13:54 |
| RE: Another possible use | Brett | 01/29/01 16:03 |
| What if they type url in browser? | Dzool | 01/09/01 14:59 |
| Another possible use | Eric Naujock | 01/05/01 21:59 |
| It's very useful | Sunhawk | 10/28/00 09:06 |
| RE: I don't get it | Colin Gilboy | 10/27/00 14:51 |
| RE: I don't get it | Pat O\'Neill | 10/12/00 14:20 |
| I don't get it | Olivier Hill | 10/12/00 00:17 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


