Page 1 of 1

login with sessions

Posted: Wed Jan 21, 2004 3:28 pm
by dull1554
i just wrote a login script and am having immense problems with session_start();

heres my code

Code: Select all

<?php
session_start();
include "inc.php";
$username = $_POST['user'];
$password = $_POST['password'];
$query = mysql_query("SELECT password FROM users WHERE username='$username'");
$db = mysql_fetch_array($query);
$db_pass = $db['password'];
$userage = $db['age'];
if (md5($password) == $db_pass)
{
$_SESSION['user'] = $username;
$_SESSION['age'] = $userage;
echo "<center>Log In Complete</center>";
}
else
{
echo "not found in database! please register!";
}
?>
all in inc.php is my db connection junk

heres what the page returns

Code: Select all

Warning: session_start(): open(/tmp\sess_417e4c1d7e1098a100c37c03a38b1dad, O_RDWR) failed: No such file or directory (2) in c:\program files\apache group\apache\htdocs\login.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\program files\apache group\apache\htdocs\login.php:2) in c:\program files\apache group\apache\htdocs\login.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\login.php:2) in c:\program files\apache group\apache\htdocs\login.php on line 2

Log In Complete

Warning: Unknown(): open(/tmp\sess_417e4c1d7e1098a100c37c03a38b1dad, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
please help

Posted: Wed Jan 21, 2004 3:58 pm
by dull1554
bump_er_oni.......i've googled this one to death and no luck

Posted: Wed Jan 21, 2004 3:58 pm
by Roja
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
All of the errors stem from this one. You need to edit your php.ini and give it a correct session.save_path. /tmp doesnt exist on your windows box.. you probably need something like c:\WINNT\TEMP.

And bumping after 30 minutes is a bit obnoxious..

I PM'd you, by the way.

Posted: Wed Jan 21, 2004 4:41 pm
by patrikG
As Roja said - if you have server-access, check that that /tmp (default session directory) directory on your server has chmod 0775.

Posted: Thu Jan 22, 2004 1:57 am
by doggy
I just get this errors from that script ...

Warning: Cannot send session cookie - headers already sent by (output started at C:\FoxServ\www\phpatlas\modules\your_account\login.php:29) in C:\FoxServ\www\phpatlas\modules\your_account\login.php on line 5

Warning: Cannot send session cache limiter - headers already sent (output started at C:\FoxServ\www\phpatlas\modules\your_account\login.php:29) in C:\FoxServ\www\phpatlas\modules\your_account\login.php on line 5
not found in database! please register!

Posted: Thu Jan 22, 2004 9:28 am
by Roja
doggy wrote:I just get this errors from that script ...

Warning: Cannot send session cookie - headers already sent by (output started at C:\FoxServ\www\phpatlas\modules\your_account\login.php:29) in C:\FoxServ\www\phpatlas\modules\your_account\login.php on line 5

Warning: Cannot send session cache limiter - headers already sent (output started at C:\FoxServ\www\phpatlas\modules\your_account\login.php:29) in C:\FoxServ\www\phpatlas\modules\your_account\login.php on line 5
not found in database! please register!
Probably because you dont have the file "inc.php" from the include he posted. :)