使用下面代码注册,把邮箱改为单位,如何修改function
reg.asp<!-- #include file="conn.asp"-->
<%
set rs=Server.CreateObject("adodb.recordset")
sqlstr="select top 1 studyid from student order by studyid desc "
rs.open sqlstr,conn,1,1
dim num
num=rs("studyid")+1
rs.close
set rs=nothing
%><html><head><title>注册</title>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-size: 13px;
}
input {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
}
body,td,th {
font-size: 12px;
}
.style2 {color: #FF0000}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body>
<table width="318" height="25" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#009933">
<tr>
<td width="318"><div align="center" class="style1">正确填写注册信息可以获得系统分配的学号!</div></td>
</tr>
</table>
<table width="318" height="87" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#F6F6F6">
<tr>
<form action="regok.asp" method="post" name="come" onSubmit="MM_validateForm('yourname','','R','yourMail','','RisEmail','yourPass','','R');return document.MM_returnValue" >
<td>
</td>
<tr>
<td><div align="center">
姓名:
<input name="yourname" type="text" id="yourname">
<span class="style2">*</span></div></td>
</tr>
<tr>
<td><div align="center">密码:
<input name="yourPass" type="text" id="yourPass">
<span class="style2">*</span></div></td>
</tr>
<tr>
<td><div align="center">确认:
<input name="yourPass2" type="text" id="yourPass2">
<span class="style2">*</span></div></td>
</tr>
<tr>
<td height="13"><div align="center">邮箱:
<input name="yourMail" type="text" id="yourMail">
<span class="style2">*</span></div></td>
</tr>
<tr>
<td height="13"><div align="center">
<input name="studyid" type="hidden" id="studyid" value="<%=num%>">
</div></td>
</tr>
<tr>
<td height="10">
<div align="center">
<input type="submit" name="Submit" value="下一步">
<input type="reset" name="Submit" value="重新填">
</div></td>
</form></tr></table>
</body></html>
regok.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<% dim yourname,yourpass,studyid,yourmail
yourname=Trim(Request.Form("yourname"))
yourpass=Trim(Request.Form("yourpass"))
yourpass2=Trim(Request.Form("yourpass2"))
if yourpass<>yourpass2 then
response.Write("<script language=javascript>window.alert('两次密码不相等!');location.href='reg.asp'</script>")
end if
studyid=Trim(Request.Form("studyid"))
yourmail=Trim(Request.Form("yourmail"))
set rs= Server.CreateObject("adodb.recordset")
sqlstr="select * from student where yourmail='"&yourmail&"'"
rs.open sqlstr,conn,1,3
if not rs.eof then
response.write"此用户名已经被使用,重新<a href=reg.asp>注册</a>"
response.end
else
rs.addnew
rs("yourpass")=yourpass
rs("yourname")=yourname
rs("studyid")=studyid
rs("yourmail")=yourmail
rs.update
session("reg")=true
end if
%>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-size: 13px;
}
input {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
background-color: #FFFFFF;
border: 1px solid #999999;
font-weight: bold;
color: #FF0000;
}
body,td,th {
font-size: 12px;
}
a {
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
line-height: 22px;
}
a:link {
color: #333333;
}
a:hover {
color: #FF0000;
}
table {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #CCCCCC;
border-right-color: #CCCCCC;
border-bottom-color: #CCCCCC;
border-left-color: #CCCCCC;
}
-->
</style>
<% if session("reg")=true then %>
<table width="318" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" bgcolor="#009933"><div align="center" class="style1">注册的结果</div></td>
</tr>
</table>
<table width="318" border="0" align="center" cellpadding="0" cellspacing="8">
<tr>
<td><div align="center">您的学号:
<input name="studyid" type="text" id="studyid" value="<%=studyid%>">
</div></td>
</tr>
<tr>
<td><div align="center">您的密码:
<input name="yourpass" type="text" id="yourpass" value="<%=yourpass%>">
</div></td>
</tr>
<tr>
<td height="30"><div align="center"><a href="main.asp" target="_blank">进入首页</a> <a href="javascript:window.close()">关闭窗口</a></div></td>
</tr>
</table>
<%
session("studyid")=studyid
session("login")=true
end if
rs.close
set rs=nothing
%>