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
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;]';
}
}
?>

Link to comment
Share on other sites

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');
?>

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.