Jump to content

Recommended Posts

Hello,

 

I am trying to set up a loging script but I keep on getting this error:

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3
Password does not match 

 

 

The code I wrote is here:

 

<?php
session_start();<BR>
?>
----MY HTML CODE HERE----------------
<?php
$user_id = $_POST['user_id'];
$password = $_POST['password'];

$myDatabase = "kuuja_business";


$con = mysql_connect("localhost:3306","kuuja_admin","admin1");

if (!$con)

  {

  die('Could not connect to Database: ' . mysql_error());

  }



@mysql_select_db($myDatabase, $con) or die("Unable to select database");

$result_user = mysql_query("SELECT user_id FROM user WHERE user_id = '$user_id'");
$row1 = mysql_fetch_array($result_user);
$user = $row1['user_id'];


$result_password = mysql_query("SELECT password FROM user WHERE password = '$password'");
$row2 = mysql_fetch_array($result_password);
$pass = $row2['password'];

$result_fname = mysql_query("SELECT fname FROM user WHERE user_id = '$user_id'");
$row3 = mysql_fetch_array($result_fname);
$name = $row3['fname'];

if ($user)
{
if ($pass)
{

	echo "Hello $name\n\n";

	echo "Welcome to the members area, you can use the options on your left to navigate through the pages\n\n";

	echo "Do also remember to include yourself in our rotation software by the option available under the Settings link on the left";

}
else
{

	echo "Password does not match";
    session_destroy();
}
}
else
{
echo "User Id does not match";
  session_destroy();


}

mysql_close($con);

?>

 

Can you please help?

Link to comment
https://forums.phpfreaks.com/topic/87975-problems-with-setting-up-sessions/
Share on other sites

No it doesn't work I opened the file in notepad and removed all the lines, spaces etc. before session_start(), still it didn't help. Still I get the error..

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/kuuja/public_html/test/verify.php:2) in /home/kuuja/public_html/test/verify.php on line 3

 

Is there any other way to handle a login script other than this way??

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.