When your website means business.

Cookies, CSS, PHP | Type: PHPSet Cookie, Change Content (or change class)

Using a cookie to change content for repeat visits.

At the top of your page (before doc declaration):
<?php
$revisit = false;
if(isset($_COOKIE['div'])){
    $revisit = true;
} else {
    setcookie('div', true, 86400 + time()); //24 hours shown (seconds)
    $revisit = false;
}
?>

Then where you want your on-page content:
<?php
if($revisit){
    echo '<div>You’ve been here before!</div>';
} else {
    echo '<div>It’s your first time!</div>';
}
?>
OR
<?php
if($revisit){
    echo '<div class="something-after">content</div>';
} else {
    echo '<div class="something-first">content</div>';
}
?>

Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Cookies Notice