Jump to content

Session info changes on Refresh


komquat

Recommended Posts

[code]
<?
//Session Starting
session_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 Starting
session_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>&nbsp;</p>
            <p>&nbsp;</p>
            </div><div class="table_heading">
                <h6>Fantasy Rankings</h6>
            </div>
            <div class="table_body">
                <? include("include/current_standing.php"); ?>
            </div>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <div class="table_heading">
            <h6>1st Half Schedule</h6>
            </div>
            <div class="table_body">
                <? include("include/races.php"); ?>
            </div>
            <p>&nbsp;</p>
            <p>&nbsp;</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>&nbsp;</p>
            <p>&nbsp;</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>&nbsp;</p>
            <p>&nbsp;</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:me@andybourdeau.com">Andy Bourdeau</a>.</p>
    </div>
</div>
</div><!--End Mainwrap-->    
</body>
</html>
[/code]

This is culprit page
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.