Another Person with Session troubles :|

MrWicked

New Member
Messages
3
Reaction score
0
Points
0
Alright well i have went over alot of other posts as to people running into session issues in there login scripts.

I am currently in the same boat, I have read that registered globals is disabled. I have session start at the very beginning of all my pages...

The login script takes user input stores it in sessions and redirects them to the index page.. Now the index page can access the user name session variable like such

Code:
if(!empty($_SESSION['user'])){
        $Username = $_SESSION['user'];

Now that all works fine but, I have another page that I need to access that session variable from as well.. The other page has the session_start at the top as well but it constantly tells me that i am not logged in, because its not reading my session data :S

Source

Code:
<?php
session_start();

mysql_connect("local", "***********", "********") or die(mysql_error());
        mysql_select_db("*************") or die(mysql_error());
        $RatingA = $_GET["R"];
        $ID= $_GET["ID"];
        $IP = getenv("REMOTE_ADDR");
        if(is_numeric($ID)) {
        $SID = SanitizeVariable($ID);
        $query = mysql_query("SELECT * FROM `ServerInformation` WHERE ID = '". $SID . "'") or die(mysql_error());
        while($row = mysql_fetch_assoc($query)) {
        $Rating = $row['Rating'];
        $NumberVotes = $row['NumVotes'];
        $ServerName = $row['Name'];
        }
        if(!empty($_SESSION['user'])){
        $Username = $_SESSION['user'];
        $SUsername = SanitizeVariable($Username);
        $SServerName = SanitizeVariable($ServerName);
        if(is_numeric($RatingA)) {

Why dosent it read the variable, the other page reads it no problem... AHHH

This all worked on my old host flawlessly, but not here =\
Edit:
Ok so it turned out to be something different, a function was stopping the session from grabbing the variable but why would the "is_numeric" function not work :S
 
Last edited:
Top