Code!
LOGIN.PHP
<html>
<head><title>Admin Login</title></head>
<body>
<body text="blue" BGCOLOR="FFFFCC">
<center><img src="http://www.webcom.com/graphics/formt.gif"
width=150 height=100</center>
<center>
<font size="3"><p align=center>
<h1>Admin Login</h1>
</center>
<p>
<form action="adminlogin.php" method="post">
Enter user name: <input type="text" name="username"><p>
Enter password: <input type="password" name="password"><p>
<input type='submit' value='submit'>
</form>
</body>
</html>
ADMINLOGIN
<html>
<head><title>Admin Login</title></head>
<body>
<h1><center>Admin Login</center></h1>
<body text="blue" BGCOLOR="FFFFCC">
<center>
Code: Select all
<?php
$user="";
$host="";
$password="";
$database="";
$connection = mysql_connect($host,$user,$password)
or die ("connection to server failed.");
$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");
$password= $HTTP_POST_VARS['password'];
$username=$HTTP_POST_VARS['username'];
$query ="SELECT password FROM users WHERE username= '$username'";
$result = mysql_query($query)
or die("couldn't excute query.");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
if ($username == $row['password'])
{
/* this only outputs the password as it is the only thing called in the query*/
echo "<h1>$username:</h1>";
echo "<h1>valid password!</h1>";
$query1 = "SELECT * FROM users WHERE username= '$username'";
$result1 = mysql_query($query1)
or die("couldn't excute query.");
while ($row1 = mysql_fetch_array($result1))
{
extract($row1);
echo " <table border = 2 width=70%>";
}
echo "</table>";
}
else
{
echo "<h1>invalid User name or password</h1>";
echo "<h2>Please retype!!<h2>";
}
?></center>
<p>
<center><img src="http://www.webcom.com/graphics/formt.gif"
width=150 height=100</center>
<br>
<align="center"><font size="3"><a href="http://~u2ell/flightsinput.php"><FONT COLOR="red">Enter Flight Details</a></font>
<br>
<align="center"><font size="3"><a href="http://~u2ell/flightpricesinput.php"><FONT COLOR="red">Enter Flight Prices</a></font>
</body>
</html>
Thanks.