?? admin.asp
字號:
<!--#include file="Conn.asp"-->
<!--#include file="md5.asp"-->
<!--#include file=inc.asp-->
<%
Dim Rs,Sql
If Session("UserName")="" OR Session("UserId")="" Then
Response.Write("<script language=JavaScript>alert('您還沒有登陸!');document.location.href='index.asp';</script>")
Response.End
End if
Response.Write("<script language=JavaScript>alert('您沒有權限操作!');document.location.href='javascript:window.history.go(-1);';</script>")
Response.End
End If
If Request.QueryString("Action")="add" Then
If ChkPost=false Then
Response.Write("<script language=JavaScript>alert('請不要重外部提交信息!');document.location.href='index.asp';</script>")
Response.End
End If
Dim UserId,UserName,UserPwd,IP,UserMaxUp
UserId=Trim(Request.Form("UserId"))
UserName=Trim(Request.Form("UserName"))
UserPwd=Trim(Request.Form("UserPwd"))
UserMaxUp=Trim(Request.Form("UserMaxUp"))
If Userid="" or UserName="" or UserPwd="" Then
Response.Write("<script language=JavaScript>alert('請輸入用戶ID、用戶名和用戶密碼!');document.location.href='javascript:window.history.go(-1);';</script>")
Response.End
End If
Userid=Replace(Userid,"'","")
UserName=Replace(UserName,"'","")
UserPwd=Replace(UserPwd,"'","")
If isInteger(Userid)=False Then
Response.Write("<script language=JavaScript>alert('用戶ID必須是數字!');document.location.href='javascript:window.history.go(-1);';</script>")
Response.End
End If
If isInteger(UserMaxUp)=False Then
Response.Write("<script language=JavaScript>alert('上傳文件大小必須是數字!');document.location.href='javascript:window.history.go(-1);';</script>")
Response.End
End If
Sql="Select * From Users Where Userid='"&Userid&"'"
Set Rs=server.CreateObject("adodb.recordset")
If Not IsObject(Conn) Then ConnectionDatabase()
Rs.open Sql,Conn,1,3
If Not Rs.Eof Then
Rs.close
Set Rs=Nothing
CloseDatabase()
Response.Write("<script language=JavaScript>alert('該用戶ID已經存在!');document.location.href='javascript:window.history.go(-1);';</script>")
Else
Rs.AddNew
If Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
IP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
Else
IP=Request.ServerVariables("REMOTE_ADDR")
End If
Rs("UserId")=Userid
Rs("UserName")=UserName
Rs("UserPwd")=md5(UserPwd,32)
Rs("UserSex")=Request.Form("UserSex")
Rs("UserRegIp")=IP
Rs("UserLastIp")=IP
Rs("UserMaxUp")=clng(UserMaxUp)
Rs("UserType")=CBool(Request.Form("UserType"))
Rs.UpDate
Rs.close
Set Rs=nothing
CloseDatabase()
Response.Write("<script language=JavaScript>alert('用戶添加成功!');document.location.href='Index.asp';</script>")
End if
Response.End
End If
If Request.QueryString("Action")="del" Then
If ChkPost=false Then
Response.Write("<script language=JavaScript>alert('請不要重外部提交信息!');document.location.href='index.asp';</script>")
Response.End
End If
Dim Id,objFSO
Id= trim(request.QueryString("id"))
if id="" Then
Response.write"參數丟失!"
Elseif not isnumeric(id) Then
response.Write("參數類型錯誤!")
else
Sql="Select * From Files where id="&clng(id)
set Rs=server.CreateObject("adodb.recordset")
If Not IsObject(Conn) Then ConnectionDatabase()
Rs.open sql,conn,1,3
if rs.eof then
Rs.close
Set Rs=nothing
CloseDatabase()
Response.Write("<script language=JavaScript>alert('文件不存在!');document.location.href='javascript:window.history.go(-1);';</script>")
Response.End
else
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if objfso.FileExists(Server.MapPath("UpLoadFile/"&rs("FileUrl"))) then
objFSO.DeleteFile(Server.MapPath("UpLoadFile/"&rs("FileUrl")))
end if
Set objFSO =nothing
Conn.Execute("Update Users set UpFiles=UpFiles+1 Where UserId='"&rs("UserId"))&"'"
Rs.delete
rs.close
set rs=nothing
CloseDatabase()
Response.Write("<script language=JavaScript>alert('刪除成功!');document.location.href='index.asp';</script>")
End if
End if
Response.End
End if
%>
<%Call Top("添加用戶","Admin.asp")%>
<TABLE style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid"
cellSpacing=0 cellPadding=0 width=778 align=center bgColor=#f7f7f7 border=0>
<TBODY>
<TR>
<TD vAlign=top width=220>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR>
<TD
background=images/side_bg_r1_c1.gif
height=34>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=10></TD>
<TD width=20><IMG height=14
src="images/ico_015.gif"
width=13 border=0></TD>
<TD width=100>用戶登陸</TD>
<TD width=85></TD>
<TD width=5></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD
background=images/side_bg_r2_c1.gif>
<TABLE cellSpacing=0 cellPadding=0 width=200 align=center
border=0><TBODY>
<TR>
<TD align="center">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="34%" align="right">歡 迎 您:</td>
<td width="66%"><%=Session("UserName")%></td>
</tr>
<tr>
<td align="right">登陸次數:</td>
<td><b><%=Session("UserLogins")%></b></td>
</tr>
<tr>
<td align="right">上傳課件:</td>
<td><font color=red>
<%If Not IsObject(Conn) Then ConnectionDatabase()%>
<%=Conn.execute("Select UpFiles from Users Where UserId='"&Session("UserId")&"'")(0)%>
</font>個</td>
</tr>
<tr>
<td align="right">相關操作:</td>
<td><a href="UpLoad.asp"><font color=red>上傳課件</font></a>
<a href="Edit.asp?ID=<%=Session("UserId")%>">修改資料</a>
<%If Session("UserAdmin") Then Response.Write"<a href=Admin.asp>添加用戶</a>"%>
</td>
</tr>
<tr>
<td height="3" colspan="2"></td>
</tr>
<tr>
<td></td>
<td align="right"><input name="Logout" type="button" id="Logout" value="退出" onClick="location.href='Login.asp?action=logout'"> </td>
</tr>
</table>
</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD
background=images/side_bg_r3_c1.gif
height=4></TD></TR></TBODY></TABLE>
</TD>
<TD width=1 bgColor=#b4b4b4></TD>
<TD width=1 bgColor=#ffffff></TD>
<TD width=1></TD>
<TD vAlign=top width=553>
<TABLE cellSpacing=0 cellPadding=0 width=553 align=center border=0>
<TBODY>
<TR>
<TD width=2 rowSpan=2></TD>
<TD width=548>
<TABLE cellSpacing=0 cellPadding=0 width=548 border=0>
<TBODY>
<TR>
<TD width=120
background=images/ad_title.gif
height=30>
<TABLE cellSpacing=0 cellPadding=0 width=120 border=0>
<TBODY>
<TR>
<TD colSpan=2 height=6></TD></TR>
<TR>
<TD width=10></TD>
<TD noWrap>▍添加用戶</TD>
</TR>
<TR>
<TD colSpan=2 height=0></TD></TR></TBODY></TABLE></TD>
<TD align=middle width=428
background=images/ad_title_bg.gif
height=30></TD>
</TR></TBODY></TABLE></TD>
<TD width=3 rowSpan=2></TD></TR>
<TR>
<TD width=548>
<TABLE cellSpacing=0 cellPadding=0 width=548 border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width=548 border=0>
<TBODY>
<TR>
<TD width=1 bgColor=#d4d4d4></TD>
<TD width=1 bgColor=#ffffff></TD>
<TD valign=top width=544 height=100>
<form id="form2" name="form2" method="post" action="?Action=add">
<table width="90%" border="0" cellspacing="2" cellpadding="5">
<tr>
<td width="24%" align="right">用戶ID:</td>
<td width="76%"><label>
<input name="UserId" type="text" id="UserId" size="20" maxlength="20" style="height:20px;width:160px"/>
</label></td>
</tr>
<tr>
<td align="right">用戶名:</td>
<td><label>
<input name="UserName" type="text" id="UserName" size="20" maxlength="20" style="height:20px;width:160px"/>
</label></td>
</tr>
<tr>
<td align="right">密 碼:</td>
<td><label>
<input name="UserPwd" type="password" id="UserPwd" size="20" maxlength="20" style="height:20px;width:160px" />
</label></td>
</tr>
<tr>
<td align="right">性 別:</td>
<td><label>
<input name="UserSex" type="radio" value="True" checked="checked" />
男
<input type="radio" name="UserSex" value="False" />
女</label></td>
</tr>
<tr>
<td align="right">文 件:</td>
<td><input name="UserMaxUp" type="text" id="UserMaxUp" value="0" size="5" maxlength="10" />
KB 允許上傳文件大小,為0不允許上傳</td>
</tr>
<tr>
<td align="right">類 型:</td>
<td><label>
<input name="UserType" type="checkbox" id="UserType" value="True" />
是否管理員</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="Submit" value="添加" />
</label></td>
</tr>
</table>
</form>
</TD>
<TD width=1 bgColor=#ffffff></TD>
<TD width=1 bgColor=#d4d4d4></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width=548 border=0>
<TBODY>
<TR>
<TD width=1 bgColor=#d4d4d4></TD>
<TD bgColor=#ffffff height=1></TD>
<TD width=1 bgColor=#d4d4d4></TD></TR>
<TR>
<TD bgColor=#d4d4d4 colSpan=3
height=1></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE
style="BORDER-TOP-WIDTH: 1px; BORDER-RIGHT: #c0c0c0 1px solid; BORDER-BOTTOM-WIDTH: 1px; BORDER-LEFT: #c0c0c0 1px solid"
cellSpacing=0 cellPadding=0 width=778 align=center bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD bgColor=#dbe2e8 height=1></TD></TR>
<TR>
<TD bgColor=#ffffff height=1></TD></TR>
<TR>
<TD bgColor=#c5cfd9 height=1></TD></TR>
<TR>
<TD bgColor=#dbe2e8 height=1></TD></TR></TBODY></TABLE>
<%Call Bottom()%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -