【php开源代码栏目提醒】:网学会员php开源代码为您提供voteAdminLogin.php参考,解决您在voteAdminLogin.php学习中工作中的难题,参考学习。
<?php require_once('Connections/connVoteSystem.php'); ?>
<?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$FF_LoginAction = $_SERVER['
PHP_SELF'];
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']!="")
$FF_LoginAction .= "?".$_SERVER['QUERY_STRING'];
if (isset($_POST['username'])) {
$FF_valUsername=$_POST['username'];
$FF_valPassword=$_POST['passwd'];
$FF_fldUserAuthorization="";
$FF_redirectLoginSuccess="voteAdmin.php";
$FF_redirectLoginFailed="voteMain.php";
$FF_rsUser_Source="SELECT username, passwd ";
if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
$FF_rsUser_Source .= " FROM admin WHERE username='" . $FF_valUsername . "' AND passwd='" . $FF_valPassword . "'";
mysql_select_db($database_connVoteSystem, $connVoteSystem);
$FF_rsUser=mysql_query($FF_rsUser_Source, $connVoteSystem) or die(mysql_error());
$row_FF_rsUser =
mysql_fetch_assoc($FF_rsUser);
if(my
sql_num_rows($FF_rsUser) > 0) {
// username and pass
word match - this is a valid user
$MM_Username=$FF_valUsername;
session_register("MM_Username");
if ($FF_fldUserAuthorization != "") {
$MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
} else {
$MM_UserAuthorization="";
}
session_register("MM_UserAuthorization");
if (isset($accessdenied) && false) {
$FF_redirectLoginSuccess = $accessdenied;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = false;
header ("Location: $FF_redirectLoginSuccess");
exit;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = true;
header ("Location: $FF_redirectLoginFailed");
exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>选举管理者
登陆界面</title>
<style type="text/css">
<!--
.bluebox {
border: 1px solid #000099;
}
-->
</style>
</head>
<body>
<table width="100%" height="25%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <form action="<?php echo $FF_LoginAction?>" name="form1" method="POST">
<p> </p>
<table width="300" border="0" align="center" cellpadding="4" cellspacing="2" class="bluebox">
<tr>
<td width="60"><div align="right"><font size="2">账号</font></div></td>
<td><font size="2">
<input name="username" type="text" id="username">
</font></td>
</tr>
<tr>
<td width="60"><div align="right"><font size="2">密码</font></div></td>
<td><font size="2">
<input name="passwd" type="password" id="passwd">
</font></td>
</tr>
<tr>
<td colspan="2"><div align="center"><font size="2"></font> <font size="2">
<input type="submit" name="Submit" value="登录管理界面">
<input type="button" name="Submit2" value="退出登录画面" onClick="window.location.href='voteMain.php';">
</font></div></td>
</tr>
</table>
<p> </p>
</form></td>
</tr>
</table>
</body>
</html>