sessions

can anyone tell me why these sessions are not staying set? I login, then refresh page, and they are gone! it tells me to login again! :-
[php]<?php
session_start(); // Must start session first thing
/*
Created By Adam Khoury @ www.flashbuilding.com
-----------------------June 20, 2008-----------------------
*/include_once “connect.php”;

// Here we run a login check
// Here we run a login check
if (!isset($_SESSION[‘academy’])) {
echo ‘Please log in to access your account’;
exit();

}else{
$sql = mysql_query(“SELECT * FROM cart”);
while($row = mysql_fetch_array($sql)){
$cid = $row[“cart_id”];
$_SESSION[‘cart_id’] = $cid;

}
$_SESSION[‘academy’]=$academy;
$sql = mysql_query(“SELECT * FROM users where academy=’$academy’”);
while($row = mysql_fetch_array($sql)){
$academy = $row[“academy”];
$_SESSION[‘academy’] = $academy;
}

echo $cid;
}

?>

Untitled Document <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM cart where cart_id = ".$cid." && academy= '$academy'"); while($row = mysql_fetch_array($sql)){ $id =$row["id"]; $id2 = $id+1; ?>
<script type="text/javascript">
$(document).ready(function(){
	$("#delete<?php echo $id; ?>").validate({
		debug: false,
		
		submitHandler: function(form) {
			// do other stuff for a valid form
			$.post('delete.php', $("#delete<?php echo $id;?>").serialize(), function(data) {
				$("#txtHint").load("index.php #txtHint");
				$("#total").load("index.php #total");
			});
		}
	});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
	$(".delete<?php echo $id2; ?>").validate({
		debug: false,
		
		submitHandler: function(form) {
			// do other stuff for a valid form
			$.post('delete.php', $(".delete<?php echo $id2;?>").serialize(), function(data) {
				$("#txtHint").load("index.php #txtHint");
				$("#total").load("index.php #total");
			});
		}
	});
});
</script>

<?php

}
?>
<?php
// Query member data from the database and ready it for display
$sql = mysql_query(“SELECT * FROM products”);
while($row = mysql_fetch_array($sql)){
$id =$row[“id”];
?>

<?php } ?>
<link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />

 

<script type="text/javascript">

function showUser(str)
{
if (str=="")
{
document.getElementById(“txtHint”).innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open(“GET”,“load_data.php?q=”+str,true);
xmlhttp.send();
$("#total").load(“index.php #total”);
$("#txtHint").load(“index.php #txtHint”);

}

function update(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","update.php?"+str,true); xmlhttp.send(); $("#total").load("index.php #total");

}

[/php]

and second part of code:
[php]

  <?php

// Query member data from the database and ready it for display
$sql = mysql_query(“SELECT * FROM cart where cart_id = “.$cid.” && academy = ‘$academy’”);
while($row4 = mysql_fetch_array($sql)){
$product = $row4[“product123”];
$price1 = $row4[“price”];
$id = $row4[“id”];
$qty = $row4[“quantity”];
if($product !=""){

?>

<?php echo $product; ?>
Quantity $
<input type="button" name="submit" value="update" onclick="update(<?php echo "q=".$id."&qty=".$qty."&price=".$price1."" ?> )" />

<?php
$price1 = $price1 * $qty;

$total = $price1 + $total;
?>

<?php }} ?>
  <br />
<?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM products"); while($row5 = mysql_fetch_array($sql)){ $product = $row5["product"]; $id =$row5["id"]; $price =$row5["price"];

?>

<?php } ?>
<input name="cart_id" type="hidden" value="<?php echo $cid; ?>" /><input type="submit" name="empty" class="submit" value="empty cart" style="background-color:lightgreen; height:50px; width:100px;left:0px;" onclick="reload();">   </form>   

<?php if ($total == ""){$total = "0";} ?> <?php echo "$".$total.""; ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM cart where cart_id = ".$_SESSION['cart_id']." && academy= '$academy' && product123 !=''"); while($row = mysql_fetch_array($sql)){ $product = $row["product123"]; $price1 = $row["price"]; $id = $row["product_id"]; $qty = $row["quantity"];

$month = date(“F Y”);
$day = date(“d”);
$year = date(“Y”);
$date = date(“Y-m-d”);
?>

<?php
}
?>

<?php if ($total == " "){$total = "0";} ?>
  • Retail
  • Trial Course
  • Testing
  • Events
  • Birthday Paties
  • Enrollment Fee
  • Packages
  • Private lessons
  • Championships
  • Main Retail

  • Sparring/Ecas Gear

  • Uniforms

  • Manuals

  • Patches

<?php

$sql = mysql_query(“SELECT * FROM products where category=‘retail’ and subcategory=‘none’”);
$i = 0;
echo "

";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘retail’ and subcategory=‘Sparring/ECAS Gear’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%5 == 4) echo ''; $i++; }
echo "</table> </center>";
?>

      </div>
      <div class="TabbedPanelsContent"> <?php

$sql = mysql_query(“SELECT * FROM products where category=‘retail’ and subcategory=‘Uniforms’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘retail’ and subcategory=‘Manuals’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

”;
?>

[/php]

and last:
[php]



<?php echo ""; if ($i && $i%6 == 5) echo ''; $i++; } echo " "; ?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘retail’ and subcategory=‘Patches’”);
$i = 0;
echo "

";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Trial Course’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Testing’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Events’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Birthday Parties’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Enrollment Fee’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Package’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Private Lesson’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>
<?php

$sql = mysql_query(“SELECT * FROM products where category=‘Championships’ and subcategory=‘none’”);
$i = 0;
echo "

”;
?> <?php echo "
";
    while($row = mysql_fetch_assoc($sql)){

$product = $row[“product”];
$id =$row[“id”];
$price =$row[“price”];
$text = $product;
$newtext = wordwrap($text, 14);
$final1 ="".$newtext."
$".$price."";

echo “

"; if ($i && $i%6 == 5) echo ''; $i++; }
echo "</table> </center>";
?>

 

 

 

 

[/php]
”;
?> <?php echo "
Sponsor our Newsletter | Privacy Policy | Terms of Service