Forum Moderators: coopster

Message Too Old, No Replies

I can't find the error

Hidden PHP Error

         

brendan3eb

8:40 pm on May 22, 2004 (gmt 0)

10+ Year Member



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]

Timotheos

12:43 am on May 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What error message is being returned? or how is it not working?

brendan3eb

1:51 am on May 23, 2004 (gmt 0)

10+ Year Member



like i said, there is no error message. All that turns up is 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.
"; }?>

do you think it could be the html for the form that is causing this?

[edited by: jatar_k at 4:07 am (utc) on May 23, 2004]
[edit reason] generalized urls [/edit]

Elijah

2:13 am on May 23, 2004 (gmt 0)

10+ Year Member




<php?
...

Maybe it is being caused by this invalid php opening tag. It should be:
<?php

Elijah

brendan3eb

3:59 pm on May 23, 2004 (gmt 0)

10+ Year Member



thanks so much, now I actuall get a real error:
"Parse error: parse error in /homepages/16/d91037512/htdocs/wsc91037520/hu/housepasswords.php on line 50"
But i think i may be able to figure that out, but still if you know what that error is for, feel free to post it.

brendan3eb

10:44 pm on May 23, 2004 (gmt 0)

10+ Year Member



scratch out that last post, I may not be able to find it, I'm going to comb through to look for errors again... If someone finds the error please let me know

Timotheos

3:38 am on May 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Seems like you're missing a closing } most probable at the very end to close switch (@$_GET['do']).

brendan3eb

11:39 am on May 25, 2004 (gmt 0)

10+ Year Member



ok, thanks, that was another problem. I'm having a friend go over the script for me, thanks for all the help!