I am having a tough time implementing sessions over 3 pages
test.php - this page will display the selected table from the dropdown box. .Each cell also has an action where if you click in it, something happens and then updates the table in the DB and in turn gets updated here via test_checksum.php
test_checksum.php sole purpose is to get all data from the table and store an MD5 in a session every second.
load_table.php will create the table based on the drop down selection on test.php and also after it gets updated via test_checksum.php
I can flip flop between tables just fine. I can click on any cell in any table just fine and the table updates properly.
Problem - in load_table.php, I can not do
unset($_SESSION[“group_pairing_name_video”])
becuase it seems to be doing nothing
I am stuck doing
session_unset($_SESSION[“group_pairing_name_video”])
Since I need to replicate these 3 pages 7 more times (under different var and session names), all other sessions die when I use that
test.php
<script>
function refresh_div() {
jQuery.ajax({
url:'test_checksum.php',
type:'POST',
success:function(results) {
jQuery(".result").html(results);
if (results != "no change")
{
$("#screen_video").load('load_table.php?lang=<?php echo $lng;?>');
}
}
});
}
t = setInterval(refresh_div,1000);
</script>
<!--<div class="result"></div>-->
<script>
function showUser(str) {
if (str=="") {
document.getElementById("txtHint").innerHTML="";
return;
}
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (this.readyState==4 && this.status==200) {
document.getElementById("txtHint").innerHTML=this.responseText;
}
}
xmlhttp.open("GET","load_table.php?lang=<?php echo $lng;?>&video="+str,true);
xmlhttp.send();
}
</script>
<select name = 'video_group' class = "rounded" onchange='showUser(this.value)'>
<option>All</option>
<option>test</option>
</select>
<div id="screen_video"><div id='txtHint'></div>
<div id="content"></div>
<img src="loading.gif" id="loading" alt="loading" style="display:none;" />
</div>
</div>
load_table.php
session_start();
$group_pairing_name_video = $_GET['video'];
if($group_pairing_name_video)
{
if($group_pairing_name_video !== $_SESSION["group_pairing_name_video"])
{
session_unset($_SESSION["group_pairing_name_video"]);
$_SESSION["group_pairing_name_video"] = $group_pairing_name_video;
$_SESSION["group_pairing_name_video_previous"] =
$group_pairing_name_video;
}
else
{
$_SESSION["group_pairing_name_video"] = $group_pairing_name_video;
}
}
else
{
$group_pairing_name_video = $_SESSION["group_pairing_name_video_previous"];
}
test_checksum.php
<?php
session_start();
$_SESSION["my_checksum_video_grid"] = $my_checksum_video_grid;
if($_SESSION["my_checksum_video_grid"] == $_SESSION['my_previous_checksum_video_grid'])
{
//do nothing
echo "no change";
mysqli_close($con);
}
else
{
unset($_SESSION["my_previous_checksum_video_grid"]);
$_SESSION['my_previous_checksum_video_grid'] = $my_checksum_video_grid;
//Execute script
echo $my_checksum_video_grid;
mysqli_close($con);
}
?>