Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ip logger

Status
Not open for further replies.

benp07

Technical User
Aug 31, 2001
87
0
0
US
i am new to php and what i want to do is have an iplogger the logs the ip and if the ip comes back i want it to be redirected to a different site
the script below just take the first and last name and writes it to a file so if this is the first time for that ip then the below script would run.
(what i have is a sign up and people sign up for others is this the best way to prevent this)

Thanks alot for any help
Ben

<?php

$fName = @$_POST[&quot;first_name&quot;];
$lName = @$_POST[&quot;last_name&quot;];

// Set the string to be written to the file
$values = &quot;<br> $fName $lName\r\n&quot;;

// Open the file for truncated writing
$fp = @fopen(&quot;enter.html&quot;, &quot;a&quot;) or die(&quot;Couldn't open organizer.data for writing!&quot;);
$numBytes = @fwrite($fp, $values) or die(&quot;Couldn't write values to file!&quot;);

@fclose($fp);
echo &quot;Your Name has been added!&quot;;

?>
<html>
<head><meta http-equiv=&quot;Refresh&quot; content=&quot;2;URL=enter.html&quot;>
</head>
<body onload=&quot;window.open('enter.html','_top')&quot;>
</body>
</html>
 
Logging IPs are not the best solution to prevent people from signing up multiple times. Things like proxies and NAT makes IP logging pretty much useless. In my opinion, there are no good ways to do this, as there are ways around them all.
That being said, I would use cookies since most users have them on and it wouldn't restrict users that have never been to your site from signing up. //Daniel
 
can you tell me what i would have to do to get cookies to work

thanks

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top