Show content only once per IP!

vodkaa

Junior Member
Joined
May 23, 2013
Messages
119
Reaction score
23
Hello folks,


What I want is to show certain content (image) only once for each visitors of my website based on their IP address (or anything).


Is there a way to do this?


Thanks.
 
hey maybe something like this will work

Code:
// check if they've been here, if they haven't set
// a cookie for subsequent visits
if($_COOKIE['beenhere']) { 
    setcookie("beenhere", '1');
}
else {
    // where you want them to go if they've seen this page
    header('Location: http://www.example.com/');
 
Don't forget to set expiration time for the cookie else it will expire at the end of the session and the user will see the same content again when visiting your website.

setcookie("CookieName", $CookieValue, time()+3600); /* -3600 sec expire in 1 hour */
 
Back
Top