Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

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;

?>
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
PHP problemViktor Stevich12/10/05 07:42
RE: how to build a search enginedaren06/15/05 13:26
RE: What if they type url in browser?James06/27/03 05:56
RE: how to build a search engineJosh Petrovich09/20/02 23:21
Header errorSurya08/10/02 12:35
IP AddressGreg03/07/02 08:55
RE: I don't get itJack10/04/01 07:06
RE: how to build a search enginePyroX10/01/01 15:42
another possiblity?David Rossiter09/20/01 09:50
RE: I don't get itOlivier Hill06/17/01 18:18
how to build a search enginecolin kelly05/28/01 08:22
What time is it now() ?Rob Halff05/15/01 01:04
RE: I don't get itDavid Davis02/02/01 14:07
RE: What if they type url in browser?David Davis02/02/01 13:54
RE: Another possible useBrett01/29/01 16:03
What if they type url in browser?Dzool01/09/01 14:59
Another possible useEric Naujock01/05/01 21:59
It's very usefulSunhawk10/28/00 09:06
RE: I don't get itColin Gilboy10/27/00 14:51
RE: I don't get itPat O\'Neill10/12/00 14:20
I don't get itOlivier Hill10/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.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.