Session Or Cookie Script
I need a php session or cookie script or possibly java script.
Here is what I would like accomplished –
I have a swf banner on my homepage (www.impactspokesperson.com) and I want this banner to show the first time a visitor comes on to my website. If the visitor refreshes the page or come back to the page before the cookie or session expires I would like to display something else.
***Please Do not Say that you can do it immediately if you do not plan on doing it immediately. Thanks
This is the code I have for the flash banner:
<object type=”application/x-shockwave-flash” data=”landing.swf” width=”900″ height=”294″>
<param name=”movie” value=”landing.swf” />
<img src=”template/banner1.jpg” width=”900″ height=”294″ alt=”Add a virtual spokesperson to your website” />
</object>
And I want this to appear only once per session and I want the session to last for 1 day.
This is the code that I want to show when the visitor refreshes the page or comes back before the session expires.
<table border=”0″ cellpadding=”0″ cellspacing=”0″ class=”bannercontainer”>
<tr>
<td width=”65%”><img src=”template/banner3.jpg” alt=”Add a Virtual Spokesperson to your web site” width=”584″ height=”294″ /></td>
<td width=”35%” valign=”top”><table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td><h2 align=”center”>This Week’s Featured Spokespeople </h2></td>
</tr>
<tr>
<td><div align=”center”>
<?php
include(“includes/config.inc.php”);
include(“includes/connect.inc.php”);
$query=”SELECT * FROM spokespeople WHERE featured REGEXP ‘[[:<:]]yes[[:>:]]'”;
$result = mysql_query($query);
$columnes = 2; // Define number of columns our table should have.
//Create the table with images
echo “<table width=\”100%\” border=\”0\” cellpadding=\”5\” cellspacing=\”4\”>”;
for ($i=1; $rows=mysql_fetch_array($result); $i++) {
$resto = ($i % $columnes);
if ($resto == 1) {echo “<tr>”;}
echo “<td><div align=\”center\”><a href=\”virtual-spokesperson.php?id=”.$rows[‘id’].”\”><img src=\”sp_pics/”.$rows[‘photo’].”\” alt=\”Virtual Spokesperson “.$rows[‘name’].”\” width=\”115\” height=\”129\” border=\”0\” /><br /></a>”.$rows[‘name’].”</div></td>”;
if ($resto == 0) {echo “</tr>”;}
}
if ($resto <> 0) {
$ajust = $columnes – $resto;
for ($j = 0; $j < $ajust; $j++) {echo “<td> </td>”;}
echo “</tr>”;
}
echo “</table>”;
// get value of id that sent from address bar
$id=$_GET[‘id’];
// Retrieve data from database
$sql=”SELECT * FROM $tbl_name WHERE id=’$id'”;
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
echo $rows[‘javacode’];
?>
</div></td>
</tr>
<tr>
<td><table width=”95%” border=”0″ align=”center” cellpadding=”0″ cellspacing=”0″ class=”box2″>
<tr>
<td width=”36%” class=”bodytext”><div align=”center”><strong>30 Sec </strong></div></td>
<td width=”36%” class=”bodytext”><div align=”center”><strong>60 Sec </strong></div></td>
</tr>
<tr>
<td><div align=”center” class=”blue”>$285.00</div></td>
<td><div align=”center” class=”blue”>$385.00</div></td>
</tr>
</table></td>
</tr>
<tr>
<td class=”footerspacer”></td>
</tr>
<tr>
<td><div align=”center”><a href=”http://www.impactspokesperson.com/forms.php?form=2&begin=1″ onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘order’,”,’template/order2.png’,1)”><img src=”template/order.png” alt=”Order Your Virtual Spokesperson Today” name=”order” width=”290″ height=”64″ border=”0″ id=”order” /></a><a href=”http://www.impactspokesperson.com/forms.php?form=2&begin=1″></a></div></td>
</tr>
</table></td>
</tr>
</table>