Forum Moderators: coopster

Message Too Old, No Replies

Parse error: parse error, unexpected T_STRING

..I just can't see it ...

         

Conscientious Reject

7:06 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



Hello everyone,
I really thought I was getting this stuff, but then I have weeks like this. Anyway, I really need help. It's finals week, and I can't get this to work.
Any help is very graciously appreciated.

Parse error: parse error, unexpected T_STRING in blah/blah on line 18

Anyway, I think that this error is somewhere in this switch statement. I have commented line 18.

switch (@$_POST['Button'])
{
case "Login":
$cxn = Connect_to_db("blah.inc");
$sql = "SELECT user_name FROM $table_name
WHERE user_name='$_POST[blahname]'";
$result = mysqli_query($cxn, $sql)
or die("Couldnt execute query 1.");
$num = "mysqli_num_rows($result);
if ($num == 1)
{
<!-- the next line is #18 //-->
$sql = "SELECT user_name FROM $table_name
WHERE user_name='$_POST[blah]'
AND password=md5('$_POST[password]')";
$result2 = mysqli_query($cxn, $sql)
or die("Couldnt execute query 2.");
$row = mysql_fetch_assoc($result2);
if ($row)
{
$_SESSION['blah']="yes";
$_SESSION['logname'] = $_POST['blahname'];
header("Location: $next_program");
}
else
{
$message_1="The Login Name, '$_POST['blahname']'
excist, but you have not entered the correct password!
Please try again.<br />";
extract ($_POST);
include("fields_login.inc");
include("registerForm.inc");
}

}
elseif ($num == 0)
{
$message_1="The User Name you entered does not excist! Please try again.<br />";
include("blah.inc");
include("blah.inc");
}
break;

Robber

7:13 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



You almost had it!

Give this a go:

$sql = "SELECT user_name FROM $table_name
WHERE user_name='{$_POST['blah']}'
AND password=md5('{$_POST['password']}')";

[edited by: Robber at 7:18 pm (utc) on Mar. 16, 2006]

Conscientious Reject

7:17 pm on Mar 16, 2006 (gmt 0)

10+ Year Member



Opps, I found the error. I had some quotes on line 15 that didn't need to bne there.

le_gber

12:11 pm on Mar 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CR,

just a quick one:

excist = exist or exists.

also I am not sure if it's a good idea to tell the people that the login exists but the password is wrong. It would give someone trying to hack into you app a foothold.