|
Hi Guys and Gals...
I have just started to learn the delights of PHP and implemented some code on a site I am building.
The code is basically a cookie that lets an audio file play once per visitor session.
The coding I have used displays the media player controls on the home page and plays the file automatically, if a viewer navigates away from the page and then returns the file is not played again. The cookie clears when the browser is closed.
The problem I have with the code is when the viewer returns to the home page, the media player controls have dissapeared however I would like them to be on the screen to give the viewer the option to listen to the file again.
Here is the code I have used
<?php setcookie("firsttime","no") ?>
<?php
$firsttime = $_COOKIE[firsttime];
if (@$firsttime != "no") {echo"<embed src='Infinity Group - Work Smarter - New Financial Year (30s).mp3' width='325' height='32' />"; }
?>
the first entry is at the very top of the page and the second is where I want the media controls to appear.
If anyone has any suggestions I would greatly appreciate some help.
Regards
David
|