login.aspxml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /??
‘ èÂÂçÂÂéªÂè¯Â.
<ï¼Â
@ Language=VBScriptï¼Â
>
<ï¼Â
name=trim(request(“name”))
passwd=trim(request(“passwd”))
if name<>”” and passwd<>”” then
‘ æ£ÂæÂ¥èÂÂçÂÂæ¯å¦è¾ÂÃ¥Â
¥ç¨æ·åÂÂÃ¥ÂÂå¯Âç Â.
Set conn = Server.CreateObject(“ADODB.Connection”)
conn.Open “driver={Microsoft Access Driver(ï¼Â.mdb)};
dbq=”ï¼ Server.MapPat(“exercise.mdb”)
set rs= server.createobject(“adodb.recordset”)
sql= “select ï¼ fromàuseràwhere user=
‘” ï¼Âname3‘ and passwd='” ï¼ passwd 3‘”
Set rs= conn.Execute(sql)
‘ éªÂè¯ÂèÂÂçÂÂÃ¥ÂÂæ³Âæ§.
if not(rs.eof) then
if rs(“score”)<>0 then
‘ æ£ÂæÂ¥èÂÂçÂÂæ¯å¦已åÂÂå è¿ÂèÂÂè¯Â,èÂ¥æ¯åÂÂè¿Âè¡ÂæÂÂ绩æ¥询.
response.write rs(“user”)3çÂÂèÂÂè¯ÂæÂÂ绩毓ï¼Ârs(“score”)
else
session(“pass”)=1
session(“user”)=name
response.redirect “test.asp”
end if
else
Response.Write “å¢,æ¨è¾ÂÃ¥Â
¥çÂÂç¨æ·åÂÂæÂÂå¯Âç Âä¸Âæ£确!”
end if
else
end if
ï¼Â
>
<html>
<head>
<META NAME=”GENERATOR” Content=”Microsoft Visual Studio 6.0″>
<title>æ¼éªåÂኼÂä¹ÂèÂÂçÂÂç»å½Â</title>
</head>
<body>
<FORM action=”login.asp” id=
FORM1 method=post name=FORM1>
<P title=””>ï¼Ânbsp;</P>
<P title=””>ï¼Ânbsp;</P>
<P title=”” align=center>èÂÂçÂÂ:
<INPUT id=text1 name=name style=”HEIGHT:22px; WIDTH: 103px”></P>
<P title=”” align=center>å¯Âç Â:
<INPUT id=password1 name=passwd style=”HEIGHT: 23px; WIDTH: 101px” type=password></P>
<P title=”” align=center>
<INPUT id=submit1 name=submit1 type=submit value=”è¿ÂÃ¥Â
Â¥ ” style=”FONTï¼ÂSIZE: medium; FONTï¼ÂSTYLE: normal; FONTï¼ÂVARIANT:normal; FONTï¼ÂWEIGHT: bold” title=””></P>
<P title=”” align=center>
</P>
</FORM>
</body></html>
test.asp
‘ ä»Âé¢ÂåºÂä¸ÂÃ¥ÂÂé¢ÂèÂÂè¯Â.
<ï¼Â
@ Language=VBScript ï¼Â
>
<ï¼Â
if session(“pass”)<>1 then
response.redirect “login.asp”
else
end if
SetÃÂ conn = Server.CreateObject(“ADODB.Connection”)
conn.Open “driver={Microsoft Access Driver (ï¼Â.mdb)};
dbq=”ï¼ Server.MapPath(“exercise.mdb”)
sql=”select ï¼ from test”
Set rs = conn.Execute( sql )
‘ æÂÂÃ¥ÂÂè¯Âé¢Â.
ï¼Â
>
<script LANGUAGE=”javascript”>
var isn1=null;
var isn2=false;
today=new Date();
function stopit(){
if(isn2){
ÃÂ clearTimeout(isn1);
ÃÂ }
isn2 = false;
}
function startit(){
stopit();
isnclock();
}
function isnclock(){
var now=new Date();
var hrs=now.getHours();
var min=now.getMinutes();
var sec=now.getSeconds();
document.clckh.disp.value=””ï¼Â((hrs>12) ? hrsï¼Â12 : hrs);
document.clckm.disp.value=((min<10) ? “0” : “”)ï¼Âmin;
document.clcks.disp.value=((sec<10) ? “0” : “”)ï¼Âsec;
document.clck.disp.value=(hrs>=12) ? “p.m.” : “a.m.”;
isn1=setTimeout(“isnclock()”,1000);
isn2=true;
}
</script>
‘ 以ä¸Âæ¯ä¸Â个计æ¶å½æ°.
<html>
<head>
<META NAME=”GENERATOR” Content=”Microsoft Visual Studio 6.0″>
</head>
<body onLoad=”startit()” BGCOLOR=”FFFFFF”>
<center>
‘ è°Âç¨计æ¶å½æ°æ¾示æ¶é´.
<TABLE BORDER=2>
<tr>
<td>Time</td><td>Hour</td><td>Min</td><td>Sec</td><td></td>
</tr>
<tr>
<td></td>
<td VALIGN=TOP><FORM NAME=”clckh” onSubmit=”0″>
<INPUT TYPE=”text” NAME=”disp” SIZE=2 VALUE =””>
</FORM></td>
<td VALIGN=TOP><FORM NAME=”clckm” onSubmit=”0″>
<INPUT TYPE=”text” NAME=”disp” SIZE=2 VALUE =””>
</FORM></td>
<td VALIGN=TOP><FORM NAME=”clcks” onSubmit=”0″>
<INPUT TYPE=”text” NAME=”disp” SIZE=2 VALUE =””>
</FORM></td>
<td VALIGN=TOP><FORM NAME=”clck” onSubmit=”0″>
<INPUT TYPE=”text” NAME=”disp” SIZE=4 VALUE =””>
</FORM></td></tr>
</center>
<FORM action=”result.asp” id=FORM1 method=post name=FORM1>
‘ æ¾示è¯Âé¢Â.
<P>ï¼Ânbsp;</P>
<P>
à<ï¼Â
ÃÂ i=1
ÃÂ rs.movefirst
àdo while not rs.eofï¼Â
>
à<P>ï¼Ânbsp;ï¼Ânbsp; <ï¼Â
=rs(“question”)ï¼Â
></P>
<TABLE align=center border=1 cellPadding=1
cellSpacing=1 width=”80ï¼Â
“>
ÃÂ <tr>
à<td style=”WIDTH: 50ï¼Â
” width=”50ï¼Â
“>
<INPUT name=ans<ï¼Â
=iï¼Â
> type=radio value=”A”><ï¼Â
=rs(“a”)ï¼Â
></td>
<td><INPUT name=ans<ï¼Â
=iï¼Â
ï¼Â
type=radio value=”B”><ï¼Â
=rs(“b”)ï¼Â
></td></tr>
ÃÂ <tr>
<td><INPUT name=ans<ï¼Â
=iï¼Â
>
type=radio value=”C”><ï¼Â
=rs(“c”)ï¼Â
></td>
<td><INPUT name=ans<ï¼Â
=iï¼Â
>
type=radio value=”D”><ï¼Â
=rs(“d”)ï¼Â
></td>
ÃÂ </tr>
</TABLE>
<ï¼Â
i=iï¼Â1
rs.movenext
loop
ï¼Â
>
</P>
<P></P>
<P align=center><INPUT id=submit1 name=submit1 type=submit value=交å·>
<INPUT id=reset1 name=reset1 type=reset value=Reset></P></FORM>
</body></html>
result.asp
‘ è¯ÂÃ¥ÂÂ并å°ÂæÂÂ绩记å½Âå°æ°æ®åºÂ.
<ï¼Â
@ Language=VBScript ï¼Â
>
<html>
<head>
<META NAME=”GENERATOR” Content=”Microsoft Visual Studio 6.0″>
</head>
<body>
<P>ï¼Ânbsp;</P>
<ï¼Â
name=session(“user”)
dim score
Set conn = Server.CreateObject(“ADODB.Connection”)
conn.Open “driver={Microsoft Access Driver(ï¼Â.mdb)};
dbq=” ï¼ Server.MapPath(“exercise.mdb”)
sql=”select ans from test”
Set rs = conn.Execute( sql )
ycorrect=0
rsCount=0
Response.Write “æ ÂÃ¥ÂÂçÂÂæ¡Â:”
‘ ç»Âåºæ ÂÃ¥ÂÂçÂÂæ¡Â并è¯ÂÃ¥ÂÂ.
Do while not rs.eof
Response.Write rs(“ans”)
rsCount=rsCountï¼Â1
if Request.Form(rsCount)=rs(“ans”) then
ycorrect=ycorrectï¼Â1
end if
rs.movenext
loop
Response.Write “<br>æ¨çÂÂçÂÂæ¡Â:”
score=int(ycorrect/rscountï¼Â100)
for i=1 to Request.Form.Countï¼Â1
Response.Write Request.Form(i)
next
Response.Write “<br>”
Response.Write “æ¨çÂÂæÂÂ绩:”ï¼Âscore
if score<60 then Response.Write “å«é¾è¿Â,æ¨ä¸ÂÃ¥ÂÂæ ¼!”3<br>”
else if score>=60 Response.Write “幸好,æ¨åÂÂæ ¼äºÂ!”3<br>”
else Response.Write “æÂÂÃ¥ÂÂ,æ¨è·å¾ÂäºÂä¼Âç§Â!”
strSql=”insert into user (result) values (“ï¼Âscore3)
where user='”ï¼Âname3‘”
conn.execute(strSql)
‘ å°ÂæÂÂ绩åÂÂå°æ°æ®åºÂ.
ï¼Â
>
</body></html>
ÃÂ
[1]