如题
贴一下代码
<?php require_once('../Connections/connect.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
?>
<?php
//验证用户输入是否和验证码一致
if(isset($HTTP_POST_VARS['authinput']))
{
if(strcmp($_SESSION['authnum'],md5($HTTP_POST_VARS['authinput']))==0)
{
//以上为验证添加-----------------------//session_unregister('authnum');
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}if (isset($_POST['u_name'])) {
$loginUsername=$_POST['u_name'];
$password=md5($_POST['u_pass']);
$MM_fldUserAuthorization = "l_quan";
$MM_redirectLoginSuccess = "logindex.php";
$MM_redirectLoginFailed = "login.php?info=用户名或密码错误!";
$MM_redirecttoReferrer = false;
mysql_select_db($database_connect, $connect);
$LoginRS__query=sprintf("SELECT u_id, u_name, u_pass, l_quan, d_id FROM u_user WHERE u_name='%s' AND u_pass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $connect) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'l_quan');
$loginD_id = mysql_result($LoginRS,0,'d_id');
$loginU_id = mysql_result($LoginRS,0,'u_id');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
$GLOBALS['MM_D_id'] = $loginD_id;
$GLOBALS['MM_U_id'] = $loginU_id; //register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
session_register("MM_D_id");
session_register("MM_U_id"); if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
//以下是验证添加---------------------------------
}
else {
$mmto = "login.php?info=验证码错误!";
header(sprintf("Location: %s ", $mmto ));
} } ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆页面</title>
<style type="text/css">
<!--
body,td,th {
font-size: 10pt;
}
body {
background-color: #FFFFFF;
background-image: url(images/login1bg.jpg);
}
.style1 {color: #FF0000}
.style2 {color: #000000; }
-->
</style>
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style></head><body>
<form ACTION="<?php echo $loginFormAction; ?>" method="POST" name="form1">
<div align="center">
<table border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
<tr>
<td><img src="images/login1_02.jpg" width="93" height="140" alt=""></td>
<td><img src="images/login1_03.jpg" width="357" height="140" alt=""></td>
<td><img src="images/login1_04.jpg" width="127" height="140" alt=""></td>
<td><img src="images/login1_05.jpg" width="53" height="140" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_08.jpg" width="93" height="148" alt=""></td>
<td><img src="images/login1_09.jpg" width="357" height="148" alt=""></td>
<td><img src="images/login1_10.jpg" width="127" height="148" alt=""></td>
<td><img src="images/login1_11.jpg" width="53" height="148" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_14.jpg" width="93" height="146" alt=""></td>
<td valign="top" background="images/login1_15.jpg"> <table width="236" border="0" align="right">
<tr>
<td width="142"><div align="right">登陆用户:</div></td>
<td width="84"><div align="left">
<input name="u_name" type="text" class="biaokuangX" id="u_name" size="12">
</div></td>
</tr>
<tr>
<td><div align="right">登陆密码:</div></td>
<td><div align="left">
<input name="u_pass" type="password" class="biaokuangX" id="u_pass" size="12">
</div></td>
</tr>
<tr>
<td height="26"><div align="right">
<?php
srand((double)microtime()*1000000); while(($authnum=rand()%10000)<1000);
?>
验证码:</div></td>
<td><div align="left">
<input name=authinput type=text class="biaokuangX" size="12" ">
</div> <div align="center"></div></td>
</tr>
<tr>
<td height="34"><div align="right"></div>
<div align="right">
</div>
<div align="center"><span class="style1"><?php echo $_GET['info']; ?></span> </div></td>
<td><div align="center"><img src=../authimg.php?authnum=<? echo $authnum; ?>></div></td>
</tr>
</table>
</td>
<td background="images/login1_16.jpg"><INPUT TYPE="image" onClick=submit()" SRC="images/login1_16.jpg" width="120" height="140" border="0" />
</td>
<td><img src="images/login1_17.jpg" width="53" height="146" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_20.jpg" width="93" height="73" alt=""></td>
<td><img src="images/login1_21.jpg" width="357" height="73" alt=""></td>
<td><img src="images/login1_22.jpg" width="127" height="73" alt=""></td>
<td><img src="images/login1_23.jpg" width="53" height="73" alt=""></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p class="style1"> </p>
</div> </form>
</body>
</html>
贴一下代码
<?php require_once('../Connections/connect.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
?>
<?php
//验证用户输入是否和验证码一致
if(isset($HTTP_POST_VARS['authinput']))
{
if(strcmp($_SESSION['authnum'],md5($HTTP_POST_VARS['authinput']))==0)
{
//以上为验证添加-----------------------//session_unregister('authnum');
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}if (isset($_POST['u_name'])) {
$loginUsername=$_POST['u_name'];
$password=md5($_POST['u_pass']);
$MM_fldUserAuthorization = "l_quan";
$MM_redirectLoginSuccess = "logindex.php";
$MM_redirectLoginFailed = "login.php?info=用户名或密码错误!";
$MM_redirecttoReferrer = false;
mysql_select_db($database_connect, $connect);
$LoginRS__query=sprintf("SELECT u_id, u_name, u_pass, l_quan, d_id FROM u_user WHERE u_name='%s' AND u_pass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $connect) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'l_quan');
$loginD_id = mysql_result($LoginRS,0,'d_id');
$loginU_id = mysql_result($LoginRS,0,'u_id');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
$GLOBALS['MM_D_id'] = $loginD_id;
$GLOBALS['MM_U_id'] = $loginU_id; //register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
session_register("MM_D_id");
session_register("MM_U_id"); if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
//以下是验证添加---------------------------------
}
else {
$mmto = "login.php?info=验证码错误!";
header(sprintf("Location: %s ", $mmto ));
} } ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆页面</title>
<style type="text/css">
<!--
body,td,th {
font-size: 10pt;
}
body {
background-color: #FFFFFF;
background-image: url(images/login1bg.jpg);
}
.style1 {color: #FF0000}
.style2 {color: #000000; }
-->
</style>
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style></head><body>
<form ACTION="<?php echo $loginFormAction; ?>" method="POST" name="form1">
<div align="center">
<table border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
<tr>
<td><img src="images/login1_02.jpg" width="93" height="140" alt=""></td>
<td><img src="images/login1_03.jpg" width="357" height="140" alt=""></td>
<td><img src="images/login1_04.jpg" width="127" height="140" alt=""></td>
<td><img src="images/login1_05.jpg" width="53" height="140" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_08.jpg" width="93" height="148" alt=""></td>
<td><img src="images/login1_09.jpg" width="357" height="148" alt=""></td>
<td><img src="images/login1_10.jpg" width="127" height="148" alt=""></td>
<td><img src="images/login1_11.jpg" width="53" height="148" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_14.jpg" width="93" height="146" alt=""></td>
<td valign="top" background="images/login1_15.jpg"> <table width="236" border="0" align="right">
<tr>
<td width="142"><div align="right">登陆用户:</div></td>
<td width="84"><div align="left">
<input name="u_name" type="text" class="biaokuangX" id="u_name" size="12">
</div></td>
</tr>
<tr>
<td><div align="right">登陆密码:</div></td>
<td><div align="left">
<input name="u_pass" type="password" class="biaokuangX" id="u_pass" size="12">
</div></td>
</tr>
<tr>
<td height="26"><div align="right">
<?php
srand((double)microtime()*1000000); while(($authnum=rand()%10000)<1000);
?>
验证码:</div></td>
<td><div align="left">
<input name=authinput type=text class="biaokuangX" size="12" ">
</div> <div align="center"></div></td>
</tr>
<tr>
<td height="34"><div align="right"></div>
<div align="right">
</div>
<div align="center"><span class="style1"><?php echo $_GET['info']; ?></span> </div></td>
<td><div align="center"><img src=../authimg.php?authnum=<? echo $authnum; ?>></div></td>
</tr>
</table>
</td>
<td background="images/login1_16.jpg"><INPUT TYPE="image" onClick=submit()" SRC="images/login1_16.jpg" width="120" height="140" border="0" />
</td>
<td><img src="images/login1_17.jpg" width="53" height="146" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_20.jpg" width="93" height="73" alt=""></td>
<td><img src="images/login1_21.jpg" width="357" height="73" alt=""></td>
<td><img src="images/login1_22.jpg" width="127" height="73" alt=""></td>
<td><img src="images/login1_23.jpg" width="53" height="73" alt=""></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p class="style1"> </p>
</div> </form>
</body>
</html>
<table border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
<tr>
<td><img src="images/login1_02.jpg" width="93" height="140" alt=""></td>
<td><img src="images/login1_03.jpg" width="357" height="140" alt=""></td>
<td><img src="images/login1_04.jpg" width="127" height="140" alt=""></td>
<td><img src="images/login1_05.jpg" width="53" height="140" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_08.jpg" width="93" height="148" alt=""></td>
<td><img src="images/login1_09.jpg" width="357" height="148" alt=""></td>
<td><img src="images/login1_10.jpg" width="127" height="148" alt=""></td>
<td><img src="images/login1_11.jpg" width="53" height="148" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_14.jpg" width="93" height="146" alt=""></td>
<td valign="top" background="images/login1_15.jpg"> <table width="236" border="0" align="right">
<tr>
<td width="142"><div align="right">登陆用户:</div></td>
<td width="84"><div align="left">
<input name="u_name" type="text" class="biaokuangX" id="u_name" size="12">
</div></td>
</tr>
<tr>
<td><div align="right">登陆密码:</div></td>
<td><div align="left">
<input name="u_pass" type="password" class="biaokuangX" id="u_pass" size="12">
</div></td>
</tr>
<tr>
<td height="26"><div align="right">
<?php
srand((double)microtime()*1000000); while(($authnum=rand()%10000)<1000);
?>
验证码:</div></td>
<td><div align="left">
<input name=authinput type=text class="biaokuangX" size="12" ">
</div> <div align="center"></div></td>
</tr>
<tr>
<td height="34"><div align="right"></div>
<div align="right">
</div>
<div align="center"><span class="style1"><?php echo $_GET['info']; ?></span> </div></td>
<td><div align="center"><img src=../authimg.php?authnum=<? echo $authnum; ?>></div></td>
</tr>
</table>
</td>
<td background="images/login1_16.jpg"><INPUT TYPE="image" onClick=submit()" SRC="images/login1_16.jpg" width="120" height="140" border="0" />
</td>
<td><img src="images/login1_17.jpg" width="53" height="146" alt=""></td>
</tr>
<tr>
<td><img src="images/login1_20.jpg" width="93" height="73" alt=""></td>
<td><img src="images/login1_21.jpg" width="357" height="73" alt=""></td>
<td><img src="images/login1_22.jpg" width="127" height="73" alt=""></td>
<td><img src="images/login1_23.jpg" width="53" height="73" alt=""></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p class="style1"> </p>
</div> </form>