Keep in mind that a cookie is hardly permanent. I'm not sure of your requirements, but a more standard approach would be to check against the database each time. On the other hand, if you are actually programming a "captive gateway", I suppose maybe the cookie is the thing.
Typically, you have a form page and a "handler script". Have a look at [man]setcookie/man to see how cookies are set in PHP.
You'll also want to investigate the MySQL section of the manual.
Note that the "MysqlI" interface has superseded "MySQL" in PHP, but not all
hosts have implemented mysqli support. Some installations may support both,
and others only one of the two interfaces.
The remote IP is available in the $_SERVER array:
<?php
//show the user his/her IP addy:
echo "Your IP Address is ".$_SERVER['REMOTE_ADDR'];
?>
Hope this helps!
Welcome to PHPBuilder!