Jump to content

Grabbing ipaddress


Jon12345

Recommended Posts

Oh that's good to know, although it brings up a fresh problem. The following code is intended to lookup my database to see if there is a matching ipaddress and if there is, set action=1 in the records action field. But instead, I just get a blank screen and no redirect. If I eliminate the database code section, it redirects. What is wrong with my code?

[code]$ipaddress=$_SERVER['REMOTE_ADDR']
$db1=mysql_connect("localhost","user","pw"); 
mysql_select_db("affiliatelog",$db1);
$query1="UPDATE visitor_log SET action = '1' WHERE ipaddress='$ipaddress'";
mysql_query($query1) or die('Database Query Error: '.mysql_error());
mysql_close($db1)


$sub=$_GET['sub'];
$offer=$_GET['offer'];

if ($offer == "xxx") {$product = "http://site1.com?sub=$sub";} // Default link
if ($offer == "bbb") {$product = "http://site2.com/?sub=$sub";} // Default link

//some javascript redirect code goes here but this forum won't let me post it for some strange reason![/code]
Link to comment
https://forums.phpfreaks.com/topic/30770-grabbing-ipaddress/#findComment-141882
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.