室内装修色彩搭配实例:我要做一个用户注册和登陆的页面,具体的代码应该怎么写?啊

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/05 06:21:35
我是一个网页制作新手,希望大家把答案写得详细一点!谢谢!
我的网页是用ASP做的!而且是要和ACCESS数据库链接的!
我要在我的电脑里装一个iis,但是在我的电脑组件里找不到iis!我要怎样装iis呢?要重装系统吗?

2. ASP代码(设立一DSN,请改动begin.asp)
----------------------------------
-----文件reg_step2.asp
<%
ValidCodeLogin=Request.QueryString("VailCodeLogin")
u_name=Request.QueryString("name")

if ValidCodeLogin="" or u_name="" then
Response.Redirect "reg_step1.asp"
Response.end
end if
%>
<html>
<head>
<title>详细信息填写</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/lotsty1.css">
<SCRIPT LANGUAGE="JavaScript1.1">
function isPosInteger(inputVal) {
inputStr = inputVal.toString()
for (var i = 0; i < inputStr.length; i++) {
var oneChar = inputStr.charAt(i)
if (oneChar < "0" || oneChar > "9") {
return false
}
}
return true
}

function CheckForm(form) {
for (i = 0; i <document.forms[0].elements.length; i++) {
if (document.forms[0].elements[i].type == "text" && document.forms[0].elements[i].value == ""){
alert("所有内容必须填写!")
return false;
}
}
if (document.forms[0].email.value.indexOf("@")==-1 || document.forms[0].email.value.indexOf(".")==-1 || document.forms[0].email.value.indexOf("@.")!=-1 || document.forms[0].email.value=="" || document.forms[0].email.value==null || document.forms[0].email.value.indexOf("@")==0){
alert('E-mail未输入或格式有误,请查看!')
return false
}

if(!isPosInteger(document.forms[0].year.value)){
alert("年份必须是数字!")
return false
}
if(!isPosInteger(document.forms[0].month.value)){
alert("月份必须是数字!")
return false
}
if(!isPosInteger(document.forms[0].date.value)){
alert("日期必须是数字!")
return false
}
return true;
}
</SCRIPT>
<link rel="stylesheet" href="../css/sty1.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#333333">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="46"> </td>
</tr>
<tr>
<td height="426">
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="149" valign="top" height="386">  </td>
<td width="628" valign="top" height="386">
<table width="620" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="474" height="12" valign="top"> </td>
<td width="146" height="12" valign="top"> </td>
</tr>
<tr>
<td width="474" valign="top" height="367">
<table width="474" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" valign="top" height="368"> </td>
<td width="462" valign="top" class="txt105" height="368">
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td width="100%" class="txt105" height="20"><font color="#006600">个人详细信息填写
</font></td>
</tr>
<tr valign="top">
<td width="100%" height="346">
<form method="post"action="reg_step2_sub.asp" onSubmit="return CheckForm(this)">
<table width="400" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td colspan="2" class="txt9">
<hr size="1" align="left" color="#669999">
</td>
</tr>
<tr>
<td width="111" class="txt9" align="right" valign="bottom"><font color="#336600">真实姓名:</font></td>
<td width="277" class="txt9" valign="top">
<input type="text" name="true_name" size="10" class="txt9">
</td>
</tr>
<tr>
<td width="111" class="txt9" align="right" valign="bottom"><font color="#336600">性别:</font></td>
<td width="277" class="txt9" valign="top">
<select name="sex" class="txt9">
<option value="男" selected>男</option>
<option value="女">女</option>
</select>
</td>
</tr>
<tr>
<td width="111" class="txt9" align="right" valign="bottom"><font color="#336600">生日:</font></td>
<td width="277" class="txt9" valign="top">
<input type="text" name="year" size="4" class="txt9">

<input type="text" name="month" size="2" class="txt9">

<input type="text" name="date" size="2" class="txt9">
日 </td>
</tr>
<tr>
<td width="111" class="txt9" align="right"><font color="#336600">身份证编号:</font></td>
<td width="277" class="txt9" valign="top">
<input type="text" name="idcard" class="txt9">
<br>
作为取货凭证,请务必正确填写。 </td>
</tr>
<tr>
<td width="111" class="txt9" align="right" valign="bottom"><font color="#336600">联系地址:</font></td>
<td width="277" class="txt9" valign="top">
<input type="text" name="address" class="txt9">
</td>
</tr>
<tr>
<td width="111" class="txt9" align="right" height="23"><font color="#336600">联系电话:</font></td>
<td width="277" class="txt9" valign="top" height="23">
<input type="text" name="telephone" class="txt9">
</td>
</tr>
<tr>
<td width="111" class="txt9" align="right"><font color="#336600">Email地址:</font></td>
<td width="277" class="txt9" valign="top">
<input type="text" name="email" class="txt9">
<br>
中奖信息将以此E-mail地址发送。 </td>
</tr>
<tr>
<td colspan="2" class="txt9">
<hr size="1" align="left" color="#669999">
</td>
</tr>
<tr align="center">
<td colspan="2" class="txt9">
<input type="submit" name="Submit" value="提交" class="txt9">
<input type="reset" name="reset" value="重填" class="txt9">
<input type="hidden" name="isLogin" value="<%=ValidCodeLogin%>" >
<input type="hidden" name="u_name" value="<%=u_name%>" >
</td>
</tr>
<tr align="center">
<td colspan="2" class="txt9">
<hr size="1" align="left" color="#669999">
</td>
</tr>
<tr align="center">
<td colspan="2" class="txt9">
<table width="353" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="353" class="txt9" height="26"><font color="#FF6666">请查看上述信息的正确性,我们将据此来确认您的真实身份。
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="146" valign="top" height="367"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>

