这里是源代码,我想在注册页面加上电话号码一栏,我加上去了,可是注册以后不会写进数据库中,各位达人帮我看看哪里出问题了? <!--#include file="common.asp" -->
<% Dim str_db_username 'Holds username in database Dim str_wanted_username 'Holds requested username Dim str_new_usercode 'Holds the newly generate user code Dim int_random_number 'Holds a random number Dim int_random_number_max 'Holds maximum value of random number Dim int_random_number_min 'Holds minimum value of random number Dim str_password 'Holds the password user chose Dim rs_new_user 'Recordsheet for new user Dim rs_check_username 'Recordsheet to check usernames originality Dim str_dh IF request.querystring("step") = 5 THEN
'Set the variables to the forms enetered values str_wanted_username = Request.form("username") str_password = Request.form("pw1") str_dh= Request.form("dh") 'Create new database connection adoCon.Open cString
'Create new SQL string strSQL="SELECT * FROM tbl_authors"
'Create new recordsheet set rs_check_username=server.CreateObject("ADODB.Recordset")
'Open the recordsheet and execute sql rs_check_username.open strSQL,adoCon
'Loop until record ends Do While not rs_check_username.EOF
'Set variable to hold a database username value str_db_username = rs_check_username("name")
'If the variables match then the username is not unique, redirect to error page IF str_db_username = str_wanted_username THEN Response.redirect("error.asp")
'Move to next record rs_check_username.MoveNext
'Loop Loop
'Close n clean! rs_check_username.Close Set rs_check_username = Nothing
'Create a new random number Randomize int_random_number_Min = 1 int_random_number_Max = 999999999 int_random_number = Int(((int_random_number_Max-int_random_number_Min+1) * Rnd) + int_random_number_Min) 'Convert the new number into a string value int_random_number = Cstr(int_random_number)
'Set the variable to hold the users password, username and random number str_new_usercode = str_wanted_username + int_random_number + str_password
'Create a new SQL string strsql="SELECT * FROM tbl_authors"
'Create a new recordsheet set rs_new_user=server.CreateObject("ADODB.Recordset")
'Set correct cursor and locktypes rs_new_user.CursorType = 5 rs_new_user.LockType = 5
'Open recordsheet and execute SQL string rs_new_user.open strsql,adocon
'Set recordsheet to add a new record rs_new_user.AddNew
'Enter a new record into the database rs_new_user.fields("name")= Request.form("username") rs_new_user.fields("email")= Request.form("email") rs_new_user.fields("password")= Request.form("pw1") rs_new_user.fields("dianhua")= Request.form("dh") rs_new_user.fields("code") = str_new_usercode
'Update the recorsheet rs_new_user.update
'Close and clean rs_new_user.close set rs_new_user = nothing adoCon.close
'Redirect user to step 4 response.redirect("welcome.asp")
else end if
%>
<html> <head> <style> td{font-size:9pt;line-height:140%} body{font-size:9pt;line-height:140%}
a:link { color: #0033CC; text-decoration: none } a:visited { color: #0033CC; text-decoration: none } a:active { color: #FF0000; text-decoration: none } a:hover { color: #000000; text-decoration: underline} </style> <SCRIPT LANGUAGE="JavaScript"> <!-- function DoSubmit(obj) { var username = obj.username.value; var password = obj.pw1.value; var confirmation = obj.pw2.value; var email = obj.email.value;
var strMailFilter = /^.+@.+\..{2,3}$/; var strIllegalChars = /[\(\)\<\>\,\;\:\\\/\*\-\+\=\"\[\]]/; var submitform = true; var error = '--------------------- 警 告 ---------------------\n\n'; error += ' 有以下错误发生 : \n\n';
if (username.length < 1) { error += ' + 用户名不能为空! \n'; submitform = false; } if (username.length > 20) { error += ' + 用户名最长为20字母! \n'; submitform = false; } if (password.length < 5) { error += ' + 密码最少设为5位! \n'; submitform = false; } if (password.length > 20) { error += ' + 密码最长为20位! \n'; submitform = false; } if (confirmation.length < 1) { error += ' + 确认密码不能为空 \n'; submitform = false; } if (password != confirmation) { error += ' + 两次密码输入不相同! \n'; submitform = false; } if (email.length > 80) { error += ' + Email最长为80位! \n'; submitform = false; } if (email.length > 1 && email.match(strIllegalChars)) { error += ' + 您的email中带有非法字符! \n'; submitform = false; } if (email.length > 1 && !email.match(strIllegalChars) && !(strMailFilter.test(email))) { error += ' + 您的email地址不存在! \n'; submitform = false; } if (submitform) { obj.submit(); } else { error += '\n--------------------- 警 告 ---------------------\n\n'; alert (error); return false; } } --> </script> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <form action="register.asp?step=2" name="myForm" method="post" onReset="return confirm('Are you sure you wish to reset the form?');"> <td align="center"> <p><BR> 有<font color="#FF0000">*</font>标志的必需填写!<BR> <BR> <BR> <BR> <b> 用户名<font color="#FF0000">*</font> </b> <input type="text" name="username" size="30" maxlength="80" class="textbox"> 请设定您的用户名!<BR> <BR> <BR> <b> 密码<font color="#FF0000">:*</font> </b> <input type="password" name="pw1" size="30" maxlength="80" class="textbox"> 请设定您的密码!</p> <p><BR> <b>重复密码:<font color="#FF0000">*</font> </b> <input type="password" name="pw2" size="30" maxlength="80" class="textbox"> 再次填写刚才的密码! </p> <p><b>联系电话<font color="#FF0000">:*</font> </b> <input type="dianhua" name="dh" size="15" maxlength="15" class="textbox"> 请填写你的联系电话!<BR> <BR> <b> Email:</b> <input type="text" name="email" size="30" maxlength="80" class="textbox"> 您的Email地址!<BR> <BR> <input type="button" value="注册" class="button" onClick="DoSubmit(document.myForm)"> <input type="reset" value="重写" class="button"> <BR> <BR> <BR> <center> <font size="1" color="#000000" face="verdana"></p> </td> </form> </tr> </table>
</body>
</html>