📄 myoper.asp
字号:
<%@LANGUAGE="VBScript"%>
<!--#include file="login.asp"-->
<%
'程序:王星亮 网名:血饮狂刀 国外的叫我LANBOO
'OICQ:40001
'EMAIL:webmaster@xytime.com
'我是什么都有,您想要我开发什么程序,尽管说。只要价格合理就行。
'我电话:13308715776 0871-3394913
response.expires = 0
Const PageSize=18
Page=CInt(request("Page"))
if Page<=0 then Page=1
gpy=request("gpy")
OperID= session("My_Login_ID")
LoginName= session("My_Login_Name")
AddTime=now
AddIp=request.servervariables("remote_addr")
NewID=request("NewID")
%>
<script language="javascript">
function confirmDel(id){
if ( confirm("你确定要删除吗?")) {
window.location.href = "<%=request.servervariables("SCRIPT_NAME")%>?gpy=del&NewID=" + id
}
}
</script>
<%
'权限认证
Query="select * from MyOper where ID="&OperID
set sql=conn.Execute(Query)
if sql.eof then Back("对不起,用户名非法")
if sql("OperType")<>4 then Back("对不起,只有平台管理员才能使用本功能!")
'显示已有操作员列表
if gpy="" then
ShowLookHtml
'显示增加操作员的网页
elseif gpy="ShowHtml" then
dim sql11(12)
ShowData sql11
'增加操作员
elseif gpy="Add" then
OperName=request("OperName")
NewLoginName=request("NewLoginName")
NewPasswd=request("NewPasswd")
Leader=request("Leader")
DeptID=request("DeptID")
Explain=request("Explain")
Query="select * from MyOper where LoginName='"&NewLoginName&"'"
set sql=conn.Execute(Query)
if not sql.eof then Mesg "登录名<font color=red>"&NewLoginName&"</font>已经存在!请重新选择","L"
Query="insert into MyOper values("&GetID("select max(ID)+1 from MyOper")&",'"&OperName&"','"&Explain&"','"&NewLoginName&"','"&Encrypt(NewPasswd)&"',"&DeptID&","&Leader&","&OperID&",'"&AddIp&"',#"&AddTime&"#,100)"
conn.Execute(Query)
%>
<script language='javascript'>
alert('新的员工成功增加!');
window.location.href = "<%=request.servervariables("SCRIPT_NAME")%>";
</script>
<%
'修改操作员
elseif gpy="Modi" then
Query="select * from MyOper where ID="&NewID
set sql=conn.Execute(Query)
aa=sql(3)&"[注意:登录名不能进行修改!]"
ShowData sql
elseif gpy="Modi_Ok" then
OperName=request("OperName")
NewPasswd=request("NewPasswd")
Leader=request("Leader")
DeptID=request("DeptID")
Explain=request("Explain")
Query="Update MyOper set Name='"&OperName&"',OperType="&Leader&",Explain='"&Explain&"',DeptID="&DeptID&",LoginPWD='"&Encrypt(NewPasswd)&"' where ID="&NewID
' response.write(Query)
conn.Execute(Query)
%>
<script language='javascript'>
alert('员工修改成功!');
window.location.href = "<%=request.servervariables("SCRIPT_NAME")%>";
</script>
<%
'删除操作员
elseif gpy="del" then
Query="delete from MyOper where ID="&NewID
conn.Execute(Query)
%>
<script language='javascript'>
alert('指定员工成功删除');
window.location.href = "<%=request.servervariables("SCRIPT_NAME")%>";
</script>
<%
end if
sub ShowData(sql)
HtmlHead("[增加新的操作员]--操作员管理")
%>
<SCRIPT language=JavaScript>
<!--
function checkvalue() {
aa=document.form1
if (aa.OperName.value=="") {
window.alert ("请输入姓名!"); aa.OperName.focus();return false}
if (aa.NewLoginName.value=="") {
window.alert ("请输入登录名!"); aa.NewLoginName.focus();return false}
if (aa.NewPasswd.value=="") {
window.alert ("请输入密码!"); aa.NewPasswd.focus();return false}
if (aa.NewPasswd.value != aa.VerPasswd.value ) {
window.alert ("两次密码不相同!"); aa.VerPasswd.focus();return false}
}
//-->
</SCRIPT>
<form name=form1 action="<%=request.servervariables("SCRIPT_NAME")%>" method="POST" >
<table width="490" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#666666">
<tr><td bgcolor="DDDDDD" colspan="2" class=pt>注意:<br>
1、登录名不能重复。<br>
2、登录名和密码中不能包含单引号和空格。<br>
</td></tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">姓 名:</td>
<td width="90%" bgcolor="#FFFFFF" align="left"><input type="text" name="OperName" size="50" value='<%=sql(1)%>'></td>
</tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">性 别:</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<INPUT type="radio" name="Explain" value="男" checked>男 <INPUT type="radio" name="Explain" value="4" <%if sql(2)="女" then response.write "checked"%>>女
</td>
</tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">登 录 名:</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<%if NewID <>"" then
response.write sql("LoginName")%>
<%else%>
<input name="NewLoginName" size="50" value=''>
<%end if%>
</td>
</tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">密 码:</td>
<td width="90%" bgcolor="#FFFFFF" align="left"><input type="password" name="NewPasswd" size="50" value='<%=Encrypt(sql(4))%>'></td>
</tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">校验密码:</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<input type="password" name="VerPasswd" size="50" value='<%=Encrypt(sql(4))%>'>
</td>
</tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">管 理 权:</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<INPUT type="radio" name="Leader" value="1" checked>否 <INPUT type="radio" name="Leader" value="4" <%if sql(6)=4 then response.write "checked"%>>是
</td>
</tr>
<tr>
<td width="10%" bgcolor="#FFFFFF" align="right">所属部门:</td>
<td width="90%" bgcolor="#FFFFFF" align="left">
<select name="DeptID" class=text2>
<option value="0">----请选择----</option>
<%
set sql1=conn.Execute("select ID,Name from MyDept order by IssueTime desc")
while not sql1.eof
response.write("<option value="&sql1(0)&">"&sql1(1)&"</option>")
sql1.movenext
wend
%>
</select>
</td>
</tr>
</table>
</td>
<td valign="top">
<table border="0" width="100%">
<%if gpy="Modi" then%>
<tr>
<td width="100%">
<input style="font-family: 宋体; font-size: 10.5pt; background-image: url('images/task.gif'); background-repeat: no-repeat; border: 1px ridge; background-position: left center" type="submit" value=" 修改" name="okbtn">
<input type=hidden name="Issuer" value=<%=Issuer%>>
<input type=hidden name="gpy" value="Modi_Ok">
<input type=hidden name="NewId" value=<%=NewId%>>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.form1.DeptID.value='<%=sql(5)%>';
//-->
</SCRIPT>
</td>
</tr>
<%else%>
<tr>
<td width="100%">
<input style="font-family: 宋体; font-size: 10.5pt; background-image: url('images/task.gif'); background-repeat: no-repeat; border: 1px ridge; background-position: left center" type="submit" value=" 增加" name="okbtn" onClick="return checkvalue()">
<input type=hidden name="gpy" value="Add">
</td>
</tr>
<%end if%>
<tr>
<td width="100%">
<input style="font-family: 宋体; font-size: 10.5pt; background-image: url('images/Delete.gif'); background-repeat: no-repeat; border: 1px ridge; background-position: left center" type="button" value=" 放弃" name="okbtn" onClick="history.back();">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
<%
end sub
'显示操作员列表
sub ShowLookHtml()
set sql2=server.createobject("ADODB.recordset")
Query="select * from MyOper order by IssueTime desc "
sql2.open Query,conn,1,1
sql2.PageSize=CLng(PageSize)
if Page>sql2.PageCount then Page=sql2.PageCount
if not(sql2.eof) then
sql2.absolutepage=CLng(Page)
end if
PageNum=sql2.PageCount
Rows=sql2.RecordCount
HtmlHead("用户列表")
%>
<table width='550' border='1' cellspacing='0' cellpadding='0' bordercolorlight='#7C7C7C' bordercolordark='#FFFFFF'>
<tr bgcolor="<%=TableTopBg%>" >
<td class="pt3" colspan=10>
<table width="100%">
<tr><td>
<%=sql2.RecordCount%>个记录/共<%=sql2.PageCount%>页
<%
if sql2.PageCount>1 then
for i= 1 to sql2.PageCount
response.write("<a href="&request.servervariables("SCRIPT_NAME")&"?Page="&i&">"&i&"</a> ")
next
end if
%>
</td><td width=90>
<a href=<%=request.servervariables("SCRIPT_NAME")&"?gpy=ShowHtml"%>>新建用户</a>
</td></tr></table>
</td>
</tr>
<tr>
<td bgcolor='rgb(214,211,206)' width='10' height='20'> </td>
<td class="pt2">部门</td>
<td class="pt2">姓名</td>
<td class="pt2">登录名</td>
<td class="pt2">性别</td>
<td class="pt2">管理员</td>
<td class="pt2">操作</td>
</tr>
<%for i=1 to Pagesize
if sql2.eof then exit for
%>
<tr bgcolor=#ffffff>
<td bgcolor='rgb(214,211,206)' width='10' height='20'> </td>
<td class="pt2"><%=GetName("select Name from MyDept where ID="&sql2("DeptID"))%> </td>
<td class="pt2"><%=sql2("Name")%> </td>
<td class="pt2"><%=sql2("LoginName")%> </td>
<td class="pt2"><%=sql2("Explain")%> </td>
<td class="pt2"><%if sql2("OperType")=4 then response.write "是"%> </td>
<td class="pt2">
<a href=<%response.write(request.servervariables("SCRIPT_NAME")&"?gpy=Modi&NewID="&sql2("ID"))%>>修改</a>
<a href=<%response.write("javascript:confirmDel("&sql2("ID")&")")%>>删除</a>
</td>
</tr>
</tr>
<%
sql2.movenext
next
%>
</table>
<%
HtmlEnd
end sub
function GetGroupName(GroupId)
set tmpSql=Conn.Execute("select GroupName from MyOperGroup where GroupId='"&GroupId&"'")
if tmpSql.eof then
GetGroupName=" "
else
GetGroupName=tmpSql("GroupName")
end if
end function
'程序:王星亮 网名:血饮狂刀 国外的叫我LANBOO
'OICQ:40001
'EMAIL:webmaster@xytime.com
'我是什么都有,您想要我开发什么程序,尽管说。只要价格合理就行。
'我电话:13308715776 0871-3394913
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -