editdel.asp
来自「simulink建模及动态仿真这本书上的例题的代码」· ASP 代码 · 共 102 行
ASP
102 行
<!--#include file="../../forum/admin/common-admin.asp"-->
<%
call secure_general()
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
'option explicit
dim useraction
dim id,sql_c,sOne,sZero,secure
dim username,password,forumname
id=request("id")
useraction=request("action")
call connect()
select case useraction
case "update"
id=request.form("id")
username=request.form("username")
password=request.form("password")
forumname=request.form("topic")
secure = 0
sql_c="select forumname,username,password,issecure from myforums where( forumname='"&forumname&"' or password='"& password & "' ) and forumid<>"&id&""
set rs = conn.execute(sql_c)
if rs.eof and rs.bof then
sql = "update myforums SET forumname='"&forumname&"',username='"&username&"',password='"&password&"',isSecure="&secure&" where forumid="&id
'response.write sql'***debug
conn.execute(sql)
response.redirect "main.asp"
else
response.write "<script>alert('Use other username/password');location.href='main.asp';</script>"
end if
conn.close
set conn = nothing
case "del"
sql = "delete from myforums where forumid="&id
conn.execute(sql)
conn.close
set conn = nothing
response.redirect "main.asp"
case "edit"
sql = "select * from myforums where forumid="&id
set rs = conn.execute(sql)
username=rs("username")
password=rs("password")
forumname=rs("forumname")
secure = rs("issecure")
if secure="0" then
sOne=""
sZero="checked"
else
sOne="checked"
sZero=""
end if
conn.close
set conn = nothing
%>
<html>
<head>
<title>add</title>
</head>
<body align=center>
<table border=0 width=400 align=center>
<tr align=right><td colspan=2>
<!--list of forumname,username,password+edit/del--->
Type forum topic and Username/Password to manage it</tr>
<td width="106">
<form action="../../forum/admin/editdel.asp?action=update" method="post">
<input type=hidden name=id value='<%=id%>'>
<tr align=right>
<td width="106">username </td>
<td width="284">
<input type="text" name="username" size="25" value='<%=password%>' maxlength="10"></tr>
<td width="106">
<tr align=right>
<td width="106">Password </td>
<td width="284">
<input type="text" name="password" size="25" value='<%=password%>' maxlength="10"></tr>
<td width="106">
<tr align=right>
<td width="106">Forum Topic </td>
<td width="284">
<input type="text" name="topic" size="25" maxlength="50" value='<%=forumname%>'></tr>
<td width="106">
<tr align=right><td colspan=2 align=center>
<input type="submit" name="submit"> <input type="Reset">
</form>
</table>
<%end select%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?