ok, im sure this is a little thing that im just overlooking, but i just cant find it..... i have the following program which i got from a tutorial that was linked on a thread about sessions.... its a very good tutorial....... basically it sets up accesscontrol.php file that is included in all restricted access pages, it checks to see if the user has logged in, and if they havent, it prompts them to log in, quite useful i think..... anyways, the code below is the accesscontrol.php code... when i include this file in anotehr file (say member_only.php) and i then go to this file, i get the following error:
Parse error: parse error, unexpected $end in c:\inetpub\wwwroot\accesscontrol.php on line 84
line 84 is the last line of code, i cant see whats wrong... any help would be appreciated, thx in advance
<?php
include("other.inc");
session_start();
$connection = mysql_connect($host,$user,$password) or die ("couldn’t connect to server");
$db = mysql_select_db($database,$connection) or die ("Couldn’t select database.");
if (isset($POST['uid']))
{
$uid = $POST['uid'];
}
else
{
$uid = $SESSION['uid'];
}
if (isset($POST['pwd']))
{
$pwd = $POST['pwd'];
}
else
{
$pwd = $SESSION['pwd'];
}
if(!isset($uid)) {
?>
<head>
<title> Please Log In for Access </title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1> Login Required </h1>
<p>You must log in to access this area of the site. If you are
not a registered user, <a href="signup.php">click here</a>
to sign up for instant access!</p>
<p><form method="post" action="<?=$_SERVER['PHP_SELF']?>">
User ID: <input type="text" name="uid" size="8" /><br />
Password: <input type="password" name="pwd" SIZE="8" /><br />
<input type="submit" value="Log in" />
</form></p>
</body>
</html>
<?php
exit;
}
$SESSION['uid'] = $uid;
$SESSION['pwd'] = $pwd;
$connection = mysql_connect($host,$user,$password) or die ("couldn’t connect to server");
$db = mysql_select_db($database,$connection) or die ("Couldn’t select database.");
$sql = "SELECT * FROM user WHERE loginName = '$uid' AND password = PASSWORD('$pwd')";
$result = mysql_query($sql);
if (!$result) {
echo "A database error occurred while checking your login details.<br>";
if (mysql_num_rows($result) == 0)
{
unset($SESSION['uid']);
unset($SESSION['pwd']);
?>
<head>
<title> Access Denied </title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1> Access Denied </h1>
<p>Your user ID or password is incorrect, or you are not a
registered user on this site. To try logging in again, click
<a href="<?=$_SERVER['PHP_SELF']?>">here</a>. To register for instant
access, click <a href="signup.php">here</a>.</p>
</body>
</html>
<?php
exit;
}
?>