有效的asp代码(求ASP代码)

本文目录
求ASP代码
《!--脚本开始--》
《script type="text/javascript"》
function countDown(secs,surl){
//alert(surl);
if(--secs》0){
setTimeout("countDown("+secs+",’"+surl+"’)",1000);
}else{
history.go(-2);
}
}
《/script》
《!--脚本结束--》
asp部分
Response.write(《script》countDown(5,’phpinfo.php’);《/script》)
高分求ASP简单代码
set rs=server.createobject("adodb.recordset")
sql="select * from table1 where username=’我是sb’"
rs.open sql,conn,1,1
if rs.eof then
response.write("我不是sb")
else
response.write("我是sb")
end if
rs.close
set rs = nothing
求asp代码
这样操作.
index.asp内容如下:
*********************************************
《html》
《title》验证用户《/title》
《script language="JavaScript"》
var errfound = false;
function error(elem, text) {
if (errfound) return;
window.alert(text);
elem.select();
elem.focus();
errfound = true;
}
function loginCheck(f) {
errfound = false;
if (f.admin.value == "")
error(f.admin,"Please enter your user id!");
if (f.pwd.value == "")
error(f.pwd,"Please enter your password!");
return ! errfound;
}
《/script》
《body leftmargin=0 topmargin=0 marginheight=0 marginwidth=0》
《table width="750" height="26" border="0" align="center" cellpadding="0" cellspacing="0"》
《tr》
《td》《table width="242" height="106" border="0" align="center" cellpadding="2" cellspacing="0"》
《form action="login.asp" method="post" onSubmit="return loginCheck(this);"》
《tr》
《td align="left"》User ID《/td》
《td》《input name="admin" type="TEXT"size="20"》《/td》
《/tr》
《tr》
《td align="left"》Password《/td》
《td》《input name="pwd" TYPE="PASSWORD" size="10"》《/td》
《/tr》
《tr》
《td》 《/td》
《/tr》
《tr》
《td colspan="2"》《input type="submit" name="submit" value="Login"》《/td》
《tr》
《td height="30" colspan="2"》 《/td》
《tr》
《/form》
《/table》《/td》
《/tr》
《/table》
《/body》
《/html》
*********************************************
login.asp内容
*********************************************
《%
’数据库连接文件
Dim conn
Set conn=Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database.mdb")
%》
《%
Function Sqlstr(data)
sqlstr=Replace(data,"’","’’")
End Function
admin=sqlstr(request.form("admin"))
pwd=sqlstr(request.form("pwd"))
sql= "select admin,pwd from zhidao where admin=’"&admin&"’ and pwd=’"&pwd&"’"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
%》
《script language="javascript"》
alert("用户名或密码输入有误!!")
parent.location.href="index.asp"
《/script》
《%else
mysql="select admin,pwd,type from where admin=’"&admin&"’"
set rs=Server.CreateObject ("ADODB.RECORDSET")
rs.open mysql,conn,1,3
If rs.Eof Then
Response.Redirect("index.asp")
else
if rs("type")="1" then
Response.Redirect("m.asp")
else if rs("type")="2" then
Response.Redirect("n.asp")
else if rs("type")="3" then
Response.Redirect("r.asp")
end if
end if
end if
end if
end if
%》
*********************************************
数据库名称为database.mdb表段为zhida
不符合你的可以在login.asp中更改.测试可以使用.

更多文章:
python的源代码(python3.7idle如何测试源代码)
2026年9月5日 22:15
java文件中文乱码怎么解决(java 写入txt文件的中文乱码是怎么回事)
2025年6月12日 11:30
extent和extension的区别(“in some extent”和“to some extent”有什么区别)
2025年10月4日 13:30
statue law(简单点的旅游景点介绍英文 旅游英语介绍景点)
2026年3月17日 02:45
设置 form action(Form表单中的action后面怎么写才能访问到servlet,servlet如何配置已经晕了)
2025年10月15日 04:15
oracle数据库建表的完整步骤(新建Oracle数据库的3种方法)
2025年10月28日 05:15
delphi方法就是让专家在一起(什么是德尔菲技术有什么特点和优点)
2026年8月27日 15:30
intelligent名词形式(intelligent 名词)
2025年9月3日 19:00
linux查看python版本(Linux系统更改默认Python版本)
2026年4月7日 06:15
html焦点图(求助高手在Dreamweaver中怎么做焦点图)
2026年8月8日 12:30
linux安装exe的软件(lunex用什么杀毒软件和怎么装exe文件)
2026年4月7日 05:15










