Anyone got this php script.

Ayomav

Regular Member
Joined
Nov 23, 2011
Messages
250
Reaction score
19
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.
 
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

That is something you'd need to have built custom.

Any php programmer will be able to do this for your with no problem, using the user's ip address and setting an if statement to redirect should the same ip appear within the preset time frame.

Post in the ' Hire a programmer ' area.
 
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.

I just want a simple php to track from IP, no cookies etc.
 
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'] ) )
{ 
   $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");
}
 
Last edited:
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");
}

Hey, thanks, but can you give the php code aswell, I put the code on my php page but it shows the code in text.

I want something like <html> </html> for html page, but for php pages.

Not techy here.

Thanks
 
Well, that is a php code ;-).

put <?php before
and ?> after that code and it should work.
 
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.
 
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.

It's showing this error.

Fatal error: Cannot access self:: when no class scope is active in /home/sites/public_html/aa.php on line 11
 
oh ;-)

remove the self::

i forgot to remove it, i copied it from my other script which works with objects.

added you on skype.
 
Back
Top