我自己写的聊天室源代码(四)
发表于:2007-06-30来源:作者:点击数:
标签:
*********************用户注册*************************************** %‘’用户注册,userinsert.asp% %response.buffer = true% html head meta http-equiv=Content-Type content=text/html; charset=gb2312 title用户注册/title meta name=GENERATOR con
*********************用户注册***************************************
<%‘’用户注册,userinsert.asp%>
<%response.buffer = true%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用户注册</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<script language="
JavaScript"><!--
function dd(list)
{
var listtext="";
if ((list.selectedIndex != -1)&&(list.selectedIndex != 0))
listtext = list.options[list.selectedIndex].value;
document.forms[0].sex.value = listtext
return true;
}
function windowload()
{
document.forms[0].name.focus();
}
function formsubmit()
{
document.forms[0].submit();
}
function mm(text)
{
var aa=""
if (text==1)
aa=document.forms[0].name.value
if (text==2)
aa=document.forms[0].sex.value
if (text==3)
aa=document.forms[0].pass.value
if (text==4)
aa=document.forms[0].pass1.value
return aa;
}
function msg(text)
{
alert(text);
return;
}
// --></script>
<script language="
VBScript"><!--
function input(tt)
dim sc_name,sc_sex,sc_pass,sc_pass1,sc_flag
sc_flag = 0
‘’姓名
sc_name = ""
sc_name = trim(mm(1))
if sc_name = "" then
msg("必须输入:您的昵称")
sc_flag = 1
end if
sc_sex = ""
sc_sex = trim(mm(2))
if sc_sex = "" then
msg("必须输入:您的性别")
sc_flag = 1
end if
sc_pass = ""
sc_pass = mm(3)
if sc_pass = "" then
msg("必须输入:您的口令")
sc_flag = 1
end if
sc_pass1 = ""
sc_pass1 = mm(4)
if sc_pass1 = "" then
msg("必须输入:确认口令")
sc_flag = 1
end if
if sc_pass <> sc_pass1 then
msg("口令和确认口令不一致")
sc_flag = 1
end if
if sc_flag = 0 then
formsubmit()
else
windowload()
end if
end function
--></script>
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none">
</head>
<body onload="windowload();">
<form method="POST" action="insertusercl.asp">
<input type="hidden" name="flag" value=" "><table border="0" width="100%" cellspacing="0">
<tr>
<
td width="100%" align="right" colspan="2"><div align="center"><center><p><img
src="images/register.jpg" alt="register.jpg (6042 bytes)" WIDTH="355" HEIGHT="150"></td>
</tr>
<tr align="center">
<td width="50%" align="right">您的昵称:</td>
<td width="50%"><div align="left"><p><input type="text" name="name" size="20"
maxlength="20">(必须填写,不能有空格)</td>
</tr>
<tr align="center">
<td width="50%" align="right">您的性别:</td>
<td width="50%"><div align="left"><p><select name="D1" size="1" onchange="dd(this);">
<option selected value="自填 ">自填</option>
<option value="俊男">俊男</option>
<option value="美女">美女</option>
<option value="精灵">精灵</option>
<option value="野兽">野兽</option>
</select><input type="text" name="sex" size="12">(必须填写)</td>
</tr>
<tr align="center">
<td width="50%" align="right">您的口令:</td>
<td width="50%"><div align="left"><p><input type="text" name="pass" size="20">(必须填写)</td>
</tr>
<tr align="center">
<td width="50%" align="right">口令确认:</td>
<td width="50%"><div align="left"><p><input type="text" name="pass1" size="20">(必须填写)</td>
</tr>
<tr align="center">
<td width="50%" align="right">您的提示问题:</td>
<td width="50%"><div align="left"><p><input type="text" name="quesstion" size="20"></td>
</tr>
<tr align="center">
<td width="50%" align="right">提示问题答案:</td>
<td width="50%"><div align="left"><p><input type="text" name="answer" size="20"></td>
</tr>
<tr align="center">
<td width="50%" align="right">您的E_mail:</td>
<td width="50%"><div align="left"><p><input type="text" name="email" size="20"></td>
</tr>
<tr align="center">
<td width="50%" align="right"></td>
<td width="50%"></td>
</tr>
<tr align="center">
<td width="50%"><div align="right"><p><input type="button" value="填完了" name="B1"
language="
vbscript" onclick="input(this)"></td>
<td width="50%"><div align="left"><p><input type="reset" value="重新填" name="B2"></td>
</tr>
</table>
</form>
</body>
</html>
*******************************注册处理*********************************
<%‘’insertusercl.asp%>
<%response.buffer = true%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>注册处理</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none">
</head>
<%
dim sc_name,sc_sex,sc_pass,sc_quesstion,sc_answer,sc_email,sc_ip,sc_flag
sc_ip = request.servervariables("remote_addr")
sc_name = replace(trim(request.form("name")),"<","<")
sc_sex = replace(trim(request.form("sex")),"<","<")
sc_pass = request.form("pass")
sc_quesstion = request.form("quesstion")
sc_answer = request.form("answer")
sc_email = request.form("email")
set conn=server.createobject("adodb.connection")
conn.open "chat","chat","chat001"
sc_flag = 0
‘’账号存在
sql1 = "select * from user_info_table where user_name = ‘’" + sc_name + "‘’"
set rs=conn.execute(sql1)
if not rs.eof then
sc_flag = 1
end if
rs.close
‘’一台机器登录超过5个账号
sql1 = "select count(*) from user_info_table where user_ip = ‘’" + sc_ip +"‘’"
set rs=conn.execute(sql1)
if rs(0) >= 5 then
sc_flag =2
end if
rs.close
if sc_flag = 0 then
sql1 = "insert user_info_table values(‘’" + sc_name + "‘’,‘’" + sc_pass + "‘’,‘’" + sc_sex +"‘’,‘’" + sc_email +"‘’,‘’" + sc_quesstion + "‘’,‘’" + sc_answer + "‘’,‘’" + sc_ip +"‘’,2)"
set rs1 = conn.execute(sql1)
sql1 = "insert user_hello_table values(‘’" + sc_name +"‘’,‘’" + sc_name + "进来了‘’,‘’" + sc_name + "走了‘’)"
set rs1 = conn.execute(sql1)
end if
conn.close
select case sc_flag
case 0
response.redirect "insertuserok.asp"
case 1
response.redirect "insertuserin.asp"
case 2
response.redirect "insertuse
rup.asp"
end select
%>
<body>
</body>
</html>
*****************************注册成功**************************
<%‘’insertuserok.asp%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>注册成功</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none">
</head>
<body>
<p align="center"><img src="images/jxw_ok.gif" alt="jxw_ok.gif (2182 bytes)" WIDTH="120"
HEIGHT="145"><font face="隶书" color="#FF00FF"><big><big>注册成功!!请登录聊天室!</big></big></font></p>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan --><div
align="center"><center><p><input type="button" value="关闭" name="B1"
onclick="window.close();"></p>
</center></div>
</form>
</body>
</html>
*****************************账号已经存在******************************
<%‘’insertuserin.asp%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>账号已经存在</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<script language="JavaScript"><!--
function good()
{
location.href = "insertuser.asp";
}
function closewindow()
{
window.close();
}
// --></script>
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none">
</head>
<body>
<p align="center"><img src="images/jxw_fail.gif" width="120" height="145"
alt="jxw_fail.gif (2499 bytes)"><font face="隶书" color="#FF00FF"><big><big>账号已经存在!!换一个好吗?</big></big></font></p>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan --><div
align="center"><center><p><input type="button" value="好的" name="B1" onclick="good();"><input
type="button" value="不好" name="B2" onclick="closewindow();"></p>
</center></div>
</form>
</body>
</html>
*******************************超过上限*********************************
<%‘’insertuserup.asp%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>超过上限</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none">
</head>
<body>
<p align="center"><img src="images/jxw_fail.gif" alt="jxw_fail.gif (2499 bytes)"
WIDTH="120" HEIGHT="145"><font face="隶书" color="#FF00FF"><big><big>登录用户太多了!!</big></big></font></p>
<p align="center"><font face="隶书" color="#FF00FF"><big><big>一台机器可以登录<strong>
5</strong> 名用户</big></big></font></p>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" startspan U-File="_private/form_results.txt"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan --><div
align="center"><center><p><input type="button" value="知道了" name="B1"
onclick="window.close();"></p>
</center></div>
</form>
</body>
</html>
原文转自:http://www.ltesting.net