Jump to content

login script problem


illuz1on

Recommended Posts

Hey,

 

Getting this error from my login.php, anyone know why it might be happening?

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/remember/public_html/admin/login.php:1) in /home/remember/public_html/admin/login.php on line 2

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/remember/public_html/admin/login.php:1) in /home/remember/public_html/admin/login.php on line 2

Welcome to the remember online administration section..Please login...

 

Then displays the fields...

 

Thanks alot,

 

Chris

 

<?php
session_start();

include "db.php";

if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
  {
  die("You need to provide a username and password to access this page. This is a restricted area. Information Logged.");
  }


$q = "SELECT * FROM `remusers` "
  ."WHERE `username`='".$_POST["username"]."' "
  ."AND `password`='".$_POST["password"]."' "
  ."LIMIT 1";

$r = mysql_query($q);

if ( $obj = @mysql_fetch_object($r) )
  {

  $_SESSION["valid_id"] = $obj->id;
  $_SESSION["valid_user"] = $_POST["username"];
  $_SESSION["valid_time"] = time();


  
  $username = $_POST["username"];
  setcookie("admin",1);
  Header("Location: admin.php");
  }
else
  {
  die("Sorry, could not log you in. Wrong login information.");
  }
}
else
{
echo "Welcome to the remember online administration section..";
echo "Please login...";
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" value=\"Login\">";
echo "</form>";
}
?>

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.