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

Anyone know of a script or code that does this?

Discussion in 'Making Money' started by dennisyu, Apr 4, 2012.

  1. dennisyu

    dennisyu Power Member

    Joined:
    Jan 9, 2010
    Messages:
    552
    Likes Received:
    170
    Obviously you could pay someone to code such a thing, shouldn't be too hard. But i'm curious if anyone knows of something that's already out there.

    Basically, when a user leaves your landing page and comes back-- i want it to display different html. I believe it's a javascript cookie thang.
     
    Last edited: Apr 4, 2012
  2. kokoloko75

    kokoloko75 Elite Member

    Joined:
    Jan 1, 2011
    Messages:
    1,628
    Likes Received:
    1,937
    Occupation:
    Design director
    Location:
    Paris (France)
    You should log IPs in a database, with an integer (0 if IP doesn't exists, 1 if already visited).
    Then, if integer = 1 he'll be redirected to Page1, else to Page0.

    Don't know for the code, sorry... :)

    Beny
     
  3. riekal

    riekal Junior Member

    Joined:
    Aug 11, 2009
    Messages:
    121
    Likes Received:
    38
    Occupation:
    Marketing & Retargeting Boss
    Location:
    TN
    Why not use a cookie with dynamic content insertion?
     
  4. BigGuys

    BigGuys Junior Member

    Joined:
    Nov 30, 2011
    Messages:
    163
    Likes Received:
    614
    cookie magic ;)

    easily done google if your friend and so is the search button
     
  5. zen19

    zen19 Elite Member

    Joined:
    Mar 31, 2009
    Messages:
    1,672
    Likes Received:
    4,071
    Occupation:
    LOL ya right
    Location:
    International Waters
    • Thanks Thanks x 1
  6. 45415

    45415 Junior Member

    Joined:
    Feb 5, 2009
    Messages:
    194
    Likes Received:
    92
    Something likes this.

    To set the cookie:
    PHP:
    $expire time() + 3600*24// 24 hours
    setcookie("some_name""1"$expire"/"); // name=some_name, value=1, expires after $expire seconds, path = / (whole domain)
    To check, if the user has cookie:
    PHP:
    if ( isset( $_COOKIE["some_name"] ) ) {
        
    // redirect or show the code for returning users
    }
    else {
        
    // redirect or show the code for first time users
    }
     
    • Thanks Thanks x 1
  7. Tylercoon2010

    Tylercoon2010 Newbie

    Joined:
    Mar 30, 2012
    Messages:
    20
    Likes Received:
    3
    Make this your index.php page:

    PHP:
    <?php 
    if(isset($_COOKIE['hasVisit'])){
    include(
    "hasvisited.php");}else{ include("nevervisited.php");} ?>
    Then on nevervisited.php put this:
    PHP:
    <?
    $expiry 60 60 24 365 10 time();  setcookie('hasVisit'1$expiry); 
    ?>
     
    • Thanks Thanks x 1