Hi. I am having a problem with PHP. I got these lines of code:


include('Include Stuff')



<h1>Admin Login.</h1>

<form action="(Action Script)" method="POST">

Admin Name: <input type="text" name="name" /><br />
Password: <input type="password" name="code" /><br />
<input type="submit" value="Login" />


And this: (the action script in the above example)


$user = "UserName";
$pass = "Password";

$usrinput = $_REQUEST['name'];
$psinput = $_REQUEST['code'];

if ($usrinput == $user && $psinput == $pass) {

header( 'Location: http://www.mysite.com/page.php' );

} else {

echo "Incorrect input.";


And this:


if (!session_is_registered("auth")) { // Line I'm having an error

// Send that invader back home. Nothing for that person to see here.
header( 'Location: http://www.mysite.com' );


I am having a problem with line 4 in the above code. Here's the error:

Parse error: syntax error, unexpected T_IF in (folder name here) on line 4

When I don't get this error, it redirects me back to the link I want even though the session "auth" is registered.

Thank you if you help me.

6 Years
Discussion Span
Last Post by sepp2k

You're getting the parse error because you forgot a semicolon on line 2. Whenever you get "Unexpected blabla" at the beginning of a line, there's a good chance that you forgot a semicolon on the line before.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.