sicknote
04-09-2005, 11:16 AM
i have a login page that the code for it is like this
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Please login</title>
</head>
<body>
<form action="index.php" method="post">
<table border="1" width="100%" id="table1">
<tr>
<td>
<p align="center"><font face="BalloonEFExtraBold">Username:</font></td>
</tr>
<tr>
<td>
<p align="center">
<input type="text" name="username" size="27" tabindex="1" style="font-family: BalloonEFExtraBold" /></td>
</tr>
<tr>
<td>
<p align="center"><font face="BalloonEFExtraBold">Password:</font></td>
</tr>
<tr>
<td>
<p align="center">
<input type="password" name="password" size="23" tabindex="1" style="font-family: MS Reference Sans Serif" /></td>
</tr>
<tr>
<td>
<p align="center">
<input type="submit" value="Login" name="submit" style="font-family: BalloonEFExtraBold; color: #FFFFFF; background-color: #000000" /></td>
</tr>
</table>
</form>
</body>
</html>
and then the page that it submits to, the code looks like this
<?php
if (isset($_POST['submit'))
{
$username=$_POST['username'];
$password=$_POST['password'];
$password=md5($password);
$query = "select";
$result = mysql_query($query) or die(mysql_error());
$result2= mysql_fetch_array($result);
if($result2)
{
session_start();
$_SESSION['admin']=$username;
print "Logged in succesfully, please go to <a href='adminpanel.php'>Admin Panel</a>";
}
else
{
print "Wrong Username or Password";
}
}
?>
would this work
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Please login</title>
</head>
<body>
<form action="index.php" method="post">
<table border="1" width="100%" id="table1">
<tr>
<td>
<p align="center"><font face="BalloonEFExtraBold">Username:</font></td>
</tr>
<tr>
<td>
<p align="center">
<input type="text" name="username" size="27" tabindex="1" style="font-family: BalloonEFExtraBold" /></td>
</tr>
<tr>
<td>
<p align="center"><font face="BalloonEFExtraBold">Password:</font></td>
</tr>
<tr>
<td>
<p align="center">
<input type="password" name="password" size="23" tabindex="1" style="font-family: MS Reference Sans Serif" /></td>
</tr>
<tr>
<td>
<p align="center">
<input type="submit" value="Login" name="submit" style="font-family: BalloonEFExtraBold; color: #FFFFFF; background-color: #000000" /></td>
</tr>
</table>
</form>
</body>
</html>
and then the page that it submits to, the code looks like this
<?php
if (isset($_POST['submit'))
{
$username=$_POST['username'];
$password=$_POST['password'];
$password=md5($password);
$query = "select";
$result = mysql_query($query) or die(mysql_error());
$result2= mysql_fetch_array($result);
if($result2)
{
session_start();
$_SESSION['admin']=$username;
print "Logged in succesfully, please go to <a href='adminpanel.php'>Admin Panel</a>";
}
else
{
print "Wrong Username or Password";
}
}
?>
would this work