Hello,
I need a script so that 1 user can visit my site only 1 time in 24 hours, if user reload the page, he will be redirected to another url.
Anyone have this script, or know a link to the script.
Thanks
I don't but depending on how smart you want it to be it can be very easy. A freelancer can do it starting from $20 or so. By 'smart' I mean should it try to leave flash cookies, do visitor system footprinting, etc. If you just want to track them by IP and/or a regular cookie then it is trivial - a 20min job.
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '')
{
$sIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif ( isset( $_SERVER['REMOTE_ADDR'] ) )
{
$sIP = $_SERVER['REMOTE_ADDR'];
}
$aIPs = file('visitors.txt');
if (in_array($sIP, $aIPs))
{
header('Location: http://www.yourredirectpage.com');
exit;
}
else
{
file_put_contents('visitors.txt', $sIP."\n");
}
Here you go.
PHP:if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '') { $sIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) { self::$sIP = $_SERVER['REMOTE_ADDR']; } $aIPs = file('visitors.txt'); if (in_array($sIP, $aIPs)) { header('Location: http://www.yourredirectpage.com'); exit; } else { file_put_contents('visitors.txt', $sIP."\n"); }
I'll be out for the next 3 hours. But if you wont get it working, then write me and i will contact you by skype then.