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

📄 user_new.php

📁 泛微协同办公系统标准版E-office V5.5的源代码内含泛微办公系统V5.5自动注册文件。
💻 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";
echo "<s";
echo "cript Language=\"JavaScript\">\r\nfunction CheckForm()\r\n{\r\n   if(document.form1.USER_ACCOUNTS.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,USER_NAME)\r\n{\r\n msg='确认要删除用户 '+USER_NAME+' 么?';\r\n if(window.confirm(msg))\r\n {\r\n  URL=\"";
echo "delete.php?DEPT_ID=";
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,USER_NAME)\r\n{\r\n msg='确认要清空用户 '+USER_NAME+' 的密码么?';\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\" leftmargin=\"1\" onLoad=\"document.form1.USER_ACCOUNTS.focus();\">\r\n <form act";
echo "ion=\"add.php\"  method=\"post\" name=\"form1\" onSubmit=\"return CheckForm();\">\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<table border=\"0\" width=\"100%\" cellspacing=\"1\"  cellpadding=\"1\">\r\n  <tr class=\"tablehead1\">\r\n    <td>添加用户 (\r\n          ";
echo $DEPT_NAME;
echo "    )</td>\r\n  </tr>\r\n</table>\r\n<table border=\"0\" width=\"100%\" cellspacing=\"0\"  cellpadding=\"0\">\r\n  <tr class=\"tablehead2\">\r\n    <td height=\"30\"><input name=\"image\" type=\"image\" src=\"../../../../images/button/add.gif\" width=\"105\" height=\"20\" border=\"0\">\r\n    </td>\r\n  </tr>\r\n</table>\r\n<br>\r\n<table border=\"0\" cellspacing=\"1\" width=\"100%\" class=\"small\" cellpadding=\"3\"  >\r\n \r\n   <tr>\r\n    <td nowrap class=\"tablelin";
echo "e2\" width=\"120\">用户名:</td>\r\n    <td nowrap class=\"tableline1\">\r\n        <input type=\"text\" name=\"USER_ACCOUNTS\" class=\"SmallInput\" size=\"20\" maxlength=\"20\">&nbsp;\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td nowrap class=\"tableline2\">真实姓名:</td>\r\n    <td nowrap class=\"tableline1\">\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   ";
echo " <td nowrap class=\"tableline2\">性别:</td>\r\n    <td nowrap class=\"tableline1\">\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=\"tableline2\">部门:</td>\r\n    <td nowrap class=\"tableline1\">\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=\"tableline2\">密码:</td>\r\n    <td nowrap class=\"tableline1\">\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=\"tableline2\">考勤排班类型:</td>\r\n    <td nowrap class=\"tableline1\">\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\r\n   <tr>\r\n    <td nowrap class=\"tableline2\" width=\"120\">动态密码登录:</td>\r\n    <td nowrap class=\"tableline1\">\r\n        ";
echo "<s";
echo "elect name=\"SMS_LOGIN\" class=\"BigSelect\">\r\n          <option value=\"0\">不使用</option>]\r\n\t\t  <option value=\"1\">使用</option>\r\n        </select> (登录时发送手机短信验证)\r\n    </td>\r\n   </tr>\r\n\r\n   <tr>\r\n    <td nowrap class=\"tableline2\">角色:</td>\r\n    <td nowrap class=\"tableline1\">\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=\"tableline2\" width=\"120\">管理范围:</td>\r\n    <td nowrap class=\"tableline1\">\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 "   \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=\"1\"  cellpadding=\"1\">\r\n  <tr>\r\n    <td width=\"20%\" nowrap=\"nowrap\">管理用户 (";
echo $DEPT_NAME;
echo "):\r\n      </td>\r\n\t  <td id=\"totaluser\" width=\"20px\" nowrap=\"nowrap\"></td><td nowrap=\"nowrap\">人</td>\r\n  </tr>\r\n</table>\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_ID = $ROW['USER_ID'];
	$USER_ACCOUNTS = $ROW['USER_ACCOUNTS'];
	$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'];
	if ( $LOGIN_USER_PRIV != "1" && !is_dept_priv( $DEPT_ID ) )
	{
		continue;
	}
	++$USER_COUNT;
	$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  border=\"0\" cellspacing=\"1\" width=\"100%\" class=\"small\" 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 >";
	echo $USER_ACCOUNTS;
	echo "</td>\r\n      <td nowrap >";
	echo $USER_NAME;
	echo "</td>\r\n      <td nowrap >";
	echo $DEPT_NAME;
	echo "</td>\r\n      <td nowrap >";
	echo $DUTY_NAME;
	echo "</td>\r\n      <td nowrap >";
	echo $USER_PRIV;
	echo "</td>\r\n      <td nowrap >";
	echo $POST_PRIV;
	echo "</td>\r\n      <td nowrap >\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 "','";
		echo $USER_NAME;
		echo "');\"> 删除</a>\r\n";
	}
	if ( $LOGIN_USER_ID == "admin" )
	{
		echo "      <br><a href=\"javascript:no_pass('";
		echo $USER_ID;
		echo "','";
		echo $USER_NAME;
		echo "');\">admin清空密码</a>\r\n";
	}
	echo "      </td>\r\n    </tr>\r\n";
}
if ( 0 < $USER_COUNT )
{
	echo "    <thead class=\"TableHeader\">\r\n      <td nowrap >用户名</td>\r\n      <td nowrap >真实姓名</td>\r\n      <td nowrap >部门</td>\r\n      <td nowrap >排班</td>\r\n      <td nowrap >角色</td>\r\n      <td nowrap >管理范围</td>\r\n      <td nowrap >操作</td>\r\n    </thead>\r\n</table>\r\n";
}
else
{
	message( "", "尚无可管理用户" );
}
echo "</form>\r\n</body>\r\n</html>\r\n";
echo "<s";
echo "cript>\r\ndocument.getElementById(\"totaluser\").innerHTML = \"";
echo $USER_COUNT;
echo "\";\r\n</script>";
?>

⌨️ 快捷键说明

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