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

📄 user_new.php

📁 极限网络智能办公系统 - Office Automation 2008 官方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<script Language=\"JavaScript\">\r\nfunction delete_user()\r\n{\r\n  delete_str=\"\";\r\n  for(i=0;i<document.all(\"email_select\").length;i++)\r\n  {\r\n      el=document.all(\"email_select\").item(i);\r\n      if(el.value==\"";
echo $LOGIN_USER_ID;
echo "\")\r\n         el.checked=false;\r\n      if(el.checked)\r\n      {  val=el.value;\r\n         delete_str+=val + \",\";\r\n      }\r\n  }\r\n\r\n  if(i==0)\r\n  {\r\n      el=document.all(\"email_select\");\r\n      if(el.checked)\r\n      {  val=el.value;\r\n         delete_str+=val + \",\";\r\n      }\r\n  }\r\n\r\n  if(delete_str==\"\")\r\n  {\r\n     alert(\"要删除用户,请至少选择其中一个。\");\r\n     document.form1.reset();\r\n     return;\r\n  }\r\n  \r\n msg='确认要删除所选用户么?';\r\n if(window.confirm(msg))\r\n {\r\n  URL=\"delete.php?DEPT_ID=1&USER_ID=\" + delete_str;\r\n  window.location=URL;\r\n }\r\n}\r\nfunction no_online()\r\n{\r\n  delete_str=\"\";\r\n  for(i=0;i<document.all(\"email_select\").length;i++)\r\n  {\r\n      el=document.all(\"email_select\").item(i);\r\n      if(el.checked)\r\n      {  val=el.value;\r\n         delete_str+=val + \",\";\r\n      }\r\n  }\r\n\r\n  if(i==0)\r\n  {\r\n      el=document.all(\"email_select\");\r\n      if(el.checked)\r\n      {  val=el.value;\r\n         delete_str+=val + \",\";\r\n      }\r\n  }\r\n\r\n  if(delete_str==\"\")\r\n  {\r\n     alert(\"要清空在线时长,请至少选择其中一个用户。\");\r\n     document.form1.reset();\r\n     return;\r\n  }\r\n  \r\n msg='确认要清空所选用户的在线时长么?';\r\n if(window.confirm(msg))\r\n {\r\n  URL=\"no_online.php?DEPT_ID=";
echo $DEPT_ID;
echo "&USER_ID=\" + delete_str;\r\n  window.location=URL;\r\n }\r\n}\r\nfunction no_pass()\r\n{\r\n  delete_str=\"\";\r\n  for(i=0;i<document.all(\"email_select\").length;i++)\r\n  {\r\n      el=document.all(\"email_select\").item(i);\r\n      if(el.checked)\r\n      {  val=el.value;\r\n         delete_str+=val + \",\";\r\n      }\r\n  }\r\n\r\n  if(i==0)\r\n  {\r\n      el=document.all(\"email_select\");\r\n      if(el.checked)\r\n      {  val=el.value;\r\n         delete_str+=val + \",\";\r\n      }\r\n  }\r\n\r\n  if(delete_str==\"\")\r\n  {\r\n     alert(\"要清空用户密码,请至少选择其中一个。\");\r\n     document.form1.reset();\r\n     return;\r\n  }\r\n  \r\n msg='确认要清空所选用户的密码么?';\r\n if(window.confirm(msg))\r\n {\r\n  URL=\"no_pass.php?DEPT_ID=1&USER_ID=\" + delete_str;\r\n  window.location=URL;\r\n }\r\n}\r\nfunction check_all()\r\n{\r\n for (i=0;i<document.all(\"email_select\").length;i++)\r\n {\r\n   if(document.all(\"allbox\").checked)\r\n      document.all(\"email_select\").item(i).checked=true;\r\n   else\r\n      document.all(\"email_select\").item(i).checked=false;\r\n }\r\n\r\n if(i==0)\r\n {\r\n   if(document.all(\"allbox\").checked)\r\n      document.all(\"email_select\").checked=true;\r\n   else\r\n      document.all(\"email_select\").checked=false;\r\n }\r\n}\r\n\r\nfunction check_one(el)\r\n{\r\n   if(!el.checked)\r\n      document.all(\"allbox\").checked=false;\r\n}\r\n\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\">\r\n\r\n";
$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\">\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\"><span class=\"big3\"> 新建用户 (";
echo $DEPT_NAME;
echo ")</span>\r\n    </td>\r\n  </tr>\r\n</table>\r\n<div align=\"center\">\r\n  <input type=\"button\" value=\"新建用户\" class=\"BigButton\" title=\"新建用户\" onclick=\"window.open('new.php?DEPT_ID=";
echo $DEPT_ID;
echo "','oa_sub_window','height=500,width=650,status=0,toolbar=no,menubar=no,location=no,left=150,top=100,scrollbars=yes,resizable=yes');\">\r\n</div>\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";
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\"><span class=\"big3\"> <a name=\"bottom\">管理用户(";
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_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_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'];
	$PASSWORD = $ROW['PASSWORD'];
	$BYNAME = $ROW['BYNAME'];
	$DEPT_ID = $ROW['DEPT_ID'];
	$USER_PRIV = $ROW['USER_PRIV'];
	$POST_PRIV = $ROW['POST_PRIV'];
	$DUTY_TYPE = $ROW['DUTY_TYPE'];
	$LAST_VISIT_TIME = $ROW['LAST_VISIT_TIME'];
	$IDLE_TIME_DESC = "";
	if ( $LAST_VISIT_TIME != "0000-00-00 00:00:00" )
	{
		$IDLE_TIME = time( ) - strtotime( $LAST_VISIT_TIME ) - $ONLINE_REF_SEC;
		if ( 0 < floor( $IDLE_TIME / 86400 ) )
		{
			$IDLE_TIME_DESC .= floor( $IDLE_TIME / 86400 )."天";
		}
		if ( 0 < floor( $IDLE_TIME % 86400 / 3600 ) )
		{
			$IDLE_TIME_DESC .= floor( $IDLE_TIME % 86400 / 3600 )."小时";
		}
		if ( 0 < floor( $IDLE_TIME % 3600 / 60 ) )
		{
			$IDLE_TIME_DESC .= floor( $IDLE_TIME % 3600 / 60 )."分";
		}
		if ( $IDLE_TIME_DESC == "" )
		{
			$IDLE_TIME_DESC = "0分";
		}
	}
	$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 "    <table align=\"center\" border=\"0\" cellspacing=\"1\" width=\"100%\" class=\"small\" bgcolor=\"#000000\" cellpadding=\"3\">\r\n";
	}
	if ( $USER_COUNT % 2 == 1 )
	{
		$TableLine = "TableLine1";
	}
	else
	{
		$TableLine = "TableLine2";
	}
	echo "    <tr class=\"";
	echo $TableLine;
	if ( crypt( "", $PASSWORD ) == $PASSWORD )
	{
		echo " TextColor2";
	}
	echo "\"";
	if ( crypt( "", $PASSWORD ) == $PASSWORD )
	{
		echo " title=\"".$USER_NAME." 登录密码为空\"";
	}
	echo ">\r\n      <td>\r\n      \t";
	if ( $USER_ID != "admin" )
	{
		echo "      \t&nbsp;<input type=\"checkbox\" name=\"email_select\" value=\"";
		echo $USER_ID;
		echo "\" onClick=\"check_one(self);\">\r\n      \t";
	}
	echo "      <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 align=\"center\">";
	echo $IDLE_TIME_DESC;
	echo "</td>\r\n      <td nowrap align=\"center\">\r\n      <a href=\"no_online.php?DEPT_ID=";
	echo $DEPT_ID;
	echo "&USER_ID=";
	echo $USER_ID;
	echo "\"> 清空在线时长</a>&nbsp;&nbsp;\r\n      <a href=\"user_edit.php?USER_ID=";
	echo $USER_ID;
	echo "\"> 编辑</a>&nbsp;&nbsp;\r\n      </td>\r\n    </tr>\r\n";
}
if ( 0 < $USER_COUNT )
{
	echo "<tr class=\"TableControl\">\r\n<td colspan=\"9\"> \r\n        &nbsp;<input type=\"checkbox\" name=\"allbox\" id=\"allbox_for\" onClick=\"check_all();\">\r\n        <label for=\"allbox_for\">全选</label> &nbsp;\r\n        <input type=\"button\"  value=\"删除\" class=\"SmallButton\" onClick=\"delete_user();\" title=\"删除所选用户\"> &nbsp;\r\n        <input type=\"button\"  value=\"清空在线时长\" class=\"SmallButton\" onClick=\"no_online();\" title=\"清空在线时长\"> &nbsp;\r\n";
	if ( $LOGIN_USER_PRIV == "1" )
	{
		echo "        <input type=\"button\"  value=\"管理员清空密码\" class=\"SmallButton\" onClick=\"no_pass();\" title=\"管理员清空密码\"> &nbsp;\r\n";
	}
	echo "</td>\r\n</tr>\r\n    <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      <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 + -