php - Embed Movie | want to set autoplay function dependent on whether they have visited site before -
i have embedded movie , trying set php function let me see if user has been here before. if have autoplay set false
the followig code not work <?php function autoplay(){ if ($remote_addr == "") { $ip = "no ip"; echo "true"; } else{ $ip = gethostbyaddr($remote_addr); echo "false"; } } ?>
any suggestions please
you use cookie stored in user's browser. session_start(); before else in page, setcookie('visited','yes',$time+2592000); after before loading movie check if $_cookie['visited'] == "yes"; , thats it. 2592000 seconds in month. paste @ first line of page:
<? session_start(); $loopif=($_cookie['visited']=="yes")?false:true;setcookie('visited','yes',$time+2592000); ?>
then $loopif false when user has visited before , true when hasnt, echo needed.
Comments
Post a Comment