?? index.asp
字號:
<!--#include file="config.asp"-->
<!--#include file="conn.asp"-->
<%
function existwords(s_string,s_fbdwords)
isexists=false
a_string=split(s_fbdwords," ")
n=ubound(a_string)
for i=0 to n
if trim(a_string(i))=s_string then
isexists=true
exit for
end if
next
existwords=isexists
end function
Function SplitWords(mys,coun)
dim ts,i,l
if isnull(mys) then exit Function
ts = 0
For i = 1 To Len(mys)
l = Mid(mys, i, 1)
If Asc(l) > 0 and Asc(l) < 255 Then
ts = ts + 1
End If
if i-ts/2 > coun then exit for
Next
If i-ts/2 > coun Then
ts=ts\2+coun
mys = left(mys,ts)
end if
SplitWords=mys
end Function
userid=request.form("userid")
if existwords(userid,forbidname)=true then
set rs=nothing
conn.close
set conn=nothing
response.write "<script language='javascript'>"&chr(13)
response.write "<!--"&chr(13)
response.write "alert('對不起,請重新選擇一個用戶名!');"&chr(13)
response.write "window.history.go(-1);"&chr(13)
response.write "//-->"&chr(13)
response.write "</script>"&chr(13)
elseif request.form("submit")="登陸" then
userid=request.form("userid")
password=request.form("password")
usersex=trim(request.form("usersex"))
if usersex<>"帥哥" and usersex<>"靚妹" then
usersex="神秘人"
end if
if userid="" or password="" then
response.write "<script language='javascript'>"&chr(13)
response.write "<!--"&chr(13)
response.write "alert('請將呢稱和密碼填寫完整!');"&chr(13)
response.write "window.history.go(-1);"&chr(13)
response.write "//-->"&chr(13)
response.write "</script>"&chr(13)
elseif trim(userid)<>userid or trim(password)<>password or instr(userid,"'")>0 or instr(userid,"""")>0 or instr(password,"'")>0 or instr(password,"""")>0 then
response.write "<script language='javascript'>"&chr(13)
response.write "<!--"&chr(13)
response.write "alert('用戶名和密碼中不得包含空格以及引號!');"&chr(13)
response.write "window.history.go(-1);"&chr(13)
response.write "//-->"&chr(13)
response.write "</script>"&chr(13)
else
userid=SplitWords(userid,5)
sql="select * from userinfo where userid='"&userid&"'"
rs.open sql,conn,0,3
if rs.bof and rs.eof then
session("loginstatus")="logined"
session("userid")=userid
session("grade")=1
rs.addnew
rs("userid")=userid
rs("password")=password
rs("usersex")=usersex
rs("regtime")=now()
rs("logintime")=now()
rs("timecount")=0
rs("userip")=userip
rs("logincount")=0
rs("grade")=1
rs("isonline")=true
rs.update
rs.close
sql="select top 1 * from chatinfo order by puttime asc"
rs.open sql,conn,0,3
rs("userid")=""
rs("sayto")=""
rs("saycontent")="歡迎新人<span class=usrname onclick=setobj('"&session("userid")&"')>"&session("userid")&"</span>來到本聊天室!"
rs("puttime")=now()
rs("ispublic")=true
rs.update
rs.close
response.redirect "chat.asp?ntime="&ntime
elseif rs("password")<>password then
rs.close
session("loginstatus")=""
session("userid")=""
session("grade")=""
response.write "<script language='javascript'>"&chr(13)
response.write "<!--"&chr(13)
response.write "alert('你輸入的密碼不正確\n\n或該用戶名已經(jīng)被注冊,\n\n請重新選擇用戶名!');"&chr(13)
response.write "window.history.go(-1);"&chr(13)
response.write "//-->"&chr(13)
response.write "</script>"&chr(13)
else
session("loginstatus")="logined"
session("userid")=userid
session("grade")=rs("grade")
n_vgrade=(rs("timecount")-30)\60
if n_vgrade>rs("grade") and n_vgrade<=maxgrade then
rs("grade")=n_vgrade
elseif n_vgrade>rs("grade") and n_vgrade>maxgrade then
rs("grade")=maxgrade
end if
rs("logintime")=now()
rs("userip")=userip
rs("logincount")=rs("logincount")+1
if isnull(rs("timecount")) then
rs("timecount")=0
end if
rs("isonline")=true
rs.update
rs.close
sql="select * from chatinfo order by puttime asc"
rs.open sql,conn,0,3
rs("userid")=""
rs("sayto")=""
rs("saycontent")="歡迎<span class=usrname onclick=setobj('"&session("userid")&"')>"&session("userid")&"</span>來到聊天室!"
rs("puttime")=now()
rs("ispublic")=true
rs.update
rs.close
response.redirect "chat.asp?ntime="&ntime
end if
end if
set rs=nothing
conn.close
set conn=nothing
else
%>
<html>
<head>
<title>歡迎光臨<%=pagetitle%></title>
<meta http-equiv=Content-Language content=zh-cn>
<style type="text/css">
<!--
input,body,table{font-size:12px}
table{width:280px}
table table{width:100%}
form{margin:0;padding:0}
a{color:#000090;text-decoration:none}
a:hover{color:#ff3333;text-decoration:underline}
.awhite{color:#ffffff}
.awhite a{color:#ffffff;text-decoration:none;font-weight:500}
-->
</style>
<script language="javascript">
<!--
function issubmit(o_element,maxlen)
{
if (wordslen(o_element.value)>maxlen)
{
o_element.select();
alert("用戶名最大長度為:"+maxlen/2+"個中文字符,或"+maxlen+"個字母!\n\n超出部分將會被自動截掉!");
return false;
}
else
{
return true;
}
}
//-->
</script>
<script language="vbscript">
<!--
Function Wordslen(mys)
dim ts,i,l
if isnull(mys) then
wordslen=0
exit Function
end if
ts = 0
For i = 1 To Len(mys)
l = Mid(mys, i, 1)
If Asc(l) > 0 and Asc(l) < 255 Then
ts = ts + 1
else
ts = ts + 2
End If
Next
Wordslen=ts
end Function
//-->
</script>
</head>
<body topmargin=150 background=images/bgbrick.gif>
<table border=1 align="center" cellpadding=0 cellspacing=0 style=border-collapse:collapse bordercolor=#111111 height=200>
<tr>
<td align=center class="awhite" style="background:#34aacd url(images/leadtop.gif);height:19px"><%=pagetitle%>--用戶登陸</td>
</tr>
<tr>
<td align=center height=162>
<form method=POST action="<%=request.servervariables("script_name")%>" onsubmit="return issubmit(document.forms[0].userid,10)">
<table border=0 cellpadding=0 cellspacing=0 style=border-collapse:collapse bordercolor=#111111 width=100% height=162 style="background:#e9e9e9">
<tr>
<td colspan="2" height=15></td>
</tr>
<tr>
<td width=37% height=35 align=center>用戶名</td>
<td width=63%><input type="text" name="userid" size=19 maxlength="10" style="font-size:12px;border-style:solid;border-width:1;padding-left:4;padding-right:4;padding-top:1;padding-bottom:1"></td>
</tr>
<tr>
<td height=35 align=center>密 碼</td>
<td><input type="password" name="password" size=19 maxlength="30" style=border-style:solid;border-width:1;padding-left:4;padding-right:4;padding-top:1;padding-bottom:1></td>
</tr>
<tr>
<td height=35 align=center>性 別</td>
<td><select name="usersex" style="width:132px;">
<option value="帥哥">帥哥
<option value="靚妹">靚妹
<option value="神秘人" selected>保密
</select>
</td>
</tr>
<tr>
<td height=26 colspan=2><p align=center><input type=submit value="登陸" name="submit" style="font-size:12px; height:21px; width:60px; color: #E0E0E0; background-color: #006898; border: 2 solid #3399FF" onMouseOver ="this.style.backgroundColor='#ff0000'" onMouseOut ="this.style.backgroundColor='#006898'"> <input type=reset value=重置 name=reset style="font-size:12px; height:21px; width:60px; color: #E0E0E0; background-color: #006898; border: 2 solid #3399FF" onMouseOver ="this.style.backgroundColor='#ff0000'" onMouseOut ="this.style.backgroundColor='#006898'"> <input type="button" onclick="window.location.href='../index.asp'" style="font-size:12px; height:21px; width:60px; color: #E0E0E0; background-color: #006898; border: 2 solid #3399FF" onMouseOver ="this.style.backgroundColor='#ff0000'" onMouseOut ="this.style.backgroundColor='#006898'" value="回首頁"></p></td>
</tr>
<tr>
<td colspan="2" height=15></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td align=center class="awhite" style="background:#34aacd url(images/leadbottom.gif);height:19px;"><a href="http://www.98062.com" target="_blank">本程序由 www.98062.com 提供</a></td>
</tr>
</table>
</body>
</html>
<%
end if
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -