⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 聊天室工具
💻 ASP
字号:
<%Response.Buffer=True%>
<!--#include file="config.asp"-->
<!--#include file="conn.asp"-->
<!--#include file=md5.asp -->
<%
call erdown()
if session("netname")="" then
   if request("action")="chk" then
   call tjip()
   name=trim(request("name"))
   pwd=MD5(trim(request("pwd")))
   if name="" or trim(request("pwd"))="" then
     response.redirect "index.asp?error=1"
     response.end
   end if
   if len(name)>10 or len(trim(request("pwd")))>10 then
     response.redirect "index.asp?error=2"
     response.end
   end if
   set rs=conn.execute("select name,pwd,admin from [user] where name='"&name&"' and pwd='"&pwd&"'")
   if rs.eof and rs.bof then
     response.redirect "index.asp?error=3"
     response.end
   else
   conn.execute("update [user] set logintime=Now() where name='"&name&"'")
	 session("netname")=rs(0)
   if rs(2)=True then
	 session("chatadmin")=True
   end if
   chatmatname=split(mastername,"|")
   for i=0 to UBound(chatmatname)
   if session("netname")=chatmatname(i) then
      gjmaster=True
   end if
   next
   if gjmaster=True then
     session("chatadmin")=True
   end if
   end if
   rs.close
   set rs=nothing
      response.redirect "index.asp"
   end if
   
   if request("action")="reg" then
   call tjip()
   name=trim(request("name"))
   pwd=MD5(trim(request("pwd")))
   rpwd=MD5(trim(request("rpwd")))
   sex=trim(request("sex"))
   qq=trim(request("qq"))
   email=trim(request("email"))
   face=trim(request("face"))
   if name="" or trim(request("pwd"))="" or qq="" or email="" then
      response.write "<script language=javascript>{window.alert('请将资料填写完整!');window.history.go(-1);}</script>"
      response.end
   end if
   if len(name)<2 or len(name)>10 then
      response.write "<script language=javascript>{window.alert('用户名长度为2-10位!');window.history.go(-1);}</script>"
      response.end
   end if
   if pwd<>rpwd then
      response.write "<script language=javascript>{window.alert('两次密码不一致!');window.history.go(-1);}</script>"
      response.end
   end if
   if len(trim(request("pwd")))<4 or len(trim(request("pwd")))>10 then
      response.write "<script language=javascript>{window.alert('用户密码长度为4-10位!');window.history.go(-1);}</script>"
      response.end
   end if
   if len(qq)<4 or len(qq)>10 then
      response.write "<script language=javascript>{window.alert('QQ号码长度为4-10位!');window.history.go(-1);}</script>"
      response.end
   end if
   if not IsValidEmail(email) then
      response.write "<script language=javascript>{window.alert('E-mail地址错误!');window.history.go(-1);}</script>"
      response.end
   end if
  set rs=conn.execute("select name from [user] where name='"&name&"'")
  if not rs.eof and not rs.bof then
	response.write "<script language=javascript>{window.alert('对不起,此用户名已注册!');window.history.go(-1);}</script>"
	response.end
  else
	sql="insert into [user] (name,pwd,sex,qq,email,face,admin,regtime) values('"&name&"','"&pwd&"','"&sex&"','"&qq&"','"&email&"','"&face&"',False,Now())"
	conn.execute(sql)
	response.redirect "index.asp?reg=True"
  end if
  rs.close
  set rs=nothing
  end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>看吧听吧聊吧-<%=chatname%>--登陆</title>
