日期:2014-05-17 浏览次数:20407 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Welcome back</title>
<style type="text/css">
.auto-style2 {
text-align: center;
}
.auto-style1 {
font-size: 36pt;
text-align: left;
}
.auto-style4 {
font-family: Broadway;
font-size: xx-large;
}
</style>
</head>
<body>
<table align="center" style="width: 100%">
<tr>
<td>
<div class="auto-style2">
<table align="center" style="width: 100%">
<tr>
<td class="auto-style1">Welcome back</td>
<td>
<img height="89" src="logo.jpg" style="float: right" width="184" /></td>
</tr>
</table>
</div>
<hr />
<p class="auto-style4">Log in:</p>
<form action="login.php" method="post" style="height: 213px">
<div class="auto-style2">
<table style="width: 100%">
<tr>
<td class="auto-style2">User Name:</td>
</tr>
<tr>
<td class="auto-style2">
<input name="user_name" type="text" value="
<?php
if(isset($_POST['user_name']))
{
print htmlspecialchars($_POST['user_name']);
}
?>
"/>
</td>
</tr>
<tr>
<td class="auto-style2">Password:</td>
</tr>
<tr>
<td class="auto-style2">
<input name="password" type="password" /></td>
</tr>
</table>
<br />
<br />
<input name="submit" type="submit" value="Sign in" /></div>
</form>
</td>
</tr>
</table>
<?php
require_once 'connectDB.php';
print '<style type = "text/css" media = "screen">.error {color: red;}</style>';
if($_SERVER['REQUEST_METHOD']=='POST')
{
$problem = false;
$login = false;
if(empty($_POST['user_name']))
{
$problem = true;
print '<p class = "error">Please enter your user name!</p>';
}
if(empty($_POST['password']))
{
$problem = true;
print '<p class = "error">Please enter a password</p>';
}
if(!$problem)
{
$user = trim(stripslashes($_POST['user_name']));
$pwd = trim(stripslashes($_POST['password']));
$user = mysql_real_escape_string($user);
$pwd = mysql_real_escape_string($p