Deviants Posted November 21, 2008 Share Posted November 21, 2008 I've got a question... how come everytime I try to start a session, I get this error? Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\mygame\login_success.php:2) in C:\xampp\htdocs\mygame\login_success.php on line 3 Login Successful It displays the login succesful, it shows this annoying error above it... Heres my source for login_success.php <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> <html> <body> Login Successful </body> </html> Link to comment https://forums.phpfreaks.com/topic/133601-session-start-error/ Share on other sites More sharing options...
kenrbnsn Posted November 21, 2008 Share Posted November 21, 2008 First, make sure you save your script as plain ASCII, not UTF-8. Next, session_is_registered should not be used anymore, always use if(isset(...)) Also, you should use "<?php" instead of "<?" <?php session_start(); if (isset($_SESSION['myusername'])) header('location: main_login.php'); ?> Ken Link to comment https://forums.phpfreaks.com/topic/133601-session-start-error/#findComment-695014 Share on other sites More sharing options...
Deviants Posted November 21, 2008 Author Share Posted November 21, 2008 Sorry, I got this log in script from a rather old thread I guess... thanks for the help Link to comment https://forums.phpfreaks.com/topic/133601-session-start-error/#findComment-695018 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.