Hello
I'm trying to create an authorisation function I have created a table im my database with access levels, and have wrote my PHP scripts as well as the html login form. Whenever I load the login form and fill it out it I always get this error message:
Parse error: parse error, unexpected T_STRING in d:\phpweb\admin_system\adminlogin.php on line 8
My php script and html code is show below:
Here's the PHP script:
<?php
if ($submit)
$session = mysql_connect("localhost", "Username", "Password");
mysql_select_db("xplosive") or die(mysql_error());
$sql = '
SELECT Auth
FROM Staff
WHERE $Username = $POST ['Username'];
AND $Password = $POST ['Password'];
';
$result = mysql_query($sql) or die
('hr />' .$sql.'<hr />'.mysql_error());
while ($row = mysql_fetch_array($result)) {
$auth = $row["auth"]; }
if (!mysql_num_rows($result)) {
echo "ACCESS DENIED: Invalid Login details";
}
if ($auth == "1") {
echo "You are logged in with a level 1 authorisation.<br/>
<a href='admin.php'>Click here to continue</a>";
}
?>
and here's my HTML code:
<head>
<title>Admin Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#999999">
<h1 align="center"><font color="#0000CC">XPLOSIVE MULTIMEDIA</font></h1>
<h2 align="center"><font color="#0000FF">ADMINISTRATIVE LOGIN PAGE</font></h2>
<p align="center"> </p>
<p> </p>
<p align="center"><font color="#0000FF"></font></p>
<form method="POST" action="adminlogin.php" ENCTYPE="multipart/form-data">
Username: <input type="text" name="username"><br/>
<br/>
Password: <input type="password" name="password">
<br/>
<br/>
<input type="submit" name="submit" value="LOGIN">
<input type ="reset" value ="Clear"/>
<br>
<br>
<br>
<br>
<p align="center"><font color="#FF0000"><strong>YOU ARE ABOUT TO LOGIN TO<br>
A PRIVATE DATABASE.<br>IF YOU ARE NOT AN AUTHORISED USER PLEASE</strong></font></p>
<p align="center"><strong><font color="#FF0000" size="+2">LEAVE NOW</font></strong></p>
</form>
</body>
<html>
Someone please help before I jump down a bridge
🙁