Cloaker that prevents duplicate users from accessing page?

Discussion in 'Cloaking and Content Generators' started by pr0j3ctx, Mar 3, 2018.

  1. pr0j3ctx

    pr0j3ctx Junior Member

    Joined:
    Feb 24, 2017
    Messages:
    118
    Likes Received:
    67
    Gender:
    Male
    Occupation:
    Social media
    I'm looking for a free cloaker or html code which will redirect people to another site of my liking if they've already visited the site once.
    They enter the website once, then they do something and get redirected.
    Next time they click on the original link, the code/cloaker automatically redirects them somewhere else.

    I know this exists, just don't know how to look it up. Preferably free please.

    Would like some help. Thanks.
     
  2. WestVirginia

    WestVirginia Newbie

    Joined:
    Dec 21, 2017
    Messages:
    46
    Likes Received:
    6
    Gender:
    Female
    Occupation:
    adwords & travel
    Location:
    Lost on Earth
    I can help on this for free But what you'll help in return?
     
  3. Sephrata

    Sephrata Jr. VIP Jr. VIP

    Joined:
    Mar 25, 2017
    Messages:
    2,078
    Likes Received:
    1,950
    Gender:
    Male
    Location:
    Worldwide
    This is not how things work here.

    Try this PHP code:

    Code:
    <?php
    if (!isset($_COOKIE['firsttime']))
    {
        setcookie("firsttime", "no", /* EXPIRE */);
        header('Location: http://www.yoursite.com/safe-page.php');
        exit();
    }
    else
    {
        header('Location: http://www.yoursite.com/money-page.php');
        exit();
    }
    ?>
    
     
    • Thanks Thanks x 1
  4. pr0j3ctx

    pr0j3ctx Junior Member

    Joined:
    Feb 24, 2017
    Messages:
    118
    Likes Received:
    67
    Gender:
    Male
    Occupation:
    Social media
    Thank you. Could you elaborate what this code does?
    How does it see whether it's the visitor's first time visiting the page?

    That's all I need to know, the rest of the code I understand.
     
  5. Sephrata

    Sephrata Jr. VIP Jr. VIP

    Joined:
    Mar 25, 2017
    Messages:
    2,078
    Likes Received:
    1,950
    Gender:
    Male
    Location:
    Worldwide
    It creates a simple cookie and then checks to see if that cookie exists or not.
     
  6. pr0j3ctx

    pr0j3ctx Junior Member

    Joined:
    Feb 24, 2017
    Messages:
    118
    Likes Received:
    67
    Gender:
    Male
    Occupation:
    Social media
    It's not working properly for me. Maybe a code which check for the cookie and if it's not their then create one
    Of course with the redirects in there so it redirects if it's already created before.

    I put it in my html code but it doesn't do anything. Also tried into a seperate php file, getting errors on line 4.
    Appreciate the help so far.
     
  7. Sephrata

    Sephrata Jr. VIP Jr. VIP

    Joined:
    Mar 25, 2017
    Messages:
    2,078
    Likes Received:
    1,950
    Gender:
    Male
    Location:
    Worldwide
    Could you post the error code (you can omit the domain link)?
     
  8. pr0j3ctx

    pr0j3ctx Junior Member

    Joined:
    Feb 24, 2017
    Messages:
    118
    Likes Received:
    67
    Gender:
    Male
    Occupation:
    Social media
    [03-Mar-2018 14:28:54 UTC] PHP Parse error: syntax error, unexpected ')' in /home/webhostusername/domain.com/check.php on line 4
     
  9. Sephrata

    Sephrata Jr. VIP Jr. VIP

    Joined:
    Mar 25, 2017
    Messages:
    2,078
    Likes Received:
    1,950
    Gender:
    Male
    Location:
    Worldwide
    Ah, you need to put an expiry for the cookie:

    Code:
        setcookie("firsttime", "no", 2147483647);
    This is the maximum time you can set for the cookie expiry.

    If you want a shorter time, then this site guides you how to calculate it - https://www.w3schools.com/php/func_http_setcookie.asp
     
  10. pr0j3ctx

    pr0j3ctx Junior Member

    Joined:
    Feb 24, 2017
    Messages:
    118
    Likes Received:
    67
    Gender:
    Male
    Occupation:
    Social media
    This is what I've got now

    <?php
    if (!isset($_COOKIE['firsttime']))
    {
    setcookie("firsttime", "no", 2147483647);
    header('Location: http://safepage.com');
    exit();
    }
    else
    {
    header('Location: http://www.moneypage.com/');
    exit();
    }
    ?>

    Whenever I refresh, it won't redirect me to the safepage. I'm not sure why.
     
  11. Sephrata

    Sephrata Jr. VIP Jr. VIP

    Joined:
    Mar 25, 2017
    Messages:
    2,078
    Likes Received:
    1,950
    Gender:
    Male
    Location:
    Worldwide
    That's because the cookie has already been created.

    Change firsttime to secondtime and reupload (or delete the firsttime cookie).

    Or try a different browser.
     
  12. Nut-Nights

    Nut-Nights Jr. VIP Jr. VIP

    Joined:
    Jun 20, 2013
    Messages:
    6,922
    Likes Received:
    4,147
    Location:
    Hell
    Home Page:
    May be check JCI and ask them if they can help with such thing ?
     
  13. Sephrata

    Sephrata Jr. VIP Jr. VIP

    Joined:
    Mar 25, 2017
    Messages:
    2,078
    Likes Received:
    1,950
    Gender:
    Male
    Location:
    Worldwide
    And pay $400+ a month?

    What @pr0j3ctx is looking to do can be done in 10 lines of basic PHP script. I don't see why he needs JCI and what value it adds to him.
     
    • Thanks Thanks x 1
  14. pr0j3ctx

    pr0j3ctx Junior Member

    Joined:
    Feb 24, 2017
    Messages:
    118
    Likes Received:
    67
    Gender:
    Male
    Occupation:
    Social media
    Works now, I really appreciate your help. Glad this community is helpful. :)