⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user_new.php

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 PHP
字号:
<?php

include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
echo "\r\n<html>\r\n<head>\r\n<title>用户管理</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n\r\n";
echo "<s";
echo "cript Language=\"JavaScript\">\r\nfunction CheckForm()\r\n{\r\n   if(document.form1.USER_ID.value==\"\")\r\n   { alert(\"用户名不能为空!\");\r\n     return (false);\r\n   }\r\n\r\n   if(document.form1.USER_NAME.value==\"\")\r\n   { alert(\"真实姓名不能为空!\");\r\n     return (false);\r\n   }\r\n}\r\n\r\nfunction delete_user(USER_ID)\r\n{\r\n msg='确认要删除用户 '+USER_ID+' 么?';\r\n if(window.confirm(msg))\r\n {\r\n  URL=\"delete.php?DEPT_ID";
echo "=";
echo $DEPT_ID;
echo "&USER_ID=\" + USER_ID;\r\n  window.location=URL;\r\n }\r\n}\r\n\r\nfunction no_pass(USER_ID)\r\n{\r\n msg='确认要清空用户 '+USER_ID+' 的密码么?';\r\n if(window.confirm(msg))\r\n {\r\n  URL=\"no_pass.php?DEPT_ID=";
echo $DEPT_ID;
echo "&USER_ID=\" + USER_ID;\r\n  window.location=URL;\r\n }\r\n}\r\n\r\nfunction clear_dept()\r\n{\r\n  document.form1.TO_NAME.value=\"\";\r\n  document.form1.TO_ID.value=\"\";\r\n}\r\n\r\nfunction LoadWindow()\r\n{\r\n  URL=\"/module/dept_select?PRIV_OP=1\";\r\n  loc_x=document.body.scrollLeft+event.clientX-event.offsetX-100;\r\n  loc_y=document.body.scrollTop+event.clientY-event.offsetY+170;\r\n  window.showModalDialog(URL,self,\"edge:rais";
echo "ed;scroll:1;status:0;help:0;resizable:1;dialogWidth:400px;dialogHeight:245px;dialogTop:\"+loc_y+\"px;dialogLeft:\"+loc_x+\"px\");\r\n}\r\nfunction select_dept()\r\n{\r\n   if (form1.POST_PRIV.value==\"2\")\r\n       dept.style.display='';\r\n   else\r\n       dept.style.display=\"none\";\r\n}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\">\r\n\r\n";
$connection = openconnection( );
$query = "SELECT * from USER where USER_ID='{$LOGIN_USER_ID}'";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
	$POST_PRIV = $ROW['POST_PRIV'];
	$POST_DEPT = $ROW['POST_DEPT'];
}
$query = "SELECT * from USER_PRIV where USER_PRIV={$LOGIN_USER_PRIV}";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
	$PRIV_NO = $ROW['PRIV_NO'];
}
$query = "SELECT * from DEPARTMENT where DEPT_ID={$DEPT_ID}";
$cursor = exequery( $connection, $query );
if ( $ROW = mysql_fetch_array( $cursor ) )
{
	$DEPT_NAME = $ROW['DEPT_NAME'];
}
if ( $DEPT_ID == 0 )
{
	$DEPT_NAME = "离职人员/外部人员";
}
echo "\r\n<body class=\"bodycolor\" topmargin=\"5\" onload=\"document.form1.USER_ID.focus();\">\r\n\r\n<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" class=\"small\">\r\n  <tr>\r\n    <td class=\"Big\"><img src=\"/images/notify_new.gif\" align=\"absmiddle\">";
echo "<s";
echo "pan class=\"big3\"> 添加用户 (";
echo $DEPT_NAME;
echo ")</span>\r\n    </td>\r\n  </tr>\r\n</table>\r\n\r\n<table border=\"0\" cellspacing=\"1\" width=\"90%\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\" align=\"center\" >\r\n  <form action=\"add.php\"  method=\"post\" name=\"form1\" onsubmit=\"return CheckForm();\">\r\n   <tr>\r\n    <td nowrap class=\"TableData\" width=\"120\">用户名:</td>\r\n    <td nowrap class=\"TableData\">\r\n        <input type=\"text\" name=\"USER_ID\" class=\"SmallInput\" size=";
echo "\"20\" maxlength=\"20\">&nbsp;\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\">真实姓名:</td>\r\n    <td nowrap class=\"TableData\">\r\n        <input type=\"text\" name=\"USER_NAME\" class=\"SmallInput\" size=\"10\" maxlength=\"10\">&nbsp;\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\">性别:</td>\r\n    <td nowrap class=\"TableData\">\r\n        ";
echo "<s";
echo "elect name=\"SEX\" class=\"BigSelect\">\r\n        <option value=\"0\">男</option>\r\n        <option value=\"1\">女</option>\r\n        </select>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\">部门:</td>\r\n    <td nowrap class=\"TableData\">\r\n        ";
echo "<s";
echo "elect name=\"DEPT_ID\" class=\"BigSelect\">\r\n";
echo my_dept_tree( 0, $DEPT_ID, 1 );
if ( $DEPT_ID == 0 )
{
	echo "          <option value=\"0\">离职人员/外部人员</option>\r\n";
}
echo "        </select>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\">密码:</td>\r\n    <td nowrap class=\"TableData\">\r\n        <input type=\"password\" name=\"PASSWORD\" class=\"SmallInput\" size=\"10\" maxlength=\"10\">&nbsp;\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\">考勤排班类型:</td>\r\n    <td nowrap class=\"TableData\">\r\n        ";
echo "<s";
echo "elect name=\"DUTY_TYPE\" class=\"BigSelect\">\r\n";
$query = "SELECT * from ATTEND_CONFIG order by DUTY_TYPE";
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
	$DUTY_TYPE = $ROW['DUTY_TYPE'];
	$DUTY_NAME = $ROW['DUTY_NAME'];
	echo "          <option value=\"";
	echo $DUTY_TYPE;
	echo "\">";
	echo $DUTY_NAME;
	echo "</option>\r\n";
}
echo "        </select>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\">角色:</td>\r\n    <td nowrap class=\"TableData\">\r\n        ";
echo "<s";
echo "elect name=\"USER_PRIV\" class=\"BigSelect\">\r\n\r\n";
if ( $LOGIN_USER_PRIV != "1" )
{
	$query = "SELECT * from USER_PRIV where PRIV_NO>{$PRIV_NO} and USER_PRIV!=1 order by PRIV_NO desc";
}
else
{
	$query = "SELECT * from USER_PRIV order by PRIV_NO desc";
}
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
	$USER_PRIV1 = $ROW['USER_PRIV'];
	$PRIV_NAME = $ROW['PRIV_NAME'];
	echo "          <option value=\"";
	echo $USER_PRIV1;
	echo "\">";
	echo $PRIV_NAME;
	echo "</option>\r\n";
}
echo "        </select>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"TableData\" width=\"120\">管理范围(如果有权限执行管理型模块):</td>\r\n    <td nowrap class=\"TableData\">\r\n        ";
echo "<s";
echo "elect name=\"POST_PRIV\" class=\"BigSelect\" OnChange=\"select_dept()\">\r\n          <option value=\"0\">本部门</option>\r\n";
if ( $POST_PRIV == "1" )
{
	echo "          <option value=\"1\">全体</option>\r\n          <option value=\"2\">指定部门</option>\r\n";
}
else if ( $POST_PRIV == "2" )
{
	echo "          <option value=\"2\">指定部门</option>\r\n";
}
echo "        </select>\r\n    </td>\r\n   </tr>\r\n";
if ( $POST_PRIV != "0" )
{
	echo "   <tr id=\"dept\" style=\"display:none;\">\r\n      <td nowrap class=\"TableData\">管理范围(部门):</td>\r\n\r\n      <td class=\"TableData\">\r\n        <input type=\"hidden\" name=\"TO_ID\" value=\"";
	echo $TO_ID;
	echo "\">\r\n        <textarea cols=30 name=TO_NAME rows=2 class=\"BigStatic\" wrap=\"yes\" readonly>";
	echo $TO_NAME;
	echo "</textarea>\r\n        &nbsp;<input type=\"button\" value=\"添 加\" class=\"SmallButton\" onClick=\"LoadWindow()\" title=\"添加部门\" name=\"button\">\r\n        &nbsp;<input type=\"button\" value=\"清 空\" class=\"SmallButton\" onClick=\"clear_dept()\" title=\"清空部门\" name=\"button\">\r\n      </td>\r\n    </tr>\r\n";
}
echo "   <tr>\r\n    <td nowrap class=\"TableData\" width=\"120\">IMA广播权限:</td>\r\n    <td nowrap class=\"TableData\">\r\n        ";
echo "<s";
echo "elect name=\"CANBROADCAST\" class=\"BigSelect\">\r\n          <option value=\"0\">无</option>\r\n";
if ( $POST_PRIV == "1" )
{
	echo "          <option value=\"1\">有</option>\r\n";
}
echo "        </select>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap  class=\"TableControl\" colspan=\"2\" align=\"center\">\r\n        <input type=\"submit\" value=\"添加\" class=\"BigButton\" title=\"添加用户\" name=\"button\">\r\n    </td>\r\n  </form>\r\n</table>\r\n\r\n<br>\r\n\r\n<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"3\">\r\n <tr>\r\n   <td background=\"/images/dian1.gif\" width=\"100%\"></td>\r\n </tr>\r\n</table>\r\n\r\n";
if ( $LOGIN_USER_PRIV != "1" )
{
	$query = "SELECT count(*) from USER,USER_PRIV where DEPT_ID={$DEPT_ID} and USER.USER_PRIV=USER_PRIV.USER_PRIV and USER_PRIV.PRIV_NO>{$PRIV_NO} and USER_PRIV.USER_PRIV!=1";
}
else
{
	$query = "SELECT count(*) from USER,USER_PRIV where DEPT_ID={$DEPT_ID} and USER.USER_PRIV=USER_PRIV.USER_PRIV";
}
$cursor = exequery( $connection, $query );
$USER_TOTAL = 0;
if ( $ROW = mysql_fetch_array( $cursor ) )
{
	$USER_TOTAL = $ROW[0];
}
echo "\r\n<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" class=\"small\">\r\n  <tr>\r\n    <td class=\"Big\"><img src=\"/images/notify_open.gif\" align=\"absmiddle\">";
echo "<s";
echo "pan class=\"big3\"> 管理用户 (";
echo $DEPT_NAME;
echo ")- ";
echo $USER_TOTAL;
echo "人</span>\r\n    </td>\r\n  </tr>\r\n</table>\r\n\r\n";
if ( $LOGIN_USER_PRIV != "1" )
{
	$query = "SELECT * from USER,USER_PRIV where DEPT_ID={$DEPT_ID} and USER.USER_PRIV=USER_PRIV.USER_PRIV and USER_PRIV.PRIV_NO>{$PRIV_NO} and USER_PRIV.USER_PRIV!=1 order by PRIV_NO,USER_NAME";
}
else
{
	$query = "SELECT * from USER,USER_PRIV where DEPT_ID={$DEPT_ID} and USER.USER_PRIV=USER_PRIV.USER_PRIV order by PRIV_NO,USER_NAME";
}
$cursor = exequery( $connection, $query );
$USER_COUNT = 0;
while ( $ROW = mysql_fetch_array( $cursor ) )
{
	++$USER_COUNT;
	$USER_ID = $ROW['USER_ID'];
	$USER_NAME = $ROW['USER_NAME'];
	$DEPT_ID = $ROW['DEPT_ID'];
	$USER_PRIV = $ROW['USER_PRIV'];
	$POST_PRIV = $ROW['POST_PRIV'];
	$DUTY_TYPE = $ROW['DUTY_TYPE'];
	$query1 = "SELECT * from DEPARTMENT where DEPT_ID=".$DEPT_ID;
	$cursor1 = exequery( $connection, $query1 );
	if ( $ROW = mysql_fetch_array( $cursor1 ) )
	{
		$DEPT_NAME = $ROW['DEPT_NAME'];
	}
	else
	{
		$DEPT_NAME = "";
	}
	if ( $POST_PRIV == "0" )
	{
		$POST_PRIV = "本部门";
	}
	else if ( $POST_PRIV == "1" )
	{
		$POST_PRIV = "全体";
	}
	else if ( $POST_PRIV == "2" )
	{
		$POST_PRIV = "指定部门";
	}
	$query1 = "SELECT * from USER_PRIV where USER_PRIV='{$USER_PRIV}'";
	$cursor1 = exequery( $connection, $query1 );
	if ( $ROW = mysql_fetch_array( $cursor1 ) )
	{
		$USER_PRIV = $ROW['PRIV_NAME'];
	}
	if ( $DUTY_TYPE != "" )
	{
		$query1 = "SELECT * from ATTEND_CONFIG where DUTY_TYPE={$DUTY_TYPE}";
		$cursor1 = exequery( $connection, $query1 );
		if ( $ROW = mysql_fetch_array( $cursor1 ) )
		{
			$DUTY_NAME = $ROW['DUTY_NAME'];
		}
	}
	else
	{
		$DUTY_NAME = "";
	}
	if ( $USER_COUNT == 1 )
	{
		echo "\r\n    <table align=\"center\" border=\"0\" cellspacing=\"1\" width=\"90%\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\">\r\n\r\n";
	}
	if ( $USER_COUNT % 2 == 1 )
	{
		$TableLine = "TableLine1";
	}
	else
	{
		$TableLine = "TableLine2";
	}
	echo "    <tr class=\"";
	echo $TableLine;
	echo "\">\r\n      <td nowrap align=\"center\">";
	echo $USER_ID;
	echo "</td>\r\n      <td nowrap align=\"center\">";
	echo $USER_NAME;
	echo "</td>\r\n      <td nowrap align=\"center\">";
	echo $DEPT_NAME;
	echo "</td>\r\n      <td nowrap align=\"center\">";
	echo $DUTY_NAME;
	echo "</td>\r\n      <td nowrap align=\"center\">";
	echo $USER_PRIV;
	echo "</td>\r\n      <td nowrap align=\"center\">";
	echo $POST_PRIV;
	echo "</td>\r\n      <td nowrap align=\"center\">\r\n      <a href=\"user_edit.php?USER_ID=";
	echo $USER_ID;
	echo "\"> 编辑</a>&nbsp;&nbsp;\r\n";
	if ( $USER_ID != "admin" && $USER_ID != $LOGIN_USER_ID )
	{
		echo "      <a href=\"javascript:delete_user('";
		echo $USER_ID;
		echo "');\"> 删除</a>\r\n";
	}
	if ( $LOGIN_USER_ID == "admin" )
	{
		echo "      <br><a href=\"javascript:no_pass('";
		echo $USER_ID;
		echo "');\">admin清空密码</a>\r\n";
	}
	echo "      </td>\r\n    </tr>\r\n";
}
if ( 0 < $USER_COUNT )
{
	echo "    <thead class=\"TableHeader\">\r\n      <td nowrap align=\"center\">用户名</td>\r\n      <td nowrap align=\"center\">真实姓名</td>\r\n      <td nowrap align=\"center\">部门</td>\r\n      <td nowrap align=\"center\">排班</td>\r\n      <td nowrap align=\"center\">角色</td>\r\n      <td nowrap align=\"center\">管理范围</td>\r\n      <td nowrap align=\"center\">操作</td>\r\n    </thead>\r\n    </table>\r\n";
}
else
{
	message( "", "尚未定义用户" );
}
echo "\r\n<br>\r\n</body>\r\n</html>";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -