Jump to content

Session Start error?


Deviants

Recommended Posts

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

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

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.