HTML5 Data Bindings State Management Support Product Page

Answered

First time user cookie

Asked 15 Apr 2016 05:49:41
1
has this question
15 Apr 2016 05:49:41 Greta Garberini posted:
Hi,
According to European law one has to inform users about setting cookies on visiting a website. In principle I know how to do it in php:
<?php    // Top of the page
$user_not_here_before = !isset( $_COOKIE["YoureNew"] );
    // Set the cookie so that the message doesn't show again
        setcookie( "YoureNew", "No", strtotime( '+1 year' ) );
?>

<?php if( $user_not_here_before ): ?>
    Agree to terms and conditions
<?php endif; ?>


<?php // Next time you're not new anymore. Show cookie or whatever
 echo $_COOKIE["YoureNew"];
?>

I would like to setup this with HTML5 DBSM combined with a modal or notify2.
Is this possible?

Replies

Replied 15 Apr 2016 08:01:55
15 Apr 2016 08:01:55 Teodor Kuduschiev replied:
Hello,
You can use bootstrap 3 alert, with the "data-show" option, if the "$_COOKIE["YoureNew"]" doesn't exist.
This way the alert will be shown if the user is new, and won't be shown, once thee cookie exists.
Replied 15 Apr 2016 09:28:32
15 Apr 2016 09:28:32 Greta Garberini replied:
Oh thanks,
I did not assume it would be so easy

Reply to this topic