我的代码绝对没错,不过就是提示错误
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="md5.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' *** Redirect if username exists
MM_flag = "MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
Dim MM_rsKey
Dim MM_rsKey_cmd
MM_dupKeyRedirect = "errro3.asp"
MM_dupKeyUsernameValue = CStr(Request.Form("u_name"))
Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
MM_rsKey_cmd.ActiveConnection = MM_conn_STRING
MM_rsKey_cmd.CommandText = "SELECT u_name FROM dbo.user_biao WHERE u_name = ?"
MM_rsKey_cmd.Prepared = true
MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 200, 1, 50, MM_dupKeyUsernameValue) ' adVarChar
Set MM_rsKey = MM_rsKey_cmd.Execute
If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
' the username was found - can not add the requested username
MM_qsChar = "?"
If (InStr(1, MM_dupKeyRedirect, "?") >= 1) Then MM_qsChar = "&"
MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
Response.Redirect(MM_dupKeyRedirect)
End If
MM_rsKey.Close
End If
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If Trim(Request.Form("yzm"))=Empty Or Trim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("yzm")) Then
Response.Redirect("errro2.asp")
response.end
end if
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conn_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.user_biao (u_name, u_pass, u_zssm, u_xb, u_nialin, u_tel, u_qq, u_email, ip) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("u_name")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, md5(Request.Form("u_pass"))) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("u_zssm")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("u_xb")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 5, 1, -1, MM_IIF(Request.Form("u_nialin"), Request.Form("u_nialin"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, -1, MM_IIF(Request.Form("u_tel"), Request.Form("u_tel"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 5, 1, -1, MM_IIF(Request.Form("u_qq"), Request.Form("u_qq"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202, 1, 50, Request.Form("u_email")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202, 1, 50, Request.Form("ip")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "hyzhuce_cg.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
.srk {
background-color: #D6D3CE;
height: 22px;
width: 180px;
}
</style>
<script>
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
function callServer() {
var name = document.getElementById("u_name").value;
if ((name == null) || (name == "")) return;
var url = "check.asp?name=" + escape(name);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = updatePage;
xmlHttp.send(null);
}
function updatePage() {
if (xmlHttp.readyState < 4) {
username.innerHTML="正在检测用户名是否可用......";
}
if (xmlHttp.readyState == 4) {
var response = xmlHttp.responseText;
username.innerHTML=response;
}
}
</script>
<script>
function jczc()
{
if(form1.u_name.value=="")
{
alert("请填写用户名");
form1.u_name.focus();
return false;
}
if(form1.u_name.value.length<6||form1.u_name.value.length>20)
{
alert("你的用户名长度应该在6到20个字符之间");
form1.u_name.focus();
return false;
}
if(form1.u_pass.value=="")
{
alert("请填写密码");
form1.u_pass.focus();
return false;
}
if(form1.u_pass.value.length<6||form1.u_pass.value.length>20)
{
alert("你的密码长度应该在6到20个字符之间");
form1.u_pass.focus();
return false;
}
if(form1.u_pass2.value!=form1.u_pass.value)
{
alert("你的密码不一致");
form1.u_pass2.focus();
return false;
}
if(form1.u_xb[0].checked==false&&form1.u_xb[1].checked==false)
{
alert("请选择你的性别!");
form1.u_xb[0].focus();
return false;
}
if ( document.form1.u_email.value=="") {
alert("请填写你的电子邮件地址!");
form1.u_email.focus()
return false
}
var email = document.form1.u_email.value
var is_error = false
var pn_0 = email.indexOf("@")
var pn_1 = email.indexOf(".",pn_0)
var pn_2 = email.length
if (pn_0<1 || pn_1<pn_0+2 || pn_1+2>pn_2) is_error=true
if (is_error) {
alert("请输入正确的邮件地址,密码丢失后可用此找回!");
document.form1.u_email.focus()
return false
}
return true;
}
</script>
<script>
function getcode()
{
document.getElementById("safecode").src="Safecode.asp?"+Math.random();
}
function voice()
{
if(document.all&&!window.opera)
document.getElementById("voices").Filename="voice.asp?"+Math.random();
else
alert("暂时只有IE浏览器支持");
}
function chkpwd(obj){
var t=obj.value;
var id=getResult(t);
//定义对应的消息提示
var msg=new Array(4);
msg[0]="密码过短。";
msg[1]="密码强度差。";
msg[2]="密码强度良好。";
msg[3]="密码强度高。";
var sty=new Array(4);
sty[0]=-45;
sty[1]=-30;
sty[2]=-15;
sty[3]=0;
var col=new Array(4);
col[0]="gray";
col[1]="red";
col[2]="#ff6600";
col[3]="Green";
//设置显示效果
var bImg="images/pwdlen.gif";
var sWidth=150;
var sHeight=15;
var Bobj=document.getElementById("chkResult");
Bobj.style.fontSize="12px";
Bobj.style.color=col[id];
Bobj.style.width=sWidth + "px";
Bobj.style.height=sHeight + "px";
Bobj.style.lineHeight=sHeight + "px";
Bobj.style.background="url(" + bImg + ") no-repeat left " + sty[id] + "px";
Bobj.style.textIndent="20px";
Bobj.innerHTML= msg[id];
}
//定义检测函数,返回0/1/2/3分别代表无效/差/一般/强
function getResult(s){
if(s.length < 4){
return 0;
}
var ls = 0;
if (s.match(/[a-z]/ig)){
ls++;
}
if (s.match(/[0-9]/ig)){
ls++;
}
if (s.match(/(.[^a-z0-9])/ig)){
ls++;
}
if (s.length < 6 && ls > 0){
ls--;
}
return ls
}
</script>
</head>
<body>
<form onSubmit="jczc()" method="post" action="<%=MM_editAction%>" name="form1">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">用户名:</td>
<td><input name="u_name" type="text" id="u_name" onChange="callServer()" class="srk" value=""><div id="username"></div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">密码:</td>
<td><input name="u_pass" onChange="chkpwd(this)" type="password" class="srk" value="" size="32"><div id="chkResult"></div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">确认密码</td>
<td><input name="u_pass2" type="password" class="srk" id="u_pass2"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">真实姓名:</td>
<td><input name="u_zssm" type="text" class="srk" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">姓别:</td>
<td><p>
<label>
<input type="radio" name="u_xb" value="男" id="RadioGroup1_0">
男</label>
<label>
<input type="radio" name="u_xb" value="女" id="RadioGroup1_1">
女</label>
<br>
</p></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">年龄:</td>
<td><input name="u_nialin" type="text" class="srk" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">电话:</td>
<td><input name="u_tel" type="text" class="srk" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">QQ号:</td>
<td><input name="u_qq" type="text" class="srk" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">邮箱:</td>
<td><input name="u_email" type="text" class="srk" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">验证码:</td>
<td><input name="yzm" type="text" id="yzm" size="4">
<img src="safecode.asp" name="safecode" align="absbottom" id="safecode" />[<a href="#" onclick="getcode();" title="点击刷新验证码">刷新</a>][<a href="#" onclick="voice();" title="点击语音听取验证码">语音</a>]
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="voices" style="display:none;">
<param name="Filename" value="" />
</object></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"><input name="ip" type="hidden" id="ip" value="<%= Request.ServerVariables("REMOTE_ADDR")
%>"></td>
<td><input type="submit" value="插入记录"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
中华游戏网 cnyouw.cn