Jump to content

Having some Session problems


burn1337

Recommended Posts

Ok so I'm tyring to make a login script and the problem is that everytime I log in, only the page that logs me in has my session variables, everytime I try to go to a different page the variables are being lost

 

$Session = new Sessions;
$Session->SessionStart();

if (!isset($_SESSION['Uid']) && !isset($_SESSION['UserName'])) {
$login = new Login;
$login->LoginBox();


}
else {
$login = new Login;
$login->LoggedInBox();	
}

 

function Login() {
	$UserName = $_POST['UserName'];
	$Password = $_POST['Password'];
	$Pass = sha1($Password);
	$query = new Query;
	$query->GetUser($UserName, $Pass);
	session_write_close();
}

function GetUser($UserName, $Password) {
	$Check = "select * from Users where userName='$UserName' and password='$Password'";
	$Temp = mysql_query($Check) or die("Sorry you must have the wrong UserName and/or Password"); 
	$Row = mysql_fetch_array($Temp);
	$_SESSION['Uid'] = $Row[0];
	$_SESSION['UserName'] = $Row[1];
	session_write_close();			
}

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/122190-having-some-session-problems/
Share on other sites

well because the function $Sessions->SessionStart() is this:

function SessionStart() {
	//ini_set('session.use_cookies', 1);
	//ini_set('session.use_only_cookies', 1);
	ini_set('session.name', 'NewRealm');
	session_cache_expire(90);
	session_save_path('/usr/local/apache2/Session');
	session_start();

}

The way I have it set up is so all I have is one include this way I just have to include the one file. It works, except for when I go to a new page (same include and all) then it just clears the data. I've even tried without the session_write_close() and still nothing. btw this isn't incorporated into my actual site, I'm trying to work out the bugs first lol

well I was kinda thinkin that too, but if I do it will still be used in my include file, Ill try it in the morning, btw you should check out my site, and if your interested I could use some one to assist me in getting the site done lol. anyways off to never never land night

PFMaBiiSmAd I tried that I get

Welcome,

Notice: Undefined variable: SESSION in /usr/local/apache2/htdocs/sessions.php on line 39

Monday September 1, 2008, 10:41:46 am

Check

 

it is set6

 

after loggin in, recently it stopped displaying the UserName.

 

after going to the next page I get this.

 

Notice: Undefined index: UserName in /usr/local/apache2/htdocs/sessions.php on line 51

 

Notice: Undefined index: Password in /usr/local/apache2/htdocs/sessions.php on line 52

Welcome,

Notice: Undefined variable: SESSION in /usr/local/apache2/htdocs/sessions.php on line 39

Monday September 1, 2008, 10:43:25 am

it is not setUid is null

 

now all the code that is being used has already been posted anything else I may be missing? is my syntax screwed up? is my placement off? what am I doing wrong... btw when I open my cookie with epiphany, I get Expires : end of current session. I have as you can see set the expire time to 90 but it's still not working... could this be something a little more deeper then just php? or is it a picnic error?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.