[PHP] Re: !!Urgent .. Session Problem Solved ... But not completely
Message-ID: <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Reply-To: "Dre" <[EMAIL PROTECTED]> From: "Dre" <[EMAIL PROTECTED]> Date: Sat, 4 Sep 2004 16:10:32 +0300 Subject: Re: !!Urgent .. Session Problem Solved ... But not completely > > the errors are as follows > > //= > > Warning: session_start(): Cannot send session cookie - headers already sent > > by (output started at C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php on line 2 > > > > Warning: session_start(): Cannot send session cache limiter - headers > > already sent (output started at C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php on line 2 > > > > //= > >>// > >> > >> >> session_start(); > >> include("db.php"); Does db.php starts with: session_start() ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !!Urgent .. Session Problem Solved ... But not completely
It has to be in SOME file. Probably in your prepend file or one of the files that it includes. "Dre" <[EMAIL PROTECTED]> wrote: believe me the FIRST line in the file is "M. Sokolewicz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I think you didn't read all instructions we gave. One of them was to remove all spaces and/or newlines BEFORE the first anything before the PHP starts processing PHP encounters spaces and/or newlines PHP sends headers to the browser PHP sends those spaces and/or newlines to the browser PHP notices the -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !!Urgent .. Session Problem Solved ... But not completely
believe me the FIRST line in the file is wrote in message news:[EMAIL PROTECTED] > I think you didn't read all instructions we gave. One of them was to > remove all spaces and/or newlines BEFORE the first file, to save it and try again. > > anything before the headers are always sent before the output is, they will be sent the > moment PHP notices the spaces and/or newlines. So, what happens is: > > PHP starts processing > PHP encounters spaces and/or newlines > PHP sends headers to the browser > PHP sends those spaces and/or newlines to the browser > PHP notices the PHP notices session_start(); and thus tries to send a cookie (a cookie > is actually one of the headers) > PHP notices that headers have already been sent! So it gives an error, > because it can't "get them back and send them after the cookie again". > > So, remove the spaces and/or newlines before the > Hope you get what to do now ;| > > - Tul > > Dre wrote: > > > thank u all .. > > I really did all of what u said but nothing worked ! which was > > so so strange > > The problem was that the php.ini file I have got corrupted or something that > > the php.exe couldn't parse all of its values > > > > Any way thanks again .. > > Now I have another error with the same file and session > > the errors are as follows > > //= > > Warning: session_start(): Cannot send session cookie - headers already sent > > by (output started at C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php on line 2 > > > > Warning: session_start(): Cannot send session cache limiter - headers > > already sent (output started at C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php on line 2 > > > > //= > > > > > > "Dre" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>Hi > >> > >>I'm trying to make a small login system on my website, I'm using > >> > >> Apache 2.0.49 for testing locally > >> and PHP 4.3.4 > >> on MS Windows XP Pro. > >> > >> the login script is in the file logme_in.php shown below > >> > >>// > >> > >> >> session_start(); > >> include("db.php"); > >> > >> $username = trim(addslashes($_POST['user_name'])); > >> $pass = trim(addslashes($_POST['password'])); > >> > >> if((empty($_POST['user_name'])) || (empty($_POST['password']))) { > >> > >> echo "enter username/password"; > >> } > >> > >> else{ > >> $sql = "SELECT * FROM members WHERE user_name='".$username."' AND > >>password='".$pass."'"; > >> $result = mysql_query($sql); > >> $num_return = mysql_num_rows($result); > >> > >> if($num_return ==1) > >> { > >>$row = mysql_fetch_array($result); > >> session_register('uname'); > >> $_SESSION['uname'] = $username; > >> > >> } > >> else { > >> echo "invalid username/password"; > >> } > >> } > >> > >> ?> > >>// > >> > >>The problem is that every time I try to login I keep have the following > >>error messages > >> > >> > > > > > > > >>** > >>Warning: session_start(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, > >>O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > >> > >>Warning: session_start(): Cannot send session cookie - headers already > > > > sent > > > >>by (output started at C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > >> > >>Warning: session_start(): Cannot send session cache limiter - headers > >>already sent (output started at C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > >> > >>Warning: Unknown(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, > > > > 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 > >> > > > > > > > >>*** > >> > >>the session.save_path parameter in my php.ini file is as follows > >>** > >>session.save_path = "C:/WINDOWS/Temp" > >>** > >> > >>I'm kinda new at php and web development environment .. so any help will > > > > be > > > >>appreciated. > >> > >>Thanks in advance > >>Dre, -- PHP General Mailing List (http://www.php.net/) To unsubscribe
[PHP] Re: !!Urgent .. Session Problem Solved ... But not completely
I think you didn't read all instructions we gave. One of them was to remove all spaces and/or newlines BEFORE the first anything before the PHP starts processing PHP encounters spaces and/or newlines PHP sends headers to the browser PHP sends those spaces and/or newlines to the browser PHP notices the PHP notices session_start(); and thus tries to send a cookie (a cookie is actually one of the headers) PHP notices that headers have already been sent! So it gives an error, because it can't "get them back and send them after the cookie again". So, remove the spaces and/or newlines before the Hope you get what to do now ;| - Tul Dre wrote: thank u all .. I really did all of what u said but nothing worked ! which was so so strange The problem was that the php.ini file I have got corrupted or something that the php.exe couldn't parse all of its values Any way thanks again .. Now I have another error with the same file and session the errors are as follows //= Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 2 //= "Dre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi I'm trying to make a small login system on my website, I'm using Apache 2.0.49 for testing locally and PHP 4.3.4 on MS Windows XP Pro. the login script is in the file logme_in.php shown below // $username = trim(addslashes($_POST['user_name'])); $pass = trim(addslashes($_POST['password'])); if((empty($_POST['user_name'])) || (empty($_POST['password']))) { echo "enter username/password"; } else{ $sql = "SELECT * FROM members WHERE user_name='".$username."' AND password='".$pass."'"; $result = mysql_query($sql); $num_return = mysql_num_rows($result); if($num_return ==1) { $row = mysql_fetch_array($result); session_register('uname'); $_SESSION['uname'] = $username; } else { echo "invalid username/password"; } } ?> // The problem is that every time I try to login I keep have the following error messages ** Warning: session_start(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 3 Warning: Unknown(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, 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 *** the session.save_path parameter in my php.ini file is as follows ** session.save_path = "C:/WINDOWS/Temp" ** I'm kinda new at php and web development environment .. so any help will be appreciated. Thanks in advance Dre, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !!Urgent .. Session Problem Solved ... But not completely
thank u all .. I really did all of what u said but nothing worked ! which was so so strange The problem was that the php.ini file I have got corrupted or something that the php.exe couldn't parse all of its values Any way thanks again .. Now I have another error with the same file and session the errors are as follows //= Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache Group\Apache2\htdocs\ELBA\logme_in.php on line 2 //= "Dre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > I'm trying to make a small login system on my website, I'm using > > Apache 2.0.49 for testing locally > and PHP 4.3.4 > on MS Windows XP Pro. > > the login script is in the file logme_in.php shown below > > // > > session_start(); > include("db.php"); > > $username = trim(addslashes($_POST['user_name'])); > $pass = trim(addslashes($_POST['password'])); > > if((empty($_POST['user_name'])) || (empty($_POST['password']))) { > >echo "enter username/password"; > } > > else{ >$sql = "SELECT * FROM members WHERE user_name='".$username."' AND > password='".$pass."'"; >$result = mysql_query($sql); >$num_return = mysql_num_rows($result); > >if($num_return ==1) >{ > $row = mysql_fetch_array($result); > session_register('uname'); > $_SESSION['uname'] = $username; > >} >else { >echo "invalid username/password"; >} > } > > ?> > // > > The problem is that every time I try to login I keep have the following > error messages > > > ** > Warning: session_start(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, > O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache > Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > > Warning: session_start(): Cannot send session cookie - headers already sent > by (output started at C:\Program Files\Apache > Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache > Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > > Warning: session_start(): Cannot send session cache limiter - headers > already sent (output started at C:\Program Files\Apache > Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache > Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > > Warning: Unknown(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, 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 > > *** > > the session.save_path parameter in my php.ini file is as follows > ** > session.save_path = "C:/WINDOWS/Temp" > ** > > I'm kinda new at php and web development environment .. so any help will be > appreciated. > > Thanks in advance > Dre, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !!Urgent .. Session Problem
thanks ..I won't use the session_register() again "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Dre" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > session_register('uname'); > > $_SESSION['uname'] = $username; > > Hi Dre, > > Nick already answered your question so just a short note: > you should not use session_register() with your PHP version anymore, so just > delete the first of the upper two lines. > > Excerpt from the manual: > > >>> > Caution > If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use > session_register(), session_is_registered(), and session_unregister(). > <<< > > Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !!Urgent .. Session Problem
"Dre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > session_register('uname'); > $_SESSION['uname'] = $username; Hi Dre, Nick already answered your question so just a short note: you should not use session_register() with your PHP version anymore, so just delete the first of the upper two lines. Excerpt from the manual: >>> Caution If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister(). <<< Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php