Jump to content

What do these messages mean?


hank__22

Recommended Posts

Hi I'm getting these error mesages for my login:

 

 

Warning: session_register(): Cannot send session cookie - headers already sent by (output started at /home/mike401c/public_html/access/test/checklogin.php:10) in /home/mike401c/public_html/access/test/checklogin.php on line 34

 

Warning: session_register(): Cannot send session cache limiter - headers already sent (output started at /home/mike401c/public_html/access/test/checklogin.php:10) in /home/mike401c/public_html/access/test/checklogin.php on line 34

 

Warning: Cannot modify header information - headers already sent by (output started at /home/mike401c/public_html/access/test/checklogin.php:10) in /home/mike401c/public_html/access/test/checklogin.php on line 36

 

I'm not sure what they mean! can someone tell me whats going wrong?

Link to comment
Share on other sites

it means you have already output some html or white space and then you are trying to send a header.

 

You can either move all headers to before the html begins being output or put ob_start(); at the beginning of your script and ob_end_flush(); at the end.

Link to comment
Share on other sites

I've tried:

 

<?php

ob_start();

$host="localhost"; // Host name

$username="xxx"; // Mysql username

$password="xxx"; // Mysql password

$db_name="xxx"; // Database name

$tbl_name="members"; // Table name

 

// Connect to server and select databse.

mysql_connect("$host", "$username", "$password")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");

 

// Define $myusername and $mypassword

$myusername=$_POST['myusername'];

$mypassword=$_POST['mypassword'];

 

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";

$result=mysql_query($sql);

 

// Mysql_num_row is counting table row

$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row

 

if($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"

session_register("myusername");

session_register("mypassword");

header("location:login_success.php");

}

else {

echo "Wrong Username or Password";

}

 

ob_end_flush();

?>

 

 

 

<html>

<head>

 

But its still giving me errors! I got the code from http://www.phpeasystep.com/phptu/6.html

Can anyone recommend a better place where I can get a login php script?

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.