Forum Moderators: coopster
Here is the form:
<form action="verify.php" method="post">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value=" Login ">
</form>
Here is what I have in verify.php:
<?php
$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];
// location of page to go to if username and password match
$url = "protected.php";
$user_array = array("protected");
$pass_array = array("files");
$user_length = count( $user_array );
for ( $i = 0; $i < $user_length; $i++ )
{
if ( $username == $user_array[$i] && $password == $pass_array[$i] )
{
session_start();
session_register("user");
session_register("loggedIn");
$_SESSION['user'] = $username;
$_SESSION['loggedIn'] = "true";
header("Location: $url");
}
}
// nothing became valid while we looped so verification failed
echo '<b>Verification Failed!</b>';
?>
I get the unexpected T_Variable error on line 3 of the verify.php script.
This is on a IIS server with PHP 4.2.x installed. I have no control over any settings. And yes Global_Variables are off and it is not an option to turn them on.
Thanks again for any help you can give.
Jamie
Yes line 3 is the password line.
That is basically all of the information I can provide.
<snipped url>
The script runs fine on my server as well but I'm running Apache and PHP from a Linux box so I'm thinking it has something to do with the IIS and PHP installation from the Windows box that I need to use the script on. I was hoping there was some standard problem with this setup that has a workaround.
[edited by: coopster at 11:13 pm (utc) on Nov. 30, 2004]
[edit reason] removed url per TOS [webmasterworld.com] [/edit]
There really isn't a login script, just the form which as you can see is pretty basic. It calls the verify.php script which is then supposed to take the submitted contents of the username and password fields and see if they match the username and password specified in the verify.php script.
protected.php is just a simple html page at the moment that displays "This Page Is Protected"
Jamie
Yes. It is indicated in the error which I apparently shouldn't post since it contains a web address in it. :) Sorry about that.
Actually, the link was to your phpinfo() page which only gives the PHP configuration. But that doesn't matter, apology accepted ;)
I can't see anything here that should be causing any parse error either. Is this the entire script?