<?php
session_start();
if (isset($POST['userid']) && isset($POST['password']))
{
// if the user has tried to log in
$userid = $POST['userid'];
$password = $POST['password'];
$db_conn = mysqli('localhost', 'webauth', 'webauth', 'auth');
if (mysqli_connect_errno()) {
echo 'Connection to database failed:'.mysqli_connect_error();
exit();
}
$query = 'select * from authorized_users ' ."Where name='$userid' "
." and password=sha1('$password')";
$result = $db_conn->query($query);
if ($result->num_rows)
(
// if they are in the database register the user id
$SESSION['valid_user'] = $userid;
}
$db_conn->close();
}
?>
<html>
<body>
<h1>Home Page</h1>
<?
if (isset($SESSION['valid_user']))
{
echo' you are logged in as: '.$_SESSION['valid_user'].'<br/>';
echo '<a href="logout.php">Log out</a><br/>';
}
else
{
if (isset($userid))
{
// if they tried and failed to log in
echo 'Could not log you in.<br/>';
}
else
{
// they have not tried to log in yet or have logged out
echo 'You are not logged in.<br/>';
}
// provide a form to log in
echo '<form method="post" action="authmain.php">';
echo '<table>';
echo '<tr><td>UserId:</td>';
echo '<td><input type="text" name="userid"></td></tr>
echo '<tr><td>Password:<inpu type="text" name="password"></td></tr>';
echo '<tr><td colspan="2" align="center">';
echo '<input type="submit" value="Log in"></td></tr>';
echo '</table></form>';
}
?>
<br/>
<a href="members_only.php">Members section</a>
</body>
</html>
really simple error im missing something obvious it says
Parse error: syntax error, unexpected ';' in /var/www/authmain.php on line 24
thanks ive been at it and i think im script is fine