<%dbdns="../"%>

<!--#include file="../main.asp"-->
<!--#include file="../bbs/inc/md5.asp"-->
<%if request("action")="save" then
user=request("user")
pwd=request("pass")

'----------------------------------------以下读取数据库------------------------------------
set rs_dv=server.CreateObject("adodb.recordset")
Db = "../bbs/data/dvbbs7.mdb"
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(MyDbPath & db)
Set conn_dv = Server.CreateObject("ADODB.Connection")
	conn_dv.open ConnStr
sql_check="select * from dv_user where username='"&user&"'"
rs_dv.open sql_check,conn_dv,1,3                                             
if not rs_dv.eof then                                           '判断在论坛中是否有该用户注册.
response.write"<SCRIPT language=JavaScript>alert('该户名已经存在，请重新填写用户名。');javascript:history.go(-1)</SCRIPT>"
response.end 
end if
'-------------------------------------------判断结束----------------------------------------------
set rs=server.createobject("adodb.recordset")
sql="select * from dlxf_Job_qz where dlxf_user='"&user&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.write"<SCRIPT language=JavaScript>alert('该户名已经存在，请重新填写用户名。');javascript:history.go(-1)</SCRIPT>"
response.end 
else
set rs=server.createobject("adodb.recordset")
sql="select * from dlxf_Job_qz where (dlxf_id is null)" 
rs.open sql,conn,1,3
rs.addnew
password=md5(pwd,32)                     '取32位
rs("dlxf_user")=user
rs("dlxf_pwd")=password
rs("dlxf_dateandtime")=date()
rs("dlxf_lastdate")=date()+cityfreejob
rs("dlxf_key1")=cityjobqzkey
rs.update
'-----------------------------------写入会员数据库(普通会员注册)-----------------------------------------
set rs_dv1=server.CreateObject("adodb.recordset")
Db = "../bbs/data/dvbbs7.mdb"
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(MyDbPath & db)
Set conn_dv = Server.CreateObject("ADODB.Connection")
	conn_dv.open ConnStr
	sql_dv="select * from dv_user "
    rs_dv1.open sql_dv,conn_dv,1,3 
	rs_dv1.AddNew
		password=md5(pwd,16)             '取16位
		rs_dv1("UserName")=user
		rs_dv1("UserPassword")=password
		rs_dv1("UserEmail")="service@126.com"
		rs_dv1("Userclass")="新手上路"
		rs_dv1("TitlePic")="level0.gif"
		rs_dv1("UserQuesion")="1"
		rs_dv1("UserAnswer")="a0b923820dcc509a"           '问题答案也是1
		rs_dv1("TruePassWord")="r84y6115O3q4tQFJ"         '随意设定的
		rs_dv1("UserIM")="||||||||||||||||||"
		rs_dv1("UserSign")=""
		rs_dv1("UserPost")=0
		rs_dv1("userlastip")="127.0.0.1"                   '随意设定ip地址.
		rs_dv1("UserGroupID")=9
		rs_dv1("Lockuser")=0
		rs_dv1("UserSex")=0                                '默认为女性
		rs_dv1("UserGroup")=""
		rs_dv1("JoinDate")=Now()
		rs_dv1("UserFace")="Images/userface/image1.gif"
		rs_dv1("userviews")=0
		rs_dv1("UserWidth")=32
		rs_dv1("Usertoday")="0|0|0|0|0"
		rs_dv1("UserHeight")=32
		rs_dv1("UserLogins")=1
		rs_dv1("LastLogin")=Now()
		rs_dv1("userWealth")=108
		rs_dv1("userEP")=66
		rs_dv1("usercP")=33
		rs_dv1("UserInfo")="||||||||||||||||||||||||||||||||||||||||||"
		rs_dv1("UserSetting")="1|||0|||0"
		rs_dv1("UserPower")=0
		rs_dv1("UserDel")=0
		rs_dv1("UserIsbest")=0
		rs_dv1("UserMoney")=0
		rs_dv1("UserTicket")=0
		rs_dv1("UserFav")="陌生人,我的好友,黑名单"
		rs_dv1("IsChallenge")=0
		rs_dv1("userisava")=0
		rs_dv1("UserHidden")=0
		rs_dv1.Update
		conn_dv.Execute("UpDate Dv_Setup Set Forum_UserNum=Forum_UserNum+1,Forum_lastUser='"&user&"'")
