?? savenewuser.asp
字號:
<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<!--#include file="conn.inc"-->
<!-- #include file="inc/char.inc" -->
<%
dim UserName ' len is 50
dim UserEmail ' len is 255
dim UserPassword ' len is 50
dim UserPassword1
dim ErrorMsg(1)
dim ErrMsg
dim FoundError
FoundError=false
if iis3onchsys=true then
UserName=HTMLCharacter(trim(request("name")))
UserEmail=HTMLCharacter(trim(request("email")))
UserPassword=HTMLCharacter(request("passwd"))
UserPassword1=HTMLCharacter(request("passwd1"))
else
UserName=trim(request("name"))
UserEmail=trim(request("email"))
UserPassword=request("passwd")
UserPassword1=request("passwd1")
end if
if UserName="" then
foundError=true
ErrOrMsg(0)="姓名不能為空!"
elseif Len(UserName)>50 then
FoundError=true
ErrorMsg(0)="姓名的長度不能超過50"
end if
if UserPassword="" then
FoundError=True
ErrorMsg(1)="口令不能為空!"
elseif len(UserPassword)>50 then
FoundError=True
ErrorMsg(1)="口令的長度不能大于50!"
elseif UserPassword<>UserPassword1 then
FoundError=true
ErrorMsg(1)="兩次輸入的口令不符!"
end if
ErrMsg=ErrorMsg(0) +"<BR>"+ErrorMsg(1)
response.write "<html>" +chr(13)+chr(10)
response.write "<head>"+chr(13)+chr(10)
response.write "<meta NAME='GENERATOR' Content='Microsoft FrontPage 3.0'>"+chr(13)+chr(10)
response.write "<meta HTTP-EQUIV='Content-Type' content='text/html; charset=gb_2312-80'>"+chr(13)+chr(10)
response.write "<META HTTP-EQUIV='Expires' CONTENT='0'>"+chr(13)+chr(10)
response.write "<link rel='stylesheet' type='text/css' href='forum.css'>"
response.write "<title>演說家登錄</title>"+chr(13)+chr(10)
response.write "</head>"+chr(13)+chr(10)
response.write "<body >"+chr(13)+chr(10)
if FoundError=True then
response.write "<font color='red'><strong><Big>輸入錯誤:</big></strong></font><BR><font color='#0000FF'>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
response.write "<form method='POST' name='frmNewUser' action='SaveNewUser.asp'> " +chr(13)+chr(10)
response.write "<p><font face='楷體_GB2312' color='#FF0000'><big><big>演說家登錄</big></big></font></p>"+chr(13)+chr(10)
response.write "<p>姓名: <input name='name' size='16' value='"
display username
response.write "'> <br>"+chr(13)+chr(10)
response.write "E-Mail: <br>"+chr(13)+chr(10)
response.write "<input name='email' size='40' value='"
display UserEmail
response.write "'><br>"+chr(13)+chr(10)
response.write "你的密碼: <input name='passwd' size='10' type='password' value><br>"+chr(13)+chr(10)
response.write "密碼校驗: <input name='passwd1' size='10' type='password' value><br>"+chr(13)+chr(10)
response.write "<input type='submit' value='發 送' name='B1'> <input type='reset' value='清 除'"+chr(13)+chr(10)
response.write "name='B2'></p>"+chr(13)+chr(10)
response.write "</form>"+chr(13)+chr(10)
else
dim rs
dim sql
set rs=server.createobject("adodb.recordset")
sql="select * from User"
rs.open sql,conn,1,1
dim FoundUser
FoundUser=false
do while not rs.eof
if ucase(rs("UserName"))=ucase(Trim(UserName)) then
FoundUser=True
exit do
end if
rs.movenext
loop
rs.close
if foundUser=true then
FoundError=True
ErrMsg="您指定的姓名已經被別人使用了,請嘗試使用別的名字"
response.write "<font color='red'><strong><Big>輸入錯誤:</big></strong></font><BR><font color='#0000FF'>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
response.write "<form method='POST' name='frmNewUser' action='SaveNewUser.asp'>"+chr(13)+chr(10)
response.write "<p><font face='楷體_GB2312' color='#FF0000'><big><big>演說家登錄</big></big></font></p>"+chr(13)+chr(10)
response.write "<p>姓名: <input name='name' size='16' value='"
display username
response.write "'> <br>"+chr(13)+chr(10)
response.write "E-Mail: <br>"+chr(13)+chr(10)
response.write "<input name='email' size='40' value='"
display useremail
response.write "'><br>"+chr(13)+chr(10)
response.write "你的密碼: <input name='passwd' size='10' type='password' value><br>"+chr(13)+chr(10)
response.write "密碼校驗: <input name='passwd1' size='10' type='password' value><br>"+chr(13)+chr(10)
response.write "<input type='submit' value='發 送' name='B1'> <input type='reset' value='清 除'"+chr(13)+chr(10)
response.write "name='B2'></p>"+chr(13)+chr(10)
response.write "</form>"+chr(13)+chr(10)
else
dim cmdTemp
dim InsertCursor
dim dataconn
Set DataConn = Server.CreateObject("ADODB.Connection")
'set conn=server.createobject("ADODB.CONNECTION")
dataconn.open connstr
'DataConn.ConnectionTimeout = Session("DataConn_ConnectionTimeout")
'DataConn.CommandTimeout = Session("DataConn_CommandTimeout")
'DataConn.Open Session("DataConn_ConnectionString"), Session("DataConn_RuntimeUserName"), Session("DataConn_RuntimePassword")
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT *, UserName FROM User WHERE (UserName IS NULL)"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = dataConn
InsertCursor.Open cmdTemp, , 1, 3
InsertCursor.AddNew
InsertCursor("UserName") = UserName
InsertCursor("UserEmail") =UserEmail
InsertCursor("UserPassword") = UserPassword
InsertCursor.Update
if not err then
response.write "<font color='red'><strong><Big>登錄成功</big></strong></font><BR>"+chr(13)+chr(10)
response.write "<font color='#0000FF'>"
if pwsonchsys then
ShowBody(username)
else
showbody(Server.HTMLEncode(username))
end if
sendMailToSiteMaster(UserName)
response.write " 您已經成為超聯接論壇的一員了!請經常光顧這里,暢所欲言。</font><BR>"+chr(13)+chr(10)
else
err.clear
ErrMsg="數據庫操作失敗,請以后再試"
response.write "<font color='red'><strong><Big>輸入錯誤:</big></strong></font><BR><font color='#0000FF'>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
response.write "<form method='POST' name='frmNewUser' action='SaveNewUser.asp'>"+chr(13)+chr(10)
response.write "<p><font face='楷體_GB2312' color='#FF0000'><big><big>演說家登錄</big></big></font></p>"+chr(13)+chr(10)
response.write "<p>姓名: <input name='name' size='16' value='"
display username
response.write "'> <br>"+chr(13)+chr(10)
response.write "E-Mail: <br>"+chr(13)+chr(10)
response.write "<input name='email' size='40' value='"
display useremail
response.write "'><br>"+chr(13)+chr(10)
response.write "你的密碼: <input name='passwd' size='10' type='password' value><br>"+chr(13)+chr(10)
response.write "密碼校驗: <input name='passwd1' size='10' type='password' value><br>"+chr(13)+chr(10)
response.write "<input type='submit' value='發 送' name='B1'> <input type='reset' value='清 除'"+chr(13)+chr(10)
response.write "name='B2'></p>"+chr(13)+chr(10)
response.write "</form>"+chr(13)+chr(10)
end if
InsertCursor.close
dataconn.close
end if
end if
response.write "</body>"+chr(13)+chr(10)
response.write "</html>"+chr(13)+chr(10)
%>
<%
' .---.
' / 6_6
' \_ (__\
' // \\
' (( ))
' +-----------------------------------""---""--+
' | Hi, I'm flybird. ||| |
' | Have u visited my home? | |
' | It is flybird-home.yeah.net. |
' | Or members.xoom.com/FlyingBird |
' | Updated each week with much ASP knowledge. |
' | And at there a forum is greeting u. |
' | I'm on ICQ line all day. |
' | This is the number: 9403176 |
' | I'm waiting for your call. |
' +--------------------------------------------+
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -