<?php require_once('../Connections/poy.php'); ?>
<?php
mysql_select_db($database_poy, $poy);
$query_login = "SELECT ID, userid, pwd FROM userlogin ORDER BY ID DESC";
$login = mysql_query($query_login, $poy) or die(mysql_error());
$row_login = mysql_fetch_assoc($login);
$totalRows_login = mysql_num_rows($login);
?>
<?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['userid'])) {
$loginUsername=$_POST['userid'];
$password=$_POST['pwd'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_poy, $poy);
$LoginRS__query=sprintf("SELECT userid, pwd FROM userlogin WHERE userid='%s' AND pwd='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $poy) 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 );
}
}
?>
<!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 http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户登录</title>
<style type="text/css">
<!--
.style1 {font-size: 24px}
.style2 {color: #0066CC}
.style3 {font-weight: bold}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head><body>
<form name="form1" id="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<p align="center" class="style2 style1" ><strong> 管 理 系 统</strong></p>
<p align="center"> </p>
<p align="center"><span class="style3">登 录:</span>
<input name="userid" type="text" id="userid" style="BORDER-RIGHT: #FFFFFF 1px solid; BORDER-TOP: #FFFFFF 1px solid; FONT-SIZE: 10pt; BACKGROUND: #ffffff; BORDER-LEFT: #FFFFFF 1px solid; WIDTH: 120px; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 18px; color:#FF6600" size="15" maxlength="15" />
</p>
<p align="center" ><span class="style3">密 码:</span>
<input name="pwd" type="password" id="pwd" style="BORDER-RIGHT: #FFFFFF 1px solid; BORDER-TOP: #FFFFFF 1px solid; FONT-SIZE: 9pt; BACKGROUND: #ffffff; BORDER-LEFT: #FFFFFF 1px solid; WIDTH: 120px; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 18px; color:#FF6600" size="15" maxlength="15" />
</p>
<p align="center">
<input name="Submit1" type="submit" class="style5" value="提交" />
<input name="Submit2" type="button" class="style5" onclick="MM_openBrWindow('useradd.php','','')" value="注册" />
</p>
<p align="center"> </p>
</form> <tr>
<td height="17"> </td>
</tr>
</body>
</html>
<?php
mysql_free_result($login);
?>
<?php
mysql_select_db($database_poy, $poy);
$query_login = "SELECT ID, userid, pwd FROM userlogin ORDER BY ID DESC";
$login = mysql_query($query_login, $poy) or die(mysql_error());
$row_login = mysql_fetch_assoc($login);
$totalRows_login = mysql_num_rows($login);
?>
<?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['userid'])) {
$loginUsername=$_POST['userid'];
$password=$_POST['pwd'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_poy, $poy);
$LoginRS__query=sprintf("SELECT userid, pwd FROM userlogin WHERE userid='%s' AND pwd='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $poy) 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 );
}
}
?>
<!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 http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户登录</title>
<style type="text/css">
<!--
.style1 {font-size: 24px}
.style2 {color: #0066CC}
.style3 {font-weight: bold}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head><body>
<form name="form1" id="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<p align="center" class="style2 style1" ><strong> 管 理 系 统</strong></p>
<p align="center"> </p>
<p align="center"><span class="style3">登 录:</span>
<input name="userid" type="text" id="userid" style="BORDER-RIGHT: #FFFFFF 1px solid; BORDER-TOP: #FFFFFF 1px solid; FONT-SIZE: 10pt; BACKGROUND: #ffffff; BORDER-LEFT: #FFFFFF 1px solid; WIDTH: 120px; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 18px; color:#FF6600" size="15" maxlength="15" />
</p>
<p align="center" ><span class="style3">密 码:</span>
<input name="pwd" type="password" id="pwd" style="BORDER-RIGHT: #FFFFFF 1px solid; BORDER-TOP: #FFFFFF 1px solid; FONT-SIZE: 9pt; BACKGROUND: #ffffff; BORDER-LEFT: #FFFFFF 1px solid; WIDTH: 120px; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 18px; color:#FF6600" size="15" maxlength="15" />
</p>
<p align="center">
<input name="Submit1" type="submit" class="style5" value="提交" />
<input name="Submit2" type="button" class="style5" onclick="MM_openBrWindow('useradd.php','','')" value="注册" />
</p>
<p align="center"> </p>
</form> <tr>
<td height="17"> </td>
</tr>
</body>
</html>
<?php
mysql_free_result($login);
?>
<?php//***用户注册
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="useradd.php";
$loginUsername = $_POST['userid'];
$LoginRS__query = "SELECT userid FROM userlogin WHERE userid='" . $loginUsername . "'";
mysql_select_db($database_poy, $poy);
$LoginRS=mysql_query($LoginRS__query, $poy) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS); //if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO userlogin (userid, pwd, pwd2, uname, job, duty) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['userid'], "text"),
GetSQLValueString($_POST['pwd'], "text"),
GetSQLValueString($_POST['pwd2'], "text"),
GetSQLValueString($_POST['uname'], "text"),
GetSQLValueString($_POST['job'], "text"),
GetSQLValueString($_POST['duty'], "text")); mysql_select_db($database_poy, $poy);
$Result1 = mysql_query($insertSQL, $poy) or die(mysql_error()); $insertGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}mysql_select_db($database_poy, $poy);
$query_login = "SELECT ID, userid, pwd, pwd2, uname FROM userlogin";
$login = mysql_query($query_login, $poy) or die(mysql_error());
$row_login = mysql_fetch_assoc($login);
$totalRows_login = mysql_num_rows($login);
?><!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 http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户注册</title>
<style type="text/css">
<!--
.style1 {
font-size: 24px;
font-weight: bold;
color: #0066CC;
}
-->
</style>
<script language="javascript" type="text/javascript">
function popUpWindow(URLStr, left, top, width, height)
{
window.open(URLStr, 'popcheckWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
function checkSubmit()
{
if(document.form2.userid.value=="")
{
document.form2.userid.focus();
alert("用户名不能为空!");
return false;
}
if(document.form2.pwd.value=="")
{
document.form2.pwd.focus();
alert("登陆密码不能为空!");
return false;
}
if(document.form2.pwd2.value!=document.form2.pwd.value)
{
document.form2.pwd2.focus();
alert("两次密码不一致!");
return false;
}if(document.form2.uname.value=="")
{
document.form2.uname.focus();
alert("姓名不能为空!");
return false;
}
}
</script>
</head><body>
<p align="center" class="style1">用户注册</p> <form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
<p align="center"> <span class="style3">用 户 名:</span>
<input name="userid" type="text" size="15" maxlength="15">
</p>
<p align="center"><span class="style3">密 码:</span>
<input name="pwd" type="password" id="pwd" size="15" maxlength="15">
</p>
<p align="center"><span class="style3">确认密码:</span>
<input name="pwd2" type="password" size="15" maxlength="15">
</p>
<p align="center"><span class="style3">姓 名:</span>
<input name="uname" type="text" id="uname" size="15" maxlength="15">
</p>
<p align="center"><span class="style3">部 门:
<select name="job" >
<option value="大客户部" selected="selected">大客户部</option>
<option value="财务部">财务部</option>
<option value="技术部">技术部</option>
<option value="门市部">门市部</option>
<option value="渠道部">渠道部</option>
</select>
</span></p>
<p align="center" class="style3">职 位:
<select name="duty" id="duty">
<option value="总经理" selected="selected">总经理</option>
<option value="副经理">副经理</option>
<option value="技术员">技术员</option>
<option value="业务员">业务员</option>
<option value="会计">会计</option>
<option value="返修人员">返修人员</option>
</select>
</p>
<p align="center" class="style4">
<input name="Submit" type="submit" value="提交"> </p>
<input type="hidden" name="MM_insert" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
<?php
mysql_free_result($login);
?>