pointsplat -
Joined: 20 Nov 2002 Posts: 2
|
Posted: Wed Nov 20, 2002 1:48 pm Post subject: Certain PHP variables not working... |
|
|
I am new at this guys so bear with me. Hey I know that this question has been answered for QUERY_STRING. However being new I am not sure what the original function of REMOTE_ADDR was, I assume it is suppose to be the users IP by looking at this code. What is the new replacement for that seeing as how abyss won't recognize that either. Is there a link with all these chnages somwhere that someone could send my way? Anyway here is the code if anyone can get it working lemme know :)
Code: |
<?php
// Click counter
$day = date("Y-m-d"); // format the date like it is written in the database
$url = $_GET["linkurl"];
printf($url);
if ($url) {
include("db.php"); // connect to the database
$result = mysql_query("SELECT * FROM clickout WHERE url='$url' AND day='$day'",$db);
if(mysql_num_rows($result) > 0) {
mysql_free_result($result);
$result = mysql_query("SELECT UNIX_TIMESTAMP(time) FROM ip WHERE (url='$url' AND ipnum='$REMOTE_ADDR' AND day='$day')",$db);
if($row = mysql_fetch_row($result)) {
if(($row[0]+3600) < time()) {
mysql_query("UPDATE clickout SET raw=raw+1,uni=uni+1 WHERE url='$url' AND day='$day'",$db);
mysql_query("UPDATE ip SET time=NOW() WHERE url='$url' AND ipnum='$REMOTE_ADDR' AND day='$day'",$db);
} else { // the click is raw
mysql_query("UPDATE clickout SET raw=raw+1 WHERE url='$url' AND day='$day'",$db);
}
mysql_free_result($result);
} else { // it's a new ip
mysql_query("UPDATE clickout SET raw=raw+1,uni=uni+1 WHERE url='$url' AND day='$day'",$db);
mysql_query("INSERT INTO ip (url,ipnum,day) VALUES ('$url','$REMOTE_ADDR','$day')",$db);
}
} else { // it's a new url or day
mysql_query("INSERT INTO ip (url,ipnum,day) VALUES ('$url','$REMOTE_ADDR','$day')",$db);
mysql_query("INSERT INTO clickout (url,day,raw,uni) VALUES ('$url','$day',1,1)",$db);
}
$url="Location: ".$url;
header($url);
exit;
}
?>
|
|
|