Hi All, I have a script that I only want to run once per IP address on my website. Is there some PHP code that I can use for this? Cheers Nugget
here you go. i have included comments to help you. :detective PHP: <?php//note: you must make a table in your//database called ips with a field called ipaddress////set your mysql options here$sqlserver = "localhost";$sqluser = "yourMySqlUsername";$sqlpassword = "yourMysqlPass";$sqldatabase = "YourMysqlDB-name";//end mysql settingsmysql_connect($sqlserver, $sqluser, $sqlpassword);mysql_select_db($sqldatabase) or die(mysql_error() );$ip=$_SERVER['REMOTE_ADDR'];$ipsearch = mysql_query("SELECT * FROM ips WHERE `ipaddress` = '$ip'");if(mysql_num_rows($ipsearch) < 1){ // //Run your script here. // mysql_query("INSERT INTO ips (`ipaddress`) VALUES('$ip') ");}?>