Make Sure Visitors visit main proxy page?

Discussion in 'PHP' started by Thyphen, May 9, 2008.

  1. #1
    Im wondering if there is a way so that people Have to visit the my main proxy page before using my proxy.... Im getting 1000's of hits to proxified pages but only 150 or so to my main page. which means people arent seeing my google ads. As in like if someone trys to just surf via the bar at the top they get returned to my main page. then they can start surfing and use the bar then after 24 hours they have to re visit the main page.... I hope this makes sense.
     
    Thyphen, May 9, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Probably the easiest way would be to set a cookie with an expiration of 24 hours on their first visit. If they don't have the cookie or the cookie is expired, you can redirect them to the homepage.
     
    jestep, May 9, 2008 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Something like:

    
    
    function checkCookie()
    {
    
    if(!$_COOKIE['my_proxy_cookie'] || ($_COOKIE['my_proxy_cookie'] <= time()))
    {
    setcookie("my_proxy_cookie", time()+86400, time()+86400);
    
    header("Location: index.php");
    }
    }
    
    
    PHP:
    Make sure you include the function in a global file. Then call it on each page of the website before any other output.

    
    checkCookie();
    
    PHP:
     
    jestep, May 9, 2008 IP
  4. Thyphen

    Thyphen Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So how do I make this global file? And then do i just call that function in the top surf bar?
     
    Thyphen, May 9, 2008 IP
  5. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #5
    Do you have a common header file or something similar?

    Save the function in a file and call it something like: cookefunction.php

    The first line on each page you will want to: include("cookefunction.php");

    Then you can call the function.
     
    jestep, May 9, 2008 IP