i have changed my login .php file to the following
this file is opened directly and is not called from any other file
[PHP]<?php
// dBase file
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // 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");
session_start();
if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}
// Create query
$q = "SELECT * FROM `dbUsers` "
."WHERE `username`='".$_POST["username"]."' "
."AND `password`=PASSWORD('".$_POST["password"]."') "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["valid_id"] = $obj->id;
$_SESSION["valid_user"] = $_POST["username"];
$_SESSION["valid_time"] = time();
// Redirect to member page
Header("Location: members.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.");
}
}
else
{
//If all went right the Web form appears and users can log in
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>";
}
?>[/PHP]
this is the screen i am getting when i acces the page
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\virtualservers\182763\root\test\login\lo\login. php:1) in D:\virtualservers\182763\root\test\login\lo\login. php on line 12
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\virtualservers\182763\root\test\login\lo\login. php:1) in D:\virtualservers\182763\root\test\login\lo\login. php on line 12
i would like some help please in locateing the sourtce of the errors
i know the errors are from the <?php in line one but therfe are NO spaces after this line only a return
i get the error when i enter a correct or a false user name
i know the database info i put in is correct as i can add data to the table fine
thanks