1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Anyone got this php script.

Discussion in 'BlackHat Lounge' started by Ayomav, Mar 23, 2012.

  1. Ayomav

    Ayomav Regular Member

    Joined:
    Nov 23, 2011
    Messages:
    250
    Likes Received:
    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
     
  2. LinkMaister

    LinkMaister Newbie

    Joined:
    Mar 22, 2012
    Messages:
    22
    Likes Received:
    7
    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.
     
  3. aftershock2020

    aftershock2020 Senior Member

    Joined:
    Oct 19, 2007
    Messages:
    981
    Likes Received:
    477
    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.
     
  4. Ayomav

    Ayomav Regular Member

    Joined:
    Nov 23, 2011
    Messages:
    250
    Likes Received:
    19
    I just want a simple php to track from IP, no cookies etc.
     
  5. BlueZero

    BlueZero Power Member

    Joined:
    Jul 6, 2011
    Messages:
    500
    Likes Received:
    257
    Occupation:
    Webdeveloper, Project Manager
    Location:
    Byte in the Net
    Home Page:
    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");
    }

     
    • Thanks Thanks x 4
    Last edited: Mar 23, 2012
  6. Ayomav

    Ayomav Regular Member

    Joined:
    Nov 23, 2011
    Messages:
    250
    Likes Received:
    19
    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
     
  7. BlueZero

    BlueZero Power Member

    Joined:
    Jul 6, 2011
    Messages:
    500
    Likes Received:
    257
    Occupation:
    Webdeveloper, Project Manager
    Location:
    Byte in the Net
    Home Page:
    Well, that is a php code ;-).

    put <?php before
    and ?> after that code and it should work.
     
    • Thanks Thanks x 1
  8. BlueZero

    BlueZero Power Member

    Joined:
    Jul 6, 2011
    Messages:
    500
    Likes Received:
    257
    Occupation:
    Webdeveloper, Project Manager
    Location:
    Byte in the Net
    Home Page:
    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.
     
    • Thanks Thanks x 1
  9. Ayomav

    Ayomav Regular Member

    Joined:
    Nov 23, 2011
    Messages:
    250
    Likes Received:
    19
    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
     
  10. BlueZero

    BlueZero Power Member

    Joined:
    Jul 6, 2011
    Messages:
    500
    Likes Received:
    257
    Occupation:
    Webdeveloper, Project Manager
    Location:
    Byte in the Net
    Home Page:
    oh ;-)

    remove the self::

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

    added you on skype.