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”];
?>
<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]