📄 addnewt.asp
字号:
<!--#include file="include.asp"-->
<%
if not session("log2") then response.redirect "login.asp"
if request.form("submit")<>empty then call add_user()
%>
<html>
<head>
<title>加入新用户</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-size: 9pt}
input { font-size: 9pt}
.button { font-size: 9pt; color: #FFFFFF; background-color: #000000}
-->
</style>
</head>
<body bgcolor="#6A4F9A" text="#FFFFFF">
<div align="center">
<form method="post" action="addnewt.asp" name="form01">
<p> </p>
<table width="372" border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="2">
<tr bgcolor="#CCCCCC">
<td colspan="2" align="center" height="28"><font color="#FFFFFF"><font color="#000000">加
入 新 用 户 及 初 始 化 设 置</font></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="102" align="right"><font color="#000000">用户名称:</font></td>
<td width="256">
<input type="text" name="user" size="30" maxlength="30">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="102" align="right"><font color="#000000">密码:</font></td>
<td width="256">
<input type="text" name="pass" size="30" maxlength="30">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="102" align="right"><font color="#000000">用户代号:</font></td>
<td width="256">
<input type="text" name="userid" size="30" maxlength="100">
</td>
</tr>
<tr bgcolor="#FFFFFF" align="center">
<td height="47">
<div align="right"><font color="#000000">用户说明:</font></div>
</td>
<td height="47">
<div align="left">
<input type="text" name="memo" size="30" maxlength="100">
</div>
</td>
</tr>
<tr bgcolor="#FFFFFF" align="center">
<td colspan="2" height="47">
<input type="submit" name="Submit" value="确定" class="button">
<input type="reset" name="reset" value="重输" class="button">
<input type="button" name="Submit2" value="关闭" class="button" onClick="javascript:window.close()">
</td>
</tr>
</table>
<br>
</form>
<p> </p>
</div>
</body>
<%
conn.close()
set conn=nothing
%>
</html>
<%
function add_user()
dim user,userid,pass,smemo
dim error,err_msg,back,fullpath
dim sql,rs
error=0
user=trim(request.form("user"))
pass=trim(request.form("pass"))
memo=trim(request.form("memo"))
userid=trim(request.form("userid"))
if userid=empty then error=2
if user=empty then error=3
if pass=empty then error=1
if memo=empty then count=4
if error<>0 then
back="<a href='javascript:history.back()'>返回</a>"
select case error
case 1
err_msg="用户密码不能为空!"&back
case 2
err_msg="用户代号不能为空!"&back
case 3
err_msg="用户名称不能为空!"&back
case 4
err_msg="用户说明不能为空!"&back
end select
response.write err_msg
conn.close()
set conn=nothing
response.end
else
sql="select * from user where username='"&user&"' or ucode='"&userid&"'"
set rs=conn.execute(sql)
if not rs.eof then
response.write "用户名或用户代码已存在,请选择其它用户名!【<a href='javascript:history.back()'>返回</a>】"
rs.close()
conn.close()
set rs=nothing
set conn=nothing
response.end
end if
sql="insert into user (userid,username,ucode,password,memo) values ('"&session("ucode")&"','"&user&"','"&userid&"','"&pass&"','"&memo&"')"
conn.execute(sql)
response.write "加入新用户成功!!<p>"
conn.close()
set conn=nothing
response.end
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -