Cloaker that prevents duplicate users from accessing page?

pr0j3ctx

Junior Member
Joined
Feb 24, 2017
Messages
119
Reaction score
68
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.
 
I can help on this for free But what you'll help in return?

This is not how things work here.

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.

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();
}
?>
 
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();
}
?>

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.
 
It creates a simple cookie and then checks to see if that cookie exists or not.
 
It creates a simple cookie and then checks to see if that cookie exists or not.

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.
 
Could you post the error code (you can omit the domain link)?
 
Could you post the error code (you can omit the domain link)?

[03-Mar-2018 14:28:54 UTC] PHP Parse error: syntax error, unexpected ')' in /home/webhostusername/domain.com/check.php on line 4
 
[03-Mar-2018 14:28:54 UTC] PHP Parse error: syntax error, unexpected ')' in /home/webhostusername/domain.com/check.php on line 4

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
 
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.
 
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.
 
May be check JCI and ask them if they can help with such thing ?
 
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.

Works now, I really appreciate your help. Glad this community is helpful. :)
 
Back
Top