📄 index.asp
字号:
<%
Option Explicit '强制声明变量
Response.Buffer=True
dim useragent,conn,connstr,rs,sql,name,pwd,newuser
useragent=Trim(Lcase(Request.Servervariables("HTTP_USER_AGENT"))) '得到当前系统信息
if InStr(useragent,"teleport")>0 or InStr(useragent,"webzip")>0 or InStr(useragent,"flashget")>0 or InStr(useragent,"offline")>0 Then
response.write "<script language=javascript>{window.alert('请不要用非法手段下载本程序!');window.close();}</script>"
response.end
end if
on error resume Next '有错误出现就跳过
set conn=server.createobject("adodb.connection") '连接数据库
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("dachat.asp")
conn.open connstr
'包含常量文件%>
<!--#include file=md5.asp -->
<%
if session("netname")="" then
if request("action")="chk" then
name=trim(request("name"))
pwd=MD5(trim(request("pwd")))
newuser=trim(request("newuser"))
if name="" or trim(request("pwd"))="" Then '判断用户名和密码是否为空
response.write "<script language=javascript>{window.alert('对不起,用户名或密码不能为空!');window.history.go(-1);}</script>"
response.end
end if
if len(name)>10 or len(trim(request("pwd")))>10 Then '判断用户名和密码的长度
response.write "<script language=javascript>{window.alert('用户名或密码的长度不能超过10!');window.history.go(-1);}</script>"
response.end
end if
if newuser="nuser" Then '判断新用户注册的用户名是否存在
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,admin) values('"&name&"','"&pwd&"',False)"
conn.execute(sql)
session("netname")=name '建立Session
end if
Else '判断已经存在的用户及密码是否正确
set rs=conn.execute("select name,pwd,admin from [user] where name='"&name&"' and pwd='"&pwd&"'")
if rs.eof and rs.bof then
response.write "<script language=javascript>{window.alert('用户名或密码错误!');window.history.go(-1);}</script>"
response.end
else
if rs(2)=True then '判断是否为管理员用户
session("chatadmin")=True
end if
session("netname")=rs(0)
end if
end if
rs.close
set rs=nothing
response.write "<script language=javascript>{window.location='index.asp';}</script>"
response.end
end if
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>毒爱聊天室--登陆</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
.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}
</style>
<script language="JavaScript">
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;
}
</script>
</head>
<body bgcolor=#ffffff topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>
<center>
<table width=410 border=0 height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<table width=410 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=151 height=45><img src="images/cen101.jpg" width=151 height=45></td>
<td width=223><img src="images/cen102.jpg" width=223 height=45></td>
<td width=36><img src="images/cen103.jpg" width=36 height=45></td>
</tr>
<tr>
<td height=83><img src="images/cen201.jpg" width=151 height=83></td>
<form action="index.asp?action=chk" method="post" onSubmit="return checkform()" name="login">
<td background="images/cen202.jpg" class="setwhite">
<table width=100% border=0 cellpadding=0 cellspacing=0 height=100%>
<tr><td align=center>
<font color="#ffffff">用户名称:</font><input name="name" size="15" class="input1" maxlength="10">
</td></tr>
<tr><td align=center>
<font color="#ffffff">用户密码:</font><input type="password" name="pwd" size="15" class="input1" maxlength="10">
</td></tr>
<tr><td align=center>
<input type="submit" style="CURSOR:hand" class="p9" value="登 陆">
<input type="radio" name="newuser" value="nuser" id="1"> <label for="1"><font color="#ffffff">新会员注册</font></label>
</td></tr>
</table>
</td>
</form>
<td><img src="images/cen203.jpg" width=36 height=83></td>
</tr>
<tr>
<td height=35><img src="images/cen301.jpg" width=151 height=35></td>
<td><img src="images/cen302.jpg" width=223 height=35></td>
<td><img src="images/cen303.jpg" width=36 height=35></td>
</tr>
</table>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<tr><td height=20><br></td></tr>
<tr><td height=20 align=center>Copyright © 2003 毒爱聊天室 V1.0。<br></td></tr>
<tr><td height=20 align=center><font color="#ff0000">注意:如果你尚未注册请勾选新会员注册,系统将自动注册。</font></td></tr>
</table>
</td>
</tr>
</table>
</center>
</body>
</html>
<%
else
response.write "<script language=javascript>{window.open('chat.asp','_blank','width=780,height=520,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
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -