Certain PHP variables not working...

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
pointsplat
-


Joined: 20 Nov 2002
Posts: 2

PostPosted: Wed Nov 20, 2002 1:48 pm    Post subject: Certain PHP variables not working... Reply with quote

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;
}
?>
Back to top View user's profile Send private message Visit poster's website AIM Address
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Nov 20, 2002 11:28 pm    Post subject: Re: Certain PHP variables not working... Reply with quote

pointsplat wrote:
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 :)

This is not a problem with Abyss Web Server. Abyss is fully compliant with the CGI/1.1 standard. New PHP releases export these variables as $_SERVER['QUERY_STRING'] and $_SERVER['REMOTE_ADDR'] .
Please refer to PHP documentation for more information about predefined variables.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group