</html>

---文件reg_step2_sub.asp

<%
islogin=Request("isLogin")
u_name=Request("u_name")

if islogin="" or u_name="" then
Response.Redirect "reg_step1.asp"
Response.end
end if
%>
<!-- #include file = "../inc/adovbs.inc" -->
<!-- #include file = "../inc/begin.asp" -->
<html>
<head>
<title>详细信息填写</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/lotsty1.css">
<link rel="stylesheet" href="../css/sty1.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#333333">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50"> </td>
</tr>
<tr>
<td>
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="149" valign="top">  </td>
<td width="628" valign="top">
<table width="620" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="474" height="12" valign="top"> </td>
<td width="146" height="12" valign="top"> </td>
</tr>
<tr>
<td width="474" valign="top">
<table width="471" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14" valign="top"> </td>
<td width="457" valign="top" class="txt105">
<%
true_name=Request("true_name")
sex=Request("sex")
birth=Request("year")&"-"&Request("month")&"-"&Request("date")

if IsDate(birth) then
birth=FormatDateTime(birth,1)
if Year(birth)<=999 then %>
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td width="400" class="txt9" height="120"><font color="#CC0000">出生日期输入错误,<a href="javascript:history.go(-1)" class="link8">返回。</a></font></td>
</tr>
</table>
<%
Response.write "</body></html>"
Response.end
end if
else%>
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td width="400" class="txt9" height="120"><font color="#CC0000">出生日期输入错误,<a href="javascript:history.go(-1)" class="link8">返回。</a></font></td>
</tr>
</table>
<%
Response.write "</body></html>"
Response.end
end if

idcard=Request("idcard")
address=Request("address")
email=Request("email")
telephone=Request("telephone")

'response.write birth
'response.end

strSql="proc_UserInfoUpdate"
strSql=strSql & " '" & islogin & "'"
strSql=strSql & " ,'" & true_name & "'"
strSql=strSql & " ,'" & sex & "'"
strSql=strSql & " ,'" & birth & "'"
strSql=strSql & " ,'" & idcard & "'"
strSql=strSql & " ,'" & address & "'"
strSql=strSql & " ,'" & email & "'"
strSql=strSql & " ,'" & telephone & "'"
Set rs = Con.Execute(strSql)
ret=rs.fields("resultID")
%>
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<%if ret=0 then%>
<tr>
<td width="400" class="txt9" height="20" align="center"><font color="#006600">您的个人信息填写如下:</font></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">
<hr size="1" align="left" color="#669999">
</td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">真实姓名:<%=true_name%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">性别:<%=sex%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">生日:<%=birth%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">身份证:<%=idcard%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">地址:<%=address%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">Email:<%=email%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">联系电话:<%=telephone%></td>
</tr>
<tr>
<td width="400" class="txt9" height="20" align="center">
<hr size="1" align="left" color="#669999">
</td>
</tr>
<tr align="center">
<td width="400" class="txt105" height="22">
<table width="320" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="320" class="txt9" height="26"><font color="#FF6666">请查看上述信息的正确性,我们将据此来确认您的真实身份。</font></td>
</tr>
</table>
</td>
</tr>
<tr align="center">
<td width="400" class="txt9" height="17">
<p>请注意您现在已处于登录状态。</p>
<p><a href="winload.asp">>>登出--临时用<<</a></p>
</td>
</tr>
<%elseif MyCommand("ReturnCode")=-1 then %>
<tr>
<td width="400" class="txt105" height="120" align="center"><font color="#CC0000">请先登录。</font></td>
</tr>
<%elseif MyCommand("ReturnCode")=-2 then %>
<tr>
<td width="400" class="txt105" height="120" align="center"><font color="#CC0000">用户超时</font></td>
</tr>
<%elseif MyCommand("ReturnCode")=-3 then %>
<tr>
<td width="400" class="txt105" height="120" align="center"><font color="#CC0000">用户资料输入错误</font></td>
</tr>
<%else%>
<%end if%>
</table>

</td>
</tr>
</table>
</td>
<td width="146" valign="top"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr align="center">
<td height="76"> </td>
</tr>
</table>
<%Con.Close%>
</body>
</html>

---文件winload.asp

<!-- #include file = "../inc/adovbs.inc" -->
<!-- #include file = "../inc/begin.asp" -->
<%
validlogin=Session("lotto_isLogin")
if validlogin<>"" then
Set MyComquit=Server.CreateObject("ADODB.Command")
Set MyComquit.ActiveConnection=Con
MyComquit.CommandType=adCmdStoredProc
MyComquit.CommandText="proc_UserLogout"
MyComquit.Parameters.Append MyComquit.CreateParameter("ReturnCode",adInteger,adParamReturnValue)
MyComquit.Parameters.Append MyComquit.CreateParameter("quitid",adVarChar,adParamInput,30)
MyComquit.Parameters("quitid")=validlogin
MyComquit.Execute()
end if
Session("lotto_isLogin")=""
Session("lotto_username")=""
Session("lotto_UserLevel")=""
%>
<%Con.Close%>
<meta http-equiv=refresh content='0;url=http://地址>

不同语言有不同的代码!