Im trying to create a PHP login page but I keep getting an error on the PHP code side. The code looks like this as it stands -
<?php
$username = $_POST['username'];
$password = $_POST['password'];
// location of page to go to if username and password match
$url = ("readbook.php");
$user_array = array("user0");
$pass_array = array("pass0");
$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>';
?>
However Im getting this error -
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in E:\html\readbook.php on line 18
any help with this would be fantastic, thanks!