'----------------------------------------------数据库写入结束-------------------------------------------------
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
'===========================================


if cityjobqzkey=1 then
response.write"<script>alert('用户注册成功！谢谢您的参与');window.open('../user_login.asp','_self')</script>"
response.end
elseif cityjobqzkey=0 then
response.write"<script>alert('用户注册成功！请等待管理员的开通');window.open('../user_login.asp','_self')</script>"
response.end
end if

end if%>

<%=citycss%>
<link href="css/Untitled-1.css" rel="stylesheet" type="text/css">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=citytitle%></title>
<script language="JavaScript">
<!--
function checkdata() {
if( isNumberString(addform.user.value,"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_")!=1 || addform.user.value.length<2 || addform.user.value.length>16) {
alert("\用户注册出错，下面是产生错误的可能原因：\n\n·用户名必须是2-16位的数字、英文或下划线")
return false;
}
if( addform.pass.value =="" || addform.pass.value.length<4 || addform.pass.value.length>16) {
alert("\用户注册出错，下面是产生错误的可能原因：\n\n·请输入 4-16 位的密码")
return false;
}
if( addform.pass1.value =="" || addform.pass1.value.length<4 || addform.pass1.value.length>16) {
alert("\用户注册出错，下面是产生错误的可能原因：\n\n·请输入您的确认密码")
return false;
}
if( addform.pass.value != addform.pass1.value ) {
alert("\用户注册出错，下面是产生错误的可能原因：\n\n·密码与确认密码不一致，请重新输入")
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}
// -->
</script>
</head>

<body topmargin="0">
<%dlxf_top%>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<td height="25">当前位置：<a href=../index.asp>首页</a> >> <a href=../reg.asp>注册会员</a> >> <a href=reg.asp>普通会员注册</a></td>
  </tr>
  <tr>
    <td height=400 valign=top>
<!--==================-->
<%if webkey2=1 then
webkey22
else%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<form name="addform" method="post" action="reg.asp?action=save" onSubmit="return checkdata()">
  <tr>
    <td height=30 background="../img/tit_4.GIF" class=f14 colspan=2>　<strong><font color=#ffffff>::个人登录信息::</font></strong></td>
  </tr>
  <tr>
    <td height=80 colspan=2></td>
  </tr>
  <tr>
    <td width="40%" align="right">登录用户名 &nbsp;</td>
	<td width="60%" height="60"><input name="user" type="text" size="20" maxlength="16" class="input2"><br>2-16个<font color=red>英文、数字或下划线</font></td>
  </tr>
  <tr>
    <td align="right">登录密码 &nbsp;</td>
	<td height="40"><input name="pass" type="password" size="20" maxlength="16" class="input2"> 4-16个字符</td>
  </tr>
  <tr>
    <td align="right">确认密码 &nbsp;</td>
	<td height="40"><input name="pass1" type="password" size="20" maxlength="16" class="input2"> 4-16个字符</td>
  </tr>
  <tr align="center">
    <td colspan="2" height="80"><input type="image" name="img" src="../img/reg.gif" style="border:0"></td>
  </tr>
</form>
</table>
<%end if%>
<!--==================-->
	</td>
  </tr>
</table>
<!--====== bottom ========-->
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor=#ffffff>
<tr><td height=10></td></tr>
<tr><td height=2 bgcolor=#4795EC></td></tr>
  <tr>
    <td align="center" height=80><%=citybottom%></td>
  </tr>
</table>
</body>
</html>
