Can't log IPs with Mandrake

Troubleshooting with your custom scripts/programs installed on Polarhome.

Moderator: Moderators

Can't log IPs with Mandrake

Postby radiolover » Sat Nov 27, 2004 7:08 pm

Hi all,
I have a site hosted at Polarhome, and I thank you for the stable free service. My site is located at Mandrake, but I have an account on RedHat as well. So I observe this problem with Mandrake, which is not present at RedHat.
I have a poll, with IP-logging enabled. I store the people's votes plus their IP addresses. This is done in such way:
if($s_iplog != "0")
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];{
$q1 = "INSERT INTO poll_iplog (ip,pid,cid) ";
$q1 .= "VALUES ('$REMOTE_ADDR', '$p[pid]', '$cid')";
$r1 = mysql_query($q1, $s_dbid);

That works fine with RedHat, and was so till recently with Manrake as well. But now that I've decided to announce the official results, I see that the field "IP" has not been filled for some 2 months now. Initially, after I've reset the poll for the last time, this has been done. But without my interference that process of logging the IPs has suddenly stopped. I don't think that the fault is with my script, cause I tried exactly the same at Redhat and it works just fine... So I hope that you'll check what the problem is, or at least please inform me if that is done on purpose and I won't be able to use that feature anymore. Thank you in advance!
radiolover
Newbie
 
Posts: 2
Joined: Sat Nov 27, 2004 6:54 pm

Postby DenisF » Sat Nov 27, 2004 7:45 pm

Hi,

As far as i can tell, the server var remote addr works [test], so i would think that there's a problem in your query. so my suggestion is that you make sure that everything is alright, doing so like this;

Code: Select all
$link = mysql_connect('localhost', 'username', 'password') or die(mysql_error());
mysql_select_db('database', $link) or die(mysql_error());
mysql_query('query') or die(mysql_error());
mysql_close($link) or die(mysql_error());


[you get the idea]

and as far as redhat goes, well it uses much older software than what i have on mandrake [e.g mysql3 on redhat, 4 on mandrake], so maybe mysql is being less fault-tolorant. or something along those lines.

In any case, i haven't done anything on purpose to 'stop' any type of script that the users might be running. and i probably never will.

Regards,
/DenisF
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby radiolover » Sat Nov 27, 2004 10:36 pm

Thank you for the fast reply! I altered the script a bit and everything works fine again. As it seems in this newer environment $HTTP_SERVER_VARS should just be $_SERVER, plus I had another little mistake :). I wish you all the best and thank you for the efforts towards offering us that really out-of-profit service!
radiolover
Newbie
 
Posts: 2
Joined: Sat Nov 27, 2004 6:54 pm

Postby DenisF » Sat Nov 27, 2004 11:03 pm

Hey,

Glad to hear everything worked out :)

Thanks,
/DenisF
Image
[ FAQ ] :: [ Policy ] :: [ Port Forwarding Guide ] :: [ Search ]
User avatar
DenisF
Forum Admin
Forum Admin
 
Posts: 679
Joined: Mon Dec 16, 2002 9:09 pm
Location: Israhell

Postby miker_alpha » Sun Nov 28, 2004 8:11 am

this newer environment $HTTP_SERVER_VARS should just be $_SERVER


From the *new* PHP manual:
$_SERVER

Variables set by the web server or otherwise directly related to the execution environment of the current script. Analogous to the old $HTTP_SERVER_VARS array (which is still available, but deprecated).

See http://us2.php.net/en/language.variables.predefined
From my own experience: It may be "deprecated" only, but sometimes it does not show up...

MikeR
Look for OpenVMS help on my webpage
Check for QOTD here.
Image
User avatar
miker_alpha
Moderator
Moderator
 
Posts: 256
Joined: Sat May 08, 2004 9:20 am
Location: Kibbutz Tzora, Israel


Return to Troubleshooting

Who is online

Users browsing this forum: Google [Bot] and 13 guests