问题描述
<%@LANGUAGE="JAVASCRIPT"CODEPAGE="936"%><!--#includefile="Connections/conn.asp"--><%varRecordset1=Server.CreateObject("ADODB.Recordset");Recordset1.ActiveConnection=MM_conn_STRING;Recordset1.Source="SELECT*FROMdb1";Recordset1.CursorType=0;Recordset1.CursorLocation=2;Recordset1.LockType=1;Recordset1.Open();varRecordset1_numRows=0;%><%varstr="1234567890";functiongetRandomNum(lbound,ubound){return(Math.floor(Math.random()*(ubound-lbound))+lbound);}vars=str.split("");vart="";for(vari=0;i<4;i++){t+=s[getRandomNum(1,10)];}varnumber=t;%><%//***EditOperations:declarevariables//settheformactionvariablevarMM_editAction=Request.ServerVariables("SCRIPT_NAME");if(Request.QueryString){MM_editAction+="?"+Server.HTMLEncode(Request.QueryString);}//booleantoabortrecordeditvarMM_abortEdit=false;%><%//***RedirectifusernameexistsvarMM_flag="MM_insert";if(String(Request(MM_flag))!="undefined"){varMM_dupKeyRedirect="zcsb.asp";varMM_dupKeyUsernameValue=String(Request.Form("user_name"));varMM_rsKey_cmd=Server.CreateObject("ADODB.Command");MM_rsKey_cmd.ActiveConnection=MM_conn_STRING;MM_rsKey_cmd.CommandText="SELECTuser_nameFROMdb1WHEREuser_name=?";MM_rsKey_cmd.Prepared=true;MM_rsKey_cmd.Parameters.Append(MM_rsKey_cmd.CreateParameter("param1",200,1,50,MM_dupKeyUsernameValue));//adVarCharvarMM_rsKey=MM_rsKey_cmd.Execute();if(!MM_rsKey.EOF||!MM_rsKey.BOF){//theusernamewasfound-cannotaddtherequestedusernamevarMM_qsChar="?";if(MM_dupKeyRedirect.indexOf("?")>=0)MM_qsChar="&";MM_dupKeyRedirect=MM_dupKeyRedirect+MM_qsChar+"requsername="+MM_dupKeyUsernameValue;Response.Redirect(MM_dupKeyRedirect);}MM_rsKey.Close();}%><%if(String(Request("MM_insert"))=="form1"){if(!MM_abortEdit){//executetheinsertvarMM_editCmd=Server.CreateObject("ADODB.Command");MM_editCmd.ActiveConnection=MM_conn_STRING;MM_editCmd.CommandText="INSERTINTOdb1(user_name,passwd,passwd_question,passwd_answer,qq,sex,byear,weight,married,province,city,relation,imgfile,wangming)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";MM_editCmd.Prepared=true;MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1",202,1,50,Request.Form("user_name")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2",202,1,50,Request.Form("passwd")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3",202,1,50,Request.Form("passwd_question")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4",202,1,50,Request.Form("passwd_answer")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param5",202,1,50,Request.Form("qq")));//adVarWChareMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param6",202,1,50,Request.Form("sex")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param7",202,1,50,Request.Form("byear")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param8",5,1,-1,(String(Request.Form("weight"))!="undefined"&&String(Request.Form("weight"))!="")?Request.Form("weight"):null));//adDoubleMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param9",202,1,50,Request.Form("married")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param10",202,1,50,Request.Form("province")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param11",202,1,50,Request.Form("city")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param12",202,1,50,Request.Form("relation")));//adVarWCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param13",201,1,-1,Request.Form("imgfile")));//adLongVarCharMM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param14",202,1,50,Request.Form("wangming")));//adVarWCharMM_editCmd.Execute();MM_editCmd.ActiveConnection.Close();Session.Contents.Remove("MM_Username");Session.Contents.Remove("MM_UserAuthorization");varloginUser=String(Request.Form("user_name"));Session("MM_Username")=loginUser;//appendthequerystringtotheredirectURLvarMM_editRedirectUrl="zccg.asp";if(MM_editRedirectUrl&&Request.QueryString&&Request.QueryString.Count>0){MM_editRedirectUrl+=((MM_editRedirectUrl.indexOf('?')==-1)?"?":"&")+Request.QueryString;}Response.Redirect(MM_editRedirectUrl)}}%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/><scripttype="text/javascript"><!--functionvalidateImg(imgfile){varfileext=imgfile.value.substring(imgfile.value.lastIndexOf("."),imgfile.value.length);fileext=fileext.toLowerCase();if((fileext!='.jpg')&&(fileext!='.gif')&&(fileext!='.jpeg')&&(fileext!='.png')&&(fileext!='.bmp')){alert("对不起,系统仅支持标准格式的照片,请您调整格式后重新上传,谢谢!");imgfile.outerHTML=imgfile.outerHTML;imgfile.focus();returnfalse;}}functionviewmypic(mypic,imgfile){if(imgfile.value){mypic.src=imgfile.value;mypic.style.display="";mypic.border=1;}}functionMM_findObj(n,d){//v4.01varp,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);returnx;}functionMM_validateForm(){//v4.0vari,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+'mustcontainane-mailaddress.n';}elseif(test!='R'){num=parseFloat(val);if(isNaN(val))errors+='-'+nm+'mustcontainanumber.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+'mustcontainanumberbetween'+min+'and'+max+'.n';}}}elseif(test.charAt(0)=='R')errors+='-'+nm+'请认真填写注册表,按要求填写无误,方可注册成功.n';}}if(errors)alert('Thefollowingerror(s)occurred:n'+errors);document.MM_returnValue=(errors=='');}functionform1_onsubmit(){if(document.form1.user_name.value==''){alert("请输入您的用户名。");document.form1.user_name.focus();returnfalse;}if(document.form1.passwd.value==''){alert("请输入您的密码。");document.form1.passwd.focus();returnfalse;}if(document.form1.pwdcomfirm.value==''){alert("请再次输入您的密码。");document.form1.pwdcomfirm.focus();returnfalse;}if(document.form1.pwdcomfirm.value!=document.form1.passwd.value){alert("两次输入的密码不一致,请再次输入。");document.form1.pwdcomfirm.focus();returnfalse;}if(document.form1.passwd_question.value==''){alert("请选择密码提示问题。");document.form1.passwd_question.focus();returnfalse;}if(document.form1.passwd_answer.value==''){alert("请填写密码提示答案。");document.form1.passwd_answer.focus();returnfalse;}if(document.form1.qq.value==''){alert("请填写正确的QQ号码。");document.form1.qq.focus();returnfalse;}if(document.form1.byear.value==''){alert("请填写您的年龄。");