ammo.js:求助:直接代码写一主页+注册功能+数据库

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/30 04:18:40
很简单的一个主页就可以,要包括注册窗口,还要连接数据库
哪位帮忙做下?我8会,这是考查作业急要,谢谢

1.test1.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在线论坛练习</title>
<script language="VBScript">
sub zhuce
location.href="test3.htm"
end sub

sub chakan
location.href="test4.asp"
end sub
</script>
</head>

<body>
<%
application("a")=application("a")+1
%>
<center>
欢迎光临本论坛!您是第
<font size="5" color="#00FF00">
<%response.write application("a")%>
</font>
位访客!
</center>
<form name="form1" method="post" action="test2.asp">
用户名:
<input type="text" name="yhm"><br>
密码:
<input type="password" name="mm"><br><br>
<input type="submit" value="登录">  
<input type="reset" value="重填">  
<input type="button" value="注册" onClick="zhuce">
<!-- <input type="button" value="查看论坛" onClick="chakan"> -->
</form>
<%
' session("yhm")=request("yhm")
%>
</body>
</html>

2.test2.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="vbscript">
sub fanhui
location.href="test1.asp"
end sub
sub xiugai
location.href="test5.asp"
end sub
</script>
</head>

<body>
<% dim conn
set conn=Server.CreateObject("ADODB.connection")
conn.connectionstring=application("connstr")
conn.open
session("yhm")=request("yhm")
session("nr")=request("nr")
session("mm")=request("mm")
response.write "<font size='5' color='red'>你好!您的用户名是:" & session("yhm") & " " & "<br>" & "密码是:" & session("mm") & "</font>"

dim rs
set rs=conn.execute("select * from luntan where yhm='" & session("yhm") & "'")
%>
<hr>
<p><table width="75%" border="0">
<tr>
<td>用户名:</td>
<td>密码:</td>
<td>年龄:</td>
<td>性别:</td>
<td>爱好:</td>
<td>内容:</td>
</tr>
<tr>
<td><%response.write rs("yhm")%></td><br>
<td><%response.write rs("mm")%></td><br>
<td><%response.write rs("nl")%></td><br>
<td><%response.write rs("xb")%></td><br>
<td><%response.write rs("ah")%></td><br>
<td><%response.write rs("nr")%></td><br>
</tr>
</table>
<hr>
<input type="button" name="xiugai" value="修改" onClick="xiugai">
<input type="button" name="fanhui" value="返回" onClick="fanhui">
<%
rs.close
conn.close
%>
</body>
</html>

3.test3.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<center><font size="5" color="#FF0000">请输入你的个人信息</font></center>
<form name="form1" method="post" action="test7.asp">
用户名:<input type="text" name="yhm" value="1"><br>
密码:<input name="mm" type="password" value="1"><br>
年龄:<input type="text" name="nl" value="28"><br>
性别:<input type="text" name="xb" value="男"><br>
爱好:<input type="text" name="ah" value="游泳"><br>
内容:<input type="text" name="nr" value="正在修改内容"><br>
<input type="submit" value="添加">
<input type="reset" value="重填">
<input type="button" value="返回" onClick="test1.asp">
</form>
</body>
</html>

4.test4.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<% dim conn
set conn=Server.CreateObject("ADODB.connection")
conn.connectionstring=application("connstr")
conn.open

dim jieguo,jieguo1
jieguo1="select yhm,nr from luntan"
set jieguo=conn.execute(jieguo1)
%>
<table border="1" width="100">
<tr>
<td>用户名</td>
<td>内容</td>
</tr>

<% while jieguo.eof<>true%>
<tr>
<td><%response.write jieguo("yhm")%></td>
<td><%response.write jieguo("nr")%></td>
</tr>
<%jieguo.movenext
wend
jieguo.close
conn.close
%>

</table>
</body>
</html>

5.test5.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改用户信息</title>
<script language="VBScript">
sub baocun

end sub

</script>
</head>

<body>
<% dim conn
set conn=Server.CreateObject("ADODB.connection")
conn.connectionstring=application("connstr")
conn.open
dim rs
set rs=conn.execute("select * from luntan where yhm='" & session("yhm") & "'")
%>
<%
if rs.eof and rs.bof then
rs.close
conn.close
%>
<p>没有该用户信息!</p>
<p><input type="button" value="返回" onClick="vbscript:history.back"></p>
<% response.end%>
<% else %>
<form name="form1" method="post" action="test6.asp" >
<p>用户名:<%=rs("yhm")%></p>
<p>密码:<input type="password" name="mm" value="<%=rs("mm")%>"></p>
<p>年龄:<input type="text" name="nl" value="<%response.Write rs("nl")%>">
<p>性别:<input type="text" name="xb" value="<%=rs("xb")%>"></p>
<p>爱好:<input type="text" name="ah" value="<%=rs("ah")%>"></p>
<p>内容:<input type="text" name="nr" value="<%=rs("nr")%>"></p>
<p><input type="submit" name="submit1" value="保存">
<input type="reset" name="reset" value="重填">
<input type="button" nama="button1" value="返回" onClick="vbscript:location.href='test1.asp'">
</p>
</form>
<% rs.close
conn.close
%>
<% end if %>
</body>
</html>

6.test6.asp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%
dim yhm,mm,nl,xb,ah,nr
yhm=request("yhm")
mm=request("mm")
nl=request("nl")
xb=request("xb")
ah=request("ah")
nr=request("nr")
dim conn
set conn=Server.CreateObject("ADODB.connection")
conn.connectionstring=application("connstr")
conn.open
conn.execute("update luntan set yhm='" & yhm & "',mm='" & mm & "',nl='" & nl & "',xb='" & xb & "',ah='" & ah & "',nr='" & nr & "' where yhm='" & yhm & "'")
conn.close
%>
<p>保存用户<%=session("yhm")%>成功!</p>
<input type="button" name="button1" onClick="vbscript:location.href='test1.asp'" value="返回">

</body>
</html>

7.test7.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%
dim yhm,mm,nl,xb,ah,nr
yhm=request("yhm")
mm=request("mm")
nl=request("nl")
xb=request("xb")
ah=request("ah")
nr=request("nr")

dim conn,jieguo1,jieguo
set conn=Server.CreateObject("ADODB.connection")
conn.connectionstring=application("connstr")
conn.open
jieguo1="insert into luntan(yhm,mm,nl,xb,ah,nr) values ('" & yhm & "','" & mm & "','" & nl & "','" & xb & "','" & ah & "','" & nr & "')"
response.write "<font size=""5"" color='#FF0000'>" & jieguo1 & "</font>"
set jieguo=conn.execute(jieguo1)
response.Write request ("jieguo")
conn.closec
%>
<P>
<%
response.Write ("注册信息成功!")
%>
</P>
<p><input type="button" value="返回" onClick="vbscript:location.href='test1.asp'"> </p>

</body>
</html>

配置golbal.asa:

Sub Application_OnStart
'Application("connstr")="driver=sql server;server=192.168.1.199;database=datatest;uid=sa;pwd="
Application("connstr")="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\yangxin\yangxin.mdb;Persist Security Info=False"
End Sub