ok this is the php code for a login script im trying to make (mysql information is replaced with *******):
<php?
$house = $_POST['house'] ;
$password = $_POST['password'] ;
$pass = "********" ;
$user = "*********" ;
$host = "*********" ;
$databse = "********" ;
session_start();
switch (@$_GET['do'])
{
case "login":
$connection = mysql_connect($host,$user,$pass)
or die ("Couldn't connect to server.");
$db = mysql_select_db($database, $connection)
or die ("Couldn't select database.");
$sql = "SELECT house, password FROM house
WHERE house='$house'";
$result = mysql_query($sql)
or die("Couldn't Execute The 1rst Query");
$num = mysql_num_rows($result);
if ($num == 1)
{
$sql = "SELECT house FROM house
WHERE house='$house'
AND password=password('$password')";
$result2 = mysql_query($sql)
or die("Could Not Execute 2nd Query");
$num2 = mysql_num_rows($result2);
if ($num2 > 0)
{
$_SESSION['auth']="yes";
$loghouse=$house;
$_SESSION['loghouse'] = $loghouse;
header("Location: [
example.com...]
}
else
{
unset($do);
$message="The House, '$house'
exists, but you have not entered the
correct password! Please try again.<br>";
}
}
elseif ($num == 0)
{
unset($do);
$message = "The Login Name you entered does not
exist! Please try again.<br>";
}
?>
when i use the html form i made for the script i get a page with this:
0) { $_SESSION['auth']="yes"; $loghouse=$house; $_SESSION['loghouse'] = $loghouse; header("Location: [
example.com...] } else { unset($do); $message="The House, '$house' exists, but you have not entered the correct password! Please try again.
"; } } elseif ($num == 0) { unset($do); $message = "The Login Name you entered does not exist! Please try again.
"; }?>
I've searched hard for the error but haven't found it, do any of you know what it is?
[edited by: jatar_k at 4:06 am (utc) on May 23, 2004]
[edit reason] generalized urls [/edit]