Jump to content

[SOLVED] Cannot send session cache limiter??


rallokkcaz

Recommended Posts

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/pokebash/public_html/getmetola/default.html:6) in /home/pokebash/public_html/getmetola/index.php on line 4

 

this is the error i get on this page http://www.getmetola.com

when i try to include the login form

does anyone know exactly what that means

Link to comment
https://forums.phpfreaks.com/topic/48373-solved-cannot-send-session-cache-limiter/
Share on other sites

ok i fixed one problem!

now onto the next one

you can go to the link now

http://www.getmetola.com/

and u see the error

 

and

 

here is the code for userlogin.php

 

<?php
//start the session so you would stay logged in
//always must be on top
session_start();
//include config.php file
include('config.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<?php
$p=$_GET['p'];
//see my ?id= browsing tutorial
switch($p){
default:
//if user isn't logged in lets show him the log in form
if(!isset($_SESSION['username'])){
?>
<form action='login.php' method='POST'>
Username: <input type='text' name='username'><br>
Password: <input type='password' name='password'><br>
<input name="login" type="submit" value="Submit"><br>
Not <a href="register.php">registered</a>?
</form>
<?}
else{
//$_SESSION['username'] = the current users 
//username. It will be echoed like "Hi, user!"
echo "<br><br>Hi, ".$_SESSION['username']."!";
echo "<a href='logout.php'>Log out</a>";}
break;
case 'page':
//you can use it like this or use include()
if(!isset($_SESSION['username'])){
echo '<br><br>Log in to see this page!';}else{
echo '<br><br>Only user who is logged in can see this!..and you see this so this means you are logged in;]';
}
}
?>

the config.php is very simple

 

<?php

    $dbhost   = 'localhost';
    $dbname   = 'pokebash_users';
    $dbusername   = 'username';
    $dbuserpass = 'password';    
    
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
?>

Okay, I think i see the problem here

 

Are you including the userlogin.php page into your index.php page?

 

If so, you need to move that session_start() to the top of your index page, or if you have a header page, to the top of that.

 

 

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.