52,797
社区成员
发帖
与我相关
我的任务
分享
With adoComm
.ActiveConnection = Conn
.CommandType = 4
.CommandText = "checkuser_reg"
'try
.Parameters.Append adoComm.CreateParameter("@name", adVarChar, adParaminput, 20,accounts)
' .Parameters.Item("@username").Value = accounts
.Execute
End With
With adoComm
.ActiveConnection = Conn
.CommandType = 4
.CommandText = "checkuser_reg"
'try
.Parameters.Append adoComm.CreateParameter("@name", adVarChar, adParaminput, 20,accounts)
' .Parameters.Item("@username").Value = accounts
.Execute
End With
<!--#include file="CONN.ASP"-->
<%
accounts=nosql("accounts")
Set adoComm = CreateObject("ADODB.Command")
With adoComm
.ActiveConnection = Conn
.CommandType = 4
.CommandText = "checkuser_reg"
.Parameters.Item("@username").Value = accounts
.Execute
End With
if adocomm.Parameters.Item("@backresult") = 1 then
result="0"
Else
result="1"
End if
set adocomm=nothing
response.write result
%>
CREATE PROCEDURE checkuser_reg
@name NVARCHAR(20)
AS
BEGIN
SELECT * FROM users WHERE Name=@name
END
GO
function checkAccounts ( me ){
if( ! isPassword( me.value ) || !/[A-Za-z0-9]/.test( me.value )){ _( "chkaccounts" ).style.display = "";
_( "chkaccountsval" ).style.display = "none";
}
else {
_( "chkaccounts" ).style.display = "none";
_( "chkaccountsval" ).style.display = "";
validate(me.value, "reg_accounts" ,'chkaccountsvalstr')
}
}
var serverAddress = "checkusername.asp";
var cache = new Array();
function getHttpObject() {
var objType = false;
try {
objType = new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e) {
try {
objType = new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e) {
objType = new XMLHttpRequest();
}
}
return objType;
}
function getAJAX(postBody,messageID){
var theHttpRequest = getHttpObject();
theHttpRequest.onreadystatechange = function() {processAJAX(messageID);};
theHttpRequest.open("POST", serverAddress, true);
theHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
theHttpRequest.send(postBody);
function processAJAX(messageID){
if (theHttpRequest.readyState == 4) {
if (theHttpRequest.status == 200) {
var msgid=theHttpRequest.responseText
var msgstr
if (msgid==1)
{
msgstr="恭喜,帐号可用"
}
else
{
msgstr="帐号不可用,请选择其它帐号"
}
document.getElementById(messageID).innerHTML = msgstr;
setTimeout("validate();", 500);
}
else {
document.getElementById(messageID).innerHTML="<p>错误信息: " + theHttpRequest.statusText +"<\/p>";
}
}
}
}
function validate(inputValue, fieldID, messageID){
if (fieldID){
inputValue = encodeURIComponent(inputValue);
fieldID = encodeURIComponent(fieldID);
cache.push("accounts=" + inputValue + "&fieldID=" + fieldID);
// alter(inputValue);
}
if (cache.length > 0){
var cacheEntry = cache.shift();
getAJAX(cacheEntry,messageID);
}
}
function checkPWD( me ){
if( ! isPassword( me.value )) _( "chkPwd" ).style.display = "";
else {
_( "pwds" ).innerHTML = "<font color=black>密码安全程度:</font>"+checkStrong(me.value);
_( "chkPwdStr" ).style.display = "";
}
}
function isPassword( str ){
if (str.length < 6 || str.length > 16) return false;
var len;
var i;
len = 0;
for (i=0;i<str.length;i++){
if (str.charCodeAt(i)>255) return false;
}
return true;
}
function editpwd( me )
{
if (( me.value.length > 16 || me.value.length < 6) && me.value.length!=0) {
_( "chkPwd" ).style.display = "";
} else {
var len;
var i;
len = 0;
for (i=0;i<me.value.length;i++){
if (me.value.charCodeAt(i)>255){
_( "chkPwd" ).style.display = "";
return false;
}
}
}
}
function checkNumber( num ,max){
if( /^[0-9]+$/.test( num ) && num <=max)
return true;
else return false;
}
function birthPress(){
var k = window.event.keyCode;
if (k < 48 || k > 57)
window.event.keyCode = 0 ;
}
function confirmPwd( me ){
var oPassword = _( "password" );
if( ! ( me.value == oPassword.value ) ) _( "pwdConfirm" ).style.display = "";
}
function checkVerifyCode( me ){
if( me.value == "" || !( /^\w{6}$/.test( me.value ) ) || me.value.length != 6 ) _( "verifyConfirm" ).style.display = "";
}
function checkBirthday() {
if (_("year").value == "" || !checkNumber(_("month").value,12) || !checkNumber(_("date").value,31)){
_( "birthdayConfirm" ).style.display = "";
}
}
function isAnswer( answer ){
return /^[^%&]{2,20}$/.test( answer );
}
function checkGender(){
for( var i = 0; i < document.getElementsByName("gender").length; i++ ) {
if(document.getElementsByName("gender")[i].checked) return true;
}
return false;
}
function checknickname( customquestion )
{
var oCQ = _( 'nicknamestr' );
// showCQChk( "yes" );
if ( customquestion.value == null || customquestion.value == "" )
{
oCQ.innerHTML = "请填写昵称";
return;
}
if ( customquestion.length > 20 )
{
oCQ.innerHTML = "昵称应不超过20个字符";
return;
}
if(! /^[^%&]+$/.test( customquestion.value ) )
{
oCQ.innerHTML = "昵称中不能包含'%'和'&'这两个字符";
return;
}
_( 'chknickname' ).style.display = 'none';
// showCQChk( "no" );
}
function isMobile( mobile ){
return /^13\d{9}$/.test( mobile ) | /^15\d{9}$/.test( mobile );
}
function isAlt_email( alt_email ){
return ( /^[^@]+@[^@]+\.[^@]+$/.test( alt_email ) && alt_email.length<128 );
}
function checkAltEmail( me ){
if( ! isAlt_email( me.value ) ) _( "altConfirm" ).style.display = "";
}
function checkMobile( me ){
if( ! isMobile( me.value ) ) _( "mobileConfirm" ).style.display = "";
}
function checkAnswer( me ){
if( ! isAnswer( me.value ) ) _( "answerConfirm" ).style.display = "";
}
function _(id) {
return document.getElementById(id);
}
function CharMode(iN){
if (iN>=48 && iN <=57) //数字
return 1;
if (iN>=65 && iN <=90) //大写字母
return 2;
if (iN>=97 && iN <=122) //小写
return 4;
else
return 8; //特殊字符
}
//bitTotal函数
//计算出当前密码当中一共有多少种模式
function bitTotal(num){
modes=0;
for (i=0;i<4;i++){
if (num & 1) modes++;
num>>>=1;
}
return modes;
}
//checkStrong函数
//返回密码的强度级别
function checkStrong(sPW){
Modes=0;
for (i=0;i<sPW.length;i++){
//测试每一个字符的类别并统计一共有多少种模式.
Modes|=CharMode(sPW.charCodeAt(i));
}
switch(bitTotal(Modes)) {
case 1:
return "<font color='#FF0000'>弱</font>";
break;
case 2:
return "<font color='#FF9900'>中</font>";
break;
case 3:
return "<font color='#33CC00'>强</font>";
break;
default:
return "<font color='#FF0000'>弱</font>";
}
}
function fCheck(){
// if( !_("readed").checked ) {
// alert("您需要接受服务条款后才能注册!");
// _("readed").focus();
// return false;
// }
// if( ! isPassword( _("reg_accounts" ).value) || !/[A-Za-z0-9]/.test( _("reg_accounts" ).value))
// {
// alert("游戏帐号必须是6~16位的英文字母、数字或下划线的组合!");
// _("reg_accounts").select();
/// _("reg_accounts").focus();
// / return false;
// }
var nickname = _("nickname").value;
if ( nickname == null || nickname == "" ){
alert("请填写昵称");
_("nickname").select();
_("nickname").focus();
return false;
}
if ( nickname.length > 20 ){
alert("昵称应不超过20个字符");
_("nickname").select();
_("nickname").focus();
return false;
}
if(! /^[^%&]+$/.test( nickname ) ){
alert("昵称中不能包含'%'和'&'这两个字符");
_("nickname").select();
_("nickname").focus();
return false;
}
if (_("password").value != "")
{
if( ! isPassword( _("password").value ) || !/^[^%&]*$/.test( _("password").value )) {
alert("\请重新输入密码,密码由至少6个英文字母、数字、特殊字符等组成(不能包含'%'和'&'这两个字符) !");
_("password").select();
_("password").focus();
return false;
}
}
if( _("password_cf").value != _("password").value ) {
alert("\两次密码输入不一致 !");
_("password_cf").select();
_("password_cf").focus();
return false;
}
if(!isAlt_email(_("email").value)) {
alert("请正确填写邮箱!");
_("email").select();
_("email").focus();
return false;
}
}
<!--#include FILE="CONN.ASP"-->
<!--#include FILE="inc/md5.ASP"-->
<%
dim okmsg
okmsg=""
othermsg=""
accounts=nosql("reg_accounts")
nickname=nosql("nickname")
password=request("password")
email=nosql("email")
sex=nosql("sex")
pic=nosql("pic")
reg_rndnumber=nosql("reg_rndnumber")
automoney=0 '注册用户自动赠送U币数
Function ValidatePassword(strPassword)
if len(strPassword)>=6 and len(strPassword)<=16 then
ValidatePassword=true
else
ValidatePassword=false
end if
End Function
Function ValidateAccounts(strAccounts)
Dim re
Set re = new RegExp
re.IgnoreCase = false
re.global = false
'/[\W]/g
re.Pattern = "\w{6,16}"
ValidateAccounts = re.Test(strAccounts)
End Function
Function ValidateEmailAddr(strEmailAddr)
Dim re
Set re = new RegExp
re.pattern = "^[^@]+@[^@]+\.[^@]+$"
ValidateEmailAddr=re.Test(strEmailAddr)
end function
function validateNickname(strNickname)
Dim re
Set re = new RegExp
re.pattern = "^[^%&]+$"
validateNickname=re.Test(strNickname)
end function
function validateSex(strSex)
if strSex=0 or strSex=1 then
validateSex=true
exit function
end if
end function
function validatePic(strPic)
if IsNumeric(strPic) then
validatePic=true
exit function
end if
end function
dim errmsg
errmsg=""
sub valiStr()
'regip=Request.ServerVariables("REMOTE_ADDR")
'if regip="222.135.109.45" then
' errmsg="你的IP已经被管理员封闭。请联系管理员系统禁止注册!"
' exit sub
'end if
if ValidateAccounts(accounts)<>true then
errmsg="游戏帐号不合法,请重新填写!"
exit sub
end if
if ValidatePassword(Password)<>true then
errmsg="密码设定不合规定,请按要求填写!"
exit sub
end if
if ValidateEmailAddr(email)<>true then
errmsg="Email填写错误!"
exit sub
end if
if validateNickname(nickname)<>true then
errmsg="昵称填写错误"
exit sub
end if
if validateSex(Sex)<>true then
errmsg="性别"
exit sub
end if
if validatePic(Pic)<>true then
errmsg="形象填写错误"
exit sub
end if
if Session("CheckCode")="" then
errmsg="验证码过期!"
exit sub
elseif reg_rndnumber<>Session("CheckCode") then
errmsg="验证码填写错误~"
exit sub
end if
Set adoComm = CreateObject("ADODB.Command")
With adoComm
.ActiveConnection = Conn
.CommandType = 4
.CommandText = "checkuser_reg"
.Parameters.Item("@username").Value = accounts
.Execute
End With
if adocomm.Parameters.Item("@backresult")=1 then
errmsg="抱歉,此游戏帐号已被使用!请选择另一个!"
Set adoComm = Nothing
exit sub
end if
' if not rs.eof then
' errmsg="抱歉,此游戏帐号已被使用!请选择另一个!"
' rs.close
' set rs=nothing
' exit sub
' end if
password=md5(password)
'''''================添加用户开始
' 修改数据库 userID 数据类型=>自动编号 RegTM=>默认值 getdate()
With adoComm
.ActiveConnection = Conn
.CommandType = 4
.CommandText = "edituser"
.Parameters.Item("@userid").Value = 0
.Parameters.Item("@username").Value = accounts
.Parameters.Item("@scrname").Value = nickname
.Parameters.Item("@pass").Value = password
.Parameters.Item("@LogoID").Value = pic
.Parameters.Item("@Boy").Value = sex
.Parameters.Item("@LastLoginIP").Value = Request.ServerVariables("REMOTE_ADDR")
.Parameters.Item("@email").Value = email
.Execute
End With
set adocomm=nothing
' sql="insert into users([name],scrname,pass,webpass,LogoID,Boy,LastLoginIP,RegIP,email,money) values ('" & accounts & "','" & _
' nickname & "','" & password & "','" & password & "'," & pic & "," & sex & ",'" & Request.ServerVariables("REMOTE_ADDR") _
' & "','" & Request.ServerVariables("REMOTE_ADDR") & "','" & email & "'," & automoney & ")"
' conn.execute(sql)
session("CheckCode")=""
okmsg="注册成功!您现在可以进入游戏了。"
session("Uaccounts")=accounts
show="||||||7|6|5||4||3|2||||1|||||||"
if sex=1 then show="||||||14|13|12||11||10|9||||8|||||||"
Cookies_str=accounts & "!*" & nickname & "!*" & automoney & "!*0!*" & show
for i=1 to len(cookies_str)
str=str & AscW(left(right(cookies_str,i),1)) & "a"
next
response.Cookies("userinfo")=left(str,len(str)-1)
othermsg=othermsg & "<table width='263' border='0' cellspacing='1' align='center'>"
othermsg=othermsg & "<tr><td width='259'>您现在可以:</td></tr>"
othermsg=othermsg & "<tr><td nowrap>1、<a href='game.exe' class='blue'>点击此处下载安装游戏</a></td></tr>"
othermsg=othermsg & "<tr><td nowrap>2、<a href='editinfo.asp' class='blue'>点击此处“修改注册资料”</a></td></tr>"
othermsg=othermsg & "<tr><td nowrap>3、<a href='userinfo.asp' class='blue'>点击此处“填写/修改详细资料”</a></td></tr>"
othermsg=othermsg & "<tr><td nowrap>4、<a href='passprotect.asp' class='blue'>点击此处“填写密码保护和补充信息”</a></td></tr>"
othermsg=othermsg & "<tr><td nowrap>5、<a href='bbs\' class='blue'>点击此处“登录游戏论坛”</a></td></tr>"
othermsg=othermsg & "<tr><td nowrap>6、<a href='index.asp' class='blue'>点击此处关闭该页</a></td></tr>"
othermsg=othermsg & "</table>"
end sub
call valiStr()
if errmsg<>"" then
response.write "<script>alert('"&errmsg&"');"
response.write "location.href='javascript:history.go(-1)';</script>"
end if
if okmsg<>"" then
response.cookies("okmsg")=okmsg
response.cookies("othermsg")=othermsg
response.write "<script>location.href='viewresult.asp';</script>"
end if
%>
<!--#include FILE="CONN.ASP"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户注册</title>
</head>
<body onLoad="init();">
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<script language="javascript">
var fixed_menu=3;
function showsub(tabid,tabnumber){
for (i = 1;i<=tabnumber;i++) {
document.getElementById("tab"+i).style.display = "none";
}
document.getElementById("tab"+tabid).style.display = "";
}
function selectimg(image,id){
var url=document.formRegStep1Main.pic.value
document.headimg.src=url;
}
</script>
<!--#include FILE="head.asp"-->
<script src="regvalid.js"></script>
<tr>
<td><table width="537" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="537" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form action="reg_save.asp" method="post" name="formRegStep1Main" onSubmit="return fCheck();">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="82%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="6%" height="30"> </td>
<td width="33%" height="30">游戏帐号</td>
<td width="61%" height="30">
<input name="reg_accounts" type="text" size="16" onBlur="checkAccounts( this );" onfocus="_( 'chkaccounts' ).style.display = 'none';showsub(1,7);"/ class="c1"></td>
</tr>
<tr id="chkaccounts" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" class='red'>请按要求输入游戏帐号</td>
</tr>
<tr id="chkaccountsval" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" class="red" id="chkaccountsvalstr"><marquee behavior="alternate">...正在验证,请稍候...</marquee></td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">昵称</td>
<td height="30"><input name="nickname" type="text" class="c1" id="nikcname" onfocus="_( 'chknickname' ).style.display = 'none';showsub(2,7);" onblur="_( 'chknickname' ).style.display = '';checknickname( this );" size="16" maxlength="19"/></td>
</tr>
<tr id="chknickname" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" class='red' id="nicknamestr">请按要求输入昵称</td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">密码</td>
<td height="30"><input name="password" type="password" class="c1" onfocus="_( 'chkPwd' ).style.display = 'none';_( 'chkPwdStr' ).style.display = 'none';showsub(3,7)" onblur="checkPWD( this );" size="20"/></td>
</tr>
<tr id="chkPwd" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" class='red'>请按要求输入密码</td>
</tr>
<tr id="chkPwdStr" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" id="pwds" class='red'>密码安全程度:</td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">密码确认</td>
<td height="30"><input name="password_cf" type="password" class="c1" onFocus="_( 'pwdConfirm' ).style.display = 'none';showsub(4,7);" onBlur="confirmPwd( this )" size="20"/></td>
</tr>
<tr id="pwdConfirm" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" class='red'>重新输入密码错误</td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">电子信箱</td>
<td height="30"><input name="email" type="text" class="c1" id="email" onfocus="_( 'altConfirm' ).style.display = 'none';showsub(5,7);" onblur="checkAltEmail( this );" size="20" value="webmaster@xz6699.com"/></td>
</tr>
<tr id="altConfirm" style="display:none;">
<td height="20"> </td>
<td height="20"> </td>
<td height="20" class='red'>邮箱格式错误</td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">性别</td>
<td height="30"><select name="sex">
<option value="1">男</option>
<option value="0">女</option>
</select> </td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">形象</td>
<td height="30"><img src="user/face/1.jpg" name="headimg" border="0" />
<select name="pic" onChange="document.headimg.src='user/face/'+this.value+'.jpg'" onFocus="showsub(6,7);">
<%
for i=1 to 140
response.write("<option value="&i&">" & i & "</option>")
next
%>
</select></td>
</tr>
<tr>
<td height="30"> </td>
<td height="30">验证码</td>
<td height="30"><input name="reg_rndnumber" type="text" class="c1" onfocus="showsub(7,7);" size="8"/> <img src='check/rndnumber.asp' align='absmiddle'></td>
</tr>
</table></td>
</tr>
<tr>
<td height="30" colspan="4"><input type="checkbox" name="readed" value="checkbox" checked="checked" />
我已阅读并同意《<a href="about.asp?id=3" class="uline">用户服务条款</a>》</td>
</tr>
<tr>
<td height="25" align="right"><input name="image" type="image" src="images/reg_.jpg" width="78" height="29" border="0" /></td>
</tr>
</table>
</form></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<script src="foot.js"></script>
</table>
</body>
</html>