Hello, I have simple div windows appear when the visitor enter the page, i just want to put an expiring cookie so the visitor see this message window only once even if he refresh the page, and the cookie should expire after an hour or half hour here the page and the code in the source http://www.mp3music.tv/demo.htm so anyone could help to make this window appear only once to each visitor until his cookie expire thanks
come on guys nobody knows, i saw expiring 24hour cookie on a popup code but i couldn't figure out how to use it on my code
You need to do this in PHP, so you would have to move your HTML into a PHP file. At the top of the PHP file, create the cookie like this: <?php setcookie("showdiv", "x", 60*60*24); ?> Identify the HTML code that should only be displayed once a day. Right before that piece of HTML, add this: <?php if(!isset($_COOKIE["showdiv"])) { ?> And right after that piece of HTML, add this: <?php } ?>
hi, thanks for help, i did change demo.htm to demo.php and put this code on the top of the page "<?php setcookie("showdiv", "x", 60*60*24); ?>" then i locate the div html section and i added this code before it "<?php if(!isset($_COOKIE["showdiv"])) { ?>" and then at the end of the </div> section i put this "<?php } ?> " but still message appear in every refresh, did i make any mistake