<style>
td,input,select{font-family:宋体,arial; font-size:12px; color:#000000}
td.setwhite{color:#ffffff;line-height:150%}
A:link    { font-size:12px; text-decoration:none; color: #ffffff}
A:visited { font-size:12px; text-decoration:none; color: #ffffff}
A:hover   { font-size:12px; text-decoration:underline; color: #ffffff}
.input1 { BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 12px; BACKGROUND: #FFFFFF; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 18px}
.input2 { BORDER-RIGHT: #0099cc 1px solid; BORDER-TOP: #0099cc 1px solid; FONT-SIZE: 12px; BACKGROUND: #FFFFFF; BORDER-LEFT: #0099cc 1px solid; BORDER-BOTTOM: #0099cc 1px solid; HEIGHT: 18px}
.p9 { font-size:9pt;BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; HEIGHT: 18px; BACKGROUND-COLOR: #cccccc; BORDER-RIGHT-WIDTH: 1px}
body {
	background-image: url(200547121325856.jpg);
	background-color: #E6E6F2;
}
.style1 {color: #000000}
</style>
<script language="JavaScript">
var errtimeID = null;
function updatemsg(omsg,errtime)
{
	if (errtimeID==null){
		msgbox.innerHTML = "<font color=red>" + omsg + "</font>";
		errtimeID = setTimeout("updatemsg()",errtime);
	} else {
		clearTimeout(errtimeID);
		msgbox.innerHTML = "&nbsp;";
		errtimeID = null;
	}
}
function checkform()
{
if(document.login.name.value==""){
 window.alert("请输入您的用户名!");
 document.login.name.focus();
 return false ;
 }
if(document.login.pwd.value==""){
 window.alert("请输入您的密码!");
 document.login.pwd.focus();
 return false ;
 }
return true;
}
function isEmail(vEMail)
{
var regInvalid=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
var regValid=/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
return (!regInvalid.test(vEMail)&&regValid.test(vEMail));
}
function checkform1()
{
if(document.reg.name.value==""){
 window.alert("请输入您的用户名!");
 document.reg.name.focus();
 return false ;
 }
if(document.reg.name.value.length<2){
 window.alert("用户名长度在2-6位之间!");
 document.reg.name.focus();
 return false ;
 }
if(document.reg.pwd.value==""){
 window.alert("请输入您的密码!");
 document.reg.pwd.focus();
 return false ;
 }
if(document.reg.pwd.value.length<4){
 window.alert("用户密码长度在4-10位之间!");
 document.reg.pwd.focus();
 return false ;
 }
if(document.reg.rpwd.value==""){
 window.alert("请输入您的验证密码!");
 document.reg.rpwd.focus();
 return false ;
 }
if(document.reg.rpwd.value!=document.reg.pwd.value){
 window.alert("两次密码输入不一致!");
 document.reg.rpwd.focus();
 return false ;
 }
if(document.reg.rpwd.value==""){
 window.alert("请输入您的验证密码!");
 document.reg.rpwd.focus();
 return false ;
 }
if(document.reg.qq.value==""){
 window.alert("请输入您的QQ号码!");
 document.reg.qq.focus();
 return false ;
 }
if(document.reg.qq.value.length<4){
 window.alert("QQ号码长度在4-10位之间!");
 document.reg.qq.focus();
 return false ;
 }
if(document.reg.email.value==""){
 window.alert("请输入您的E-mail号码!");
 document.reg.email.focus();
 return false ;
 }
if(!isEmail(document.reg.email.value))
{
 window.alert("请输入正确的邮件格式!");			
 document.reg.email.focus();
 return false;
}
return true;
}
function select_radio(info)
{
cmp_displayc.style.display='none';
ind_displayc.style.display='none';
if(info=='注册')
{
cmp_displayc.style.display='';
}
if(info=='登陆')
{
ind_displayc.style.display='';
}
}
function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}
</script>
</head>
<body topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>
<center>
<table width=410 border=0 height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#0099cc" width="410" id="cmp_displayc" style="DISPLAY:none">
<form method="post" action="index.asp?action=reg" name="reg" onSubmit="return checkform1()">
<tr>  
<td bgcolor=#99ccff colspan=2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><img src="images/arrow.gif" width="13" height="13"> 新用户注册</td>
<td width="100" align="right"><input type="radio" name="new" onclick="javascript:select_radio('登陆')" id="1"> <label for="1"><span style="CURSOR:hand">登 陆</span></label>
</td>
</tr>
</table>
</td>
</tr>
<TR>
<TR bgcolor="#f2f8ff">
<TD width="20%" align=right><font color=red>*</font>用 户 名:</TD>
<TD width="80%"><input name="name" class="input2" maxlength="10" onBlur="this.value=ignoreSpaces(this.value);">  用户名长度2-10位</TD>
</TR>
<TR bgcolor="#f2f8ff">
<TD width="20%" align=right><font color=red>*</font>用户密码:</TD>
<TD width="80%"><input type="password" name="pwd" class="input2" maxlength="10" onBlur="this.value=ignoreSpaces(this.value);">  用户密码长度4-10位</TD>
</TR>
<TR bgcolor="#f2f8ff">
<TD width="20%" align=right><font color=red>*</font>确认密码:</TD>
<TD width="80%"><input type="password" name="rpwd" class="input2" maxlength="10" onBlur="this.value=ignoreSpaces(this.value);"></TD>
</TR>
<TR bgcolor="#f2f8ff">
<TD width="20%" align=right><font color=red>*</font>性 别:</TD>
<TD width="80%">
<input type="radio" name="sex" value="男" checked id="2"> <label for="2">男</label> 
<input type="radio" name="sex" value="女" id="3"> <label for="3">女</label>
</TD>
</TR>
<TR bgcolor="#f2f8ff">
<TD align=right width="20%"><font color=red>*</font>QQ号码:</TD>
<TD width="80%"><input name="qq" class="input2" maxlength="10" onBlur="this.value=ignoreSpaces(this.value);" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;">  QQ号码长度4-10位</TD>
</TR>
<TR bgcolor="#f2f8ff"> 
<TD align=right width="20%"><font color=red>*</font>E-mail:</TD>
<TD width="80%"><input name="email" class="input2" maxlength="30" onBlur="this.value=ignoreSpaces(this.value);"></TD>
</TR>
<TR bgcolor="#f2f8ff"> 
<TD align=right width="20%">头 像:</TD>
<TD width="80%">
<select name="face" onChange="document.images['face'].src=options[selectedIndex].value;">
<%for i=1 to 35
facestr="face/"&i&".gif"
Response.Write "<option value='"&facestr&"'>头像" &i &"</option>"
next%>
</select>
<img id=face src="face/1.gif">
<a href="allface.asp" target="_blank"><font color="#000000">查看头像列表</font></a>
</TD>
</TR>
<TR bgcolor="#f2f8ff"> 
<TD colSpan=2 height="31" align=middle> 
<input type="submit" value="提  交" style="CURSOR: hand" class="p9">
&nbsp;&nbsp;&nbsp;&nbsp; 
<input type="reset" value="重  填" style="CURSOR: hand" class="p9">
</TD>
</TR></FORM></TABLE>
<table width=410 border=0 cellpadding=0 cellspacing=0 id="ind_displayc" style="DISPLAY:">
<tr>
<td width=151 height=45>&nbsp;</td>
<td width=223 bgcolor="#66CCCC"> 
  <span class="style1">在线列表</span>
<%
online=Application("onlinelist")
online=split(online," ")
%>
<select>
<option>当前共有<%if ubound(online)<0 then%><%=ubound(online)+1%><%else%><%=ubound(online)%><%end if%>人在线</option>
<%for i=lbound(online) to ubound(online)-1%>
<option><%=online(i)%></option>
<%next%>
</select>
</td>
<td width=36>&nbsp;</td>
</tr>
<tr>
<td height=83>&nbsp;</td>
<form action="index.asp?action=chk" method="post" onSubmit="return checkform()" name="login">
<td bgcolor="#E7E7E7" class="setwhite">
<table width=100% border=0 cellpadding=0 cellspacing=0 height=100%>
<tr><td align=center bgcolor="#E7E7E7">
  <span class="style1">用 户 名:</span>
  <input name="name" size="15" class="input1" maxlength="10" onBlur="this.value=ignoreSpaces(this.value);">
</td>
</tr>
<tr><td align=center bgcolor="#E7E7E7">
  <span class="style1">用户密码:</span>
  <input type="password" name="pwd" size="15" class="input1" maxlength="10" onBlur="this.value=ignoreSpaces(this.value);">
</td>
</tr>
<tr><td align=center bgcolor="#E7E7E7">
<input type="submit" style="CURSOR:hand" class="p9" value="登  陆">  
<input type="radio" name="new" onclick="javascript:select_radio('注册')" id="0">
<span class="style1">
<label for="0">新会员注册</label>
</span> </td>
</tr>
</table>
</td>
</form>
<td>&nbsp;</td>
</tr>
<tr>
<td height=35>&nbsp;</td>
<%
set rs=conn.execute("select count(*) from [user]")
count=rs(0)
rs.close
set rs=nothing
%>
<td bgcolor="#66CCCC"><span class="style1"> 
    共有注册人数11<%=count%>位</span></td>
<td>&nbsp;</td>
</tr>
</table>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<tr><td height=30 align=center><div id="msgbox"></div></td></tr>
<tr>
  <td height=20 align=center>Copyright &copy 2006  Powered By:<%=copy%> <a href="http://www.haoiis.com" target="_blank">免费空间由上海豪网提供</a></td>
</tr>
<tr><td height=20><br></td></tr>
</table>
</td>
</tr>
</table>
</center>
<script language="javascript">
<%if request("error")=1 then%>
var errmsg = "对不起,用户名或密码不能为空!";
<%elseif request("error")=2 then%>
var errmsg = "用户名或密码的长度不能超过10!";
<%elseif request("error")=3 then%>
var errmsg = "用户名或密码错误!";
<%elseif request("reg")="True" then%>
var errmsg = "恭喜您,注册成功!";
<%else%>
var errmsg = "&nbsp;";
<%end if%>
if (errmsg && errmsg!="") updatemsg(errmsg,3000);
</script>
</body>
</html>
<%
else
   response.write "<script language=javascript>{window.open('chat.asp','_blank','width=1000,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,menu=no,min=no,max=no');}</script>"
   response.end
end if
conn.close
set conn=nothing
%>
 <script src="http://www.haoiis.com/js/ad-01.js" language="JavaScript"></script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -