Login Form Help

rs.top

New Member
Messages
52
Reaction score
0
Points
0
I am trying to ad a login for my site! Everything went fine except the log.php.... I keep getting

Code:
[B]Parse error[/B]:  syntax error, unexpected T_STRING in [B]/home/bigbucks/public_html/log.php[/B] on line 11

here is the log.php

Code:
include ("functions.php");
sqlcon();
$user = $_POST['user']; 
$pass = $_POST['pass'];
$result = mysql_query("SELECT * FROM users WHERE username='$user' and password='$pass'");
$count = mysql_num_rows($result);
if($count == "1")
(
    session_register("loggedin")
    header("location: check.php");         <<<Line 11
) else {
    echo "Could no log you in.";
}
?>
 

rs.top

New Member
Messages
52
Reaction score
0
Points
0
i had to take it out because it wouldn't work....id get that there is an unexpected ;
 

mephis

New Member
Messages
39
Reaction score
0
Points
0
well, after the if clause you're using ( instead of { and also closing with ) instead of }
replace that, fix line 10 and you should be OK:
PHP:
if($count == "1")
{
    session_register("loggedin");
    header("location: check.php");
} else {
    echo "Could no log you in.";
}
 
Last edited:

tpounds

New Member
Messages
36
Reaction score
0
Points
0
Instead of scrpiting it, I suggest using MyBB. Even though its made for forums, you can use the log in form if you follow this tutorial: here
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
Instead of scrpiting it, I suggest using MyBB. Even though its made for forums, you can use the log in form if you follow this tutorial: here

Why do this when this is so close? Mephis has correctly posted the correction needed.
 

phpasks

New Member
Messages
145
Reaction score
0
Points
0
I am trying to ad a login for my site! Everything went fine except the log.php.... I keep getting

Code:
[B]Parse error[/B]:  syntax error, unexpected T_STRING in [B]/home/bigbucks/public_html/log.php[/B] on line 11
here is the log.php

Code:
include ("functions.php");
sqlcon();
$user = $_POST['user']; 
$pass = $_POST['pass'];
$result = mysql_query("SELECT * FROM users WHERE username='$user' and password='$pass'");
$count = mysql_num_rows($result);
if($count == "1")
(
  /* [B]  session_register("loggedin")
    header("location: check.php");         <<<Line 11
*/
[/B][B]  session_register("loggedin");
     header("location: check.php");         <<<Line 11
exit;
[/B] ) else {
    echo "Could no log you in.";
}
?>

Now Your code work fine

You can redirect any page to another page at that time after redirect exit use.
 
Top