📄 user_new.php
字号:
<?
include_once 'inc/auth.php';
include_once 'inc/utility_all.php';
echo '
<html>
<head>
<title>用户管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language="JavaScript">
function delete_user(USER_ID)
{
msg=\'确认要删除用户 \'+USER_ID+\' 么?\';
if(window.confirm(msg))
{
URL="delete.php?DEPT_ID=';
echo $DEPT_ID;
echo '&USER_ID=" + USER_ID;
window.location=URL;
}
}
function no_pass(USER_ID)
{
msg=\'确认要清空用户 \'+USER_ID+\' 的密码么?\';
if(window.confirm(msg))
{
URL="no_pass.php?DEPT_ID=';
echo $DEPT_ID;
echo '&USER_ID=" + USER_ID;
window.location=URL;
}
}
</script>
</head>
<body class="bodycolor" topmargin="5">
';
$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 '
<body class="bodycolor" topmargin="5">
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
<tr>
<td class="Big"><img src="/images/notify_new.gif" align="absmiddle"><span class="big3"> 新建用户 (';
echo $DEPT_NAME;
echo ')</span>
</td>
</tr>
</table>
<div align="center">
<input type="button" value="新建用户" class="BigButton" title="新建用户" onclick="window.open(\'new.php?DEPT_ID=';
echo $DEPT_ID;
echo '\',\'oa_sub_window\',\'height=450,width=550,status=0,toolbar=no,menubar=no,location=no,left=300,top=200,scrollbars=yes,resizable=yes\');">
</div>
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0" height="3">
<tr>
<td background="/images/dian1.gif" width="100%"></td>
</tr>
</table>
';
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 '
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
<tr>
<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>
</td>
</tr>
</table>
';
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'];
$BYNAME = $ROW['BYNAME'];
$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 ' <table align="center" border="0" cellspacing="1" width="100%" class="small" bgcolor="#000000" cellpadding="3">
';
}
if ($USER_COUNT % 2 == 1)
{
$TableLine = 'TableLine1';
}
else
{
$TableLine = 'TableLine2';
}
echo ' <tr class="';
echo $TableLine;
echo '">
<td nowrap align="center">';
echo $USER_ID;
echo '</td>
<td nowrap align="center">';
echo $USER_NAME;
echo '</td>
<td nowrap align="center">';
echo $BYNAME;
echo '</td>
<td nowrap align="center">';
echo $DEPT_NAME;
echo '</td>
<td nowrap align="center">';
echo $DUTY_NAME;
echo '</td>
<td nowrap align="center">';
echo $USER_PRIV;
echo '</td>
<td nowrap align="center">';
echo $POST_PRIV;
echo '</td>
<td nowrap align="center">
<a href="user_edit.php?USER_ID=';
echo $USER_ID;
echo '"> 编辑</a>
';
if ($USER_ID != 'admin')
{
if ($USER_ID != $LOGIN_USER_ID)
{
echo ' <a href="javascript:delete_user(\'';
echo $USER_ID;
echo '\');"> 删除</a>
';
}
}
if ($LOGIN_USER_ID == 'admin')
{
echo ' <br><a href="javascript:no_pass(\'';
echo $USER_ID;
echo '\');">admin清空密码</a>
';
}
echo ' </td>
</tr>
';
}
if (0 < $USER_COUNT)
{
echo ' <thead class="TableHeader">
<td nowrap align="center">用户名</td>
<td nowrap align="center">真实姓名</td>
<td nowrap align="center">别名</td>
<td nowrap align="center">部门</td>
<td nowrap align="center">排班</td>
<td nowrap align="center">角色</td>
<td nowrap align="center">管理范围</td>
<td nowrap align="center">操作</td>
</thead>
</table>
';
}
else
{
message ('', '尚未定义用户');
}
echo '
<br>
</body>
</html>';
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -