komquat Posted February 28, 2006 Share Posted February 28, 2006 When I refresh certain pages, my session variables change value. Can anyone shed some light on this for me? Link to comment https://forums.phpfreaks.com/topic/3787-session-info-changes-on-refresh/ Share on other sites More sharing options...
Caesar Posted February 28, 2006 Share Posted February 28, 2006 Odd...unless, you haven't registered the session variables. :-)Any chance you can paste some code? Link to comment https://forums.phpfreaks.com/topic/3787-session-info-changes-on-refresh/#findComment-13154 Share on other sites More sharing options...
komquat Posted February 28, 2006 Author Share Posted February 28, 2006 [code]<?//Session Startingsession_start();include("include/connection.php");$sql_1 = "SELECT * FROM users WHERE first_name = '$_POST[username]' and password = '$_POST[password]' ";$qry_auth_result = mysql_query($sql_1, $connection) or die("Could not execute Authentication Query.");$num = mysql_num_rows($qry_auth_result);while ($row = mysql_fetch_assoc($qry_auth_result)) { $permission = $row [permission]; $first_name = $row [first_name]; $user_tag = $row[user_tag]; }$_SESSION[permission] = $permission;$_SESSION[first_name] = $first_name;$_SESSION[user_tag] = $user_tag;[/code]This is where I login and register variables[code]<?//Session Startingsession_start(); if ($_SESSION[valid] != "yes") { header("location:http://www.andybourdeau.com/nascar"); exit; }?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>Fantasy Nascar</title><meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /><meta http-equiv="Content-Language" content="en-us" /><link href="styles/nascarlayout.css" media="screen" rel="stylesheet" type="text/css" /><style>body { background-color: white; /*background-image:url(images/greytexture.jpg);*/ font: 100% verdana, helvetica, "trebuchet ms", arial; behavior: url(css/csshover.htc); }* {margin:0; padding:0;}</style></head><body><div id="mainwrap"> <div id="titlebar"> <h1>Fantasy Nascar</h1> </div> <div><!--Menu Bar Here--> <? include("include/nascar_drop_menu.php"); ?> </div> <div id="contentarea" class="clearfix"> <div id="left_column"> <div class="table_heading"> <h5><? echo $_SESSION[first_name]; ?> Drivers</h5> </div> <div class="table_body"> <p align="center"><? include("include/display_drivers.php"); ?></p> <br> <p> </p> <p> </p> </div><div class="table_heading"> <h6>Fantasy Rankings</h6> </div> <div class="table_body"> <? include("include/current_standing.php"); ?> </div> <p> </p> <p> </p> <div class="table_heading"> <h6>1st Half Schedule</h6> </div> <div class="table_body"> <? include("include/races.php"); ?> </div> <p> </p> <p> </p> </div> <div id="right_column"> <div class="table_heading"> <h5><? echo $_SESSION[first_name]; ?>, Your Information</h5> </div> <div class="table_body"> <p>This is a work in progress</p> </div> <p> </p> <p> </p> <div class="table_heading"> <h5>Fantasy League News</h5> <p>Last Updated: <? include("include/last_update.php"); ?></p> </div> <div class="table_body"> <? include("include/display_comments.php"); ?> </div> <p> </p> <p> </p> <div class="table_heading"> <h5>Nascar News</h5> <p>Click on a headline below to read the news.</p> </div> <div class="table_body"> <div id="rss_feed"><p><? include("include/nascar_rss.php"); ?></p></div> </div> </div> </div><!--contentarea ended--><div id="footer"> <div class="table_body"> <p align="center">This page was designed by <a href="mailto:[email protected]">Andy Bourdeau</a>.</p> </div></div></div><!--End Mainwrap--> </body></html>[/code]This is culprit page Link to comment https://forums.phpfreaks.com/topic/3787-session-info-changes-on-refresh/#findComment-13155 Share on other sites More sharing options...
komquat Posted March 1, 2006 Author Share Posted March 1, 2006 The weirdest thing is that it is the second $_SESSION[first_name] that is showing the wrong name, then on refresh they both show the same name, but it is the wrong one.I am confused on that!!Help please! Link to comment https://forums.phpfreaks.com/topic/3787-session-info-changes-on-refresh/#findComment-13185 Share on other sites More sharing options...
komquat Posted March 1, 2006 Author Share Posted March 1, 2006 I think I know why this is doing it, in the second include, I am calling information from the same table and it includes $first_name. This is overwriting that variable. Is there anything I can do to get around this? Link to comment https://forums.phpfreaks.com/topic/3787-session-info-changes-on-refresh/#findComment-13193 Share on other sites More sharing options...
komquat Posted March 1, 2006 Author Share Posted March 1, 2006 I figured this one out as well.Thanks! Link to comment https://forums.phpfreaks.com/topic/3787-session-info-changes-on-refresh/#findComment-13203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.