error when using login script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pugs
Forum Newbie
Posts: 5
Joined: Tue Jun 24, 2008 5:28 pm

error when using login script

Post by pugs »

Hi all,

I'm getting this error in my browser when using a login script. I'm checking a username and password against a database and if successful, registering a session.

Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/val2435/public_html/newsite/checklogin.php:9) in /home/val2435/public_html/newsite/checklogin.php on line 38

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/val2435/public_html/newsite/checklogin.php:9) in /home/val2435/public_html/newsite/checklogin.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /home/val2435/public_html/newsite/checklogin.php:9) in /home/val2435/public_html/newsite/checklogin.php on line 40

Can anyone help?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: error when using login script

Post by Christopher »

You have already sent some output before line 38. It could be obvious HTML output or a space or return before a <?php or after a ?>
(#10850)
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: error when using login script

Post by Eran »

you need to use session_start() and cookie functions before any output is sent to the browser
azhan
Forum Commoner
Posts: 68
Joined: Fri Jun 27, 2008 6:05 am

try this one

Post by azhan »

i've use this login script..so far...it works!....it has the database script,registering script,login script and logout script.

----->>>> http://php.about.com/od/finishedphp1/ss ... code_4.htm


regards,

Azhan
________________________________________
http://www.productcoverdesign.com - Cheapest E-Cover u'll ever get!
Post Reply