140 lines
4.7 KiB
PHP
140 lines
4.7 KiB
PHP
<?php require_once('Connections/jc.php'); ?><?php
|
||
// *** Validate request to login to this site.
|
||
if (!isset($_SESSION)) {
|
||
session_start();
|
||
}
|
||
|
||
$loginFormAction = $_SERVER['PHP_SELF'];
|
||
if (isset($_GET['accesscheck'])) {
|
||
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
|
||
}
|
||
|
||
if (isset($_POST['username'])) {
|
||
$loginUsername=$_POST['username'];
|
||
$password=$_POST['password'];
|
||
$MM_fldUserAuthorization = "";
|
||
$MM_redirectLoginSuccess = "laoshi.php";
|
||
$MM_redirectLoginFailed = "lindex.php";
|
||
$MM_redirecttoReferrer = false;
|
||
mysql_select_db($database_jc, $jc);
|
||
|
||
$LoginRS__query=sprintf("SELECT user_name, password FROM laoshi WHERE user_name='%s' AND password='%s'",
|
||
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
|
||
|
||
$LoginRS = mysql_query($LoginRS__query, $jc) or die(mysql_error());
|
||
$loginFoundUser = mysql_num_rows($LoginRS);
|
||
if ($loginFoundUser) {
|
||
$loginStrGroup = "";
|
||
|
||
//declare two session variables and assign them
|
||
$_SESSION['MM_Username'] = $loginUsername;
|
||
$_SESSION['MM_UserGroup'] = $loginStrGroup;
|
||
|
||
if (isset($_SESSION['PrevUrl']) && false) {
|
||
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
|
||
}
|
||
header("Location: " . $MM_redirectLoginSuccess );
|
||
}
|
||
else {
|
||
header("Location: ". $MM_redirectLoginFailed );
|
||
}
|
||
}
|
||
?>
|
||
<html>
|
||
|
||
<head>
|
||
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
||
<meta name="ProgId" content="FrontPage.Editor.Document">
|
||
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
|
||
<link href="css/style.css" rel="stylesheet">
|
||
<title>PHP教材管理系统</title>
|
||
<script language="JavaScript">
|
||
<!--
|
||
<!--
|
||
|
||
function Juge(theForm)
|
||
{
|
||
if (theForm.username.value == "")
|
||
{
|
||
alert("请输入您的注册名!");
|
||
theForm.username.focus();
|
||
return (false);
|
||
}
|
||
if (theForm.password.value == "")
|
||
{
|
||
alert("请输入您的密码!");
|
||
theForm.password.focus();
|
||
return (false);
|
||
}
|
||
}
|
||
|
||
function MM_jumpMenu(targ,selObj,restore){ //v3.0
|
||
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
|
||
if (restore) selObj.selectedIndex=0;
|
||
}
|
||
//-->
|
||
</script>
|
||
</head>
|
||
|
||
<body bgcolor=#21415a>
|
||
|
||
<p> </p>
|
||
<p> </p>
|
||
<p align="center">
|
||
<img border="0" src="img/index.jpg" width="568" height="252"></p>
|
||
<form action="<?php echo $loginFormAction; ?>" name="theform" method="POST" onSubmit="return Juge(this)">
|
||
<div align="center">
|
||
<center>
|
||
<table border="0" width="568" bgcolor=#21415a style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
|
||
<tr>
|
||
<td width="100%" style="font-size: 12px">
|
||
<p style="margin-top: 0; margin-bottom: 0" align="center">
|
||
<font color="#FFFFFF">身份登陆:</font>
|
||
<select name="select" id="select" onChange="MM_jumpMenu('parent',this,0)">
|
||
<option value="index.php">学生</option>
|
||
<option value="lindex.php" selected>老师</option>
|
||
<option value="xindex.php">系级人员</option>
|
||
<option value="gindex.php">管理员</option>
|
||
</select>
|
||
</p>
|
||
|
||
<p style="margin-top: 0; margin-bottom: 0" align="center">
|
||
</p>
|
||
|
||
<table border="0" width="333" bgcolor=#21415a align=center height="72">
|
||
<tr>
|
||
<TD width="125" style="font-size: 12px" height="17">
|
||
<font color="#FFFFFF">用 户 名:</font> </TD>
|
||
<TD width="194" style="font-size: 12px" height="17">
|
||
<input type="text" name="username" size="17" class="text" onBlur="this.className='text'" onFocus="this.className='textedit';this.select()">
|
||
</TD>
|
||
</tr>
|
||
<tr>
|
||
<TD width="125" style="font-size: 12px" height="13">
|
||
<font color="#FFFFFF">密 码: </font> </TD>
|
||
<TD width="194" style="font-size: 12px" height="13">
|
||
<INPUT type=password maxLength=20 name=password size="17" class="text" onBlur="this.className='text'" onFocus="this.className='textedit';this.select()">
|
||
</TD>
|
||
</tr>
|
||
<tr>
|
||
<TD align=middle
|
||
colSpan=2 width="325" style="font-size: 12px" height="30">
|
||
<p align="center" style="margin-top: 0; margin-bottom: 0">
|
||
</p>
|
||
<p align="center" style="margin-top: 0; margin-bottom: 0">
|
||
<INPUT type=submit value=" 登 录 " name=login class="buttonface">
|
||
<INPUT type=reset value=" 清 除 " name=qingchu class="buttonface">
|
||
</p>
|
||
</TD>
|
||
</tr>
|
||
</table>
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</center>
|
||
</div>
|
||
</form>
|
||
</body>
|
||
|
||
</html>
|