<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<!--#include file="../Include/Class_Pass.asp" -->
<% 
'//定义变量
Dim Rs,SQL,Tmp(3)
Dim UserName,Perid,Password,UserEmail,Question,Answer,JobType
Dim RealName,Sex,Nation,Edus,Marry,Age,LastSchool,ZyClass,Speciality,Door_Area,Door_City
Dim Locus_Area,Locus_City,Stature,Byear,BirthYear,BirthMonth,BirthDay,PersonPhone,MsnQQ,WebHome
Dim Codeid,CodeType,Mt,ZipCode,Address,Tizhong,LastIp

LastIp = Request.Servervariables("Remote_Addr")
'//验证是否有同名用户或者同邮件的用户
UserName                     = Replace_Text(Request.Form("username"))
Password                     = Replace_Text(Request.Form("password"))
Password2					 = Password
Password                     = Md5(Password)
Perid                        = Replace_Text(Request.Form("perid"))
UserEmail                    = Replace_Text(Request.Form("useremail"))
Cityid 						 = Replace_Text(Request("Cityid"))

Set Rs = Server.Createobject("ADODB.recordset")
'//检测是否有同名帐号
Rs.Open "Select UserName,UserEmail,Perid From [pH_Person_Base] Where Username='"&username&"' or Useremail='"&useremail&"'  or Perid='"&Perid&"'",Conn,1,1

If Not Rs.Eof Then
    '//同名的帐号
	If Rs("Username") = UserName or Rs("Perid") = Perid Then
	    CloseRs
		CloseDB
		Response.write "<script >alert('"&Cls_WebName&" 提示：\n\n对不起，你的帐号已经使用了,请重新选择帐号并继续注册...');history.back(-1);</script>"
		Response.end
    End if
	'//同名的邮件
    If Rs("Useremail") = Useremail Then
	    CloseRs
	    CloseDB
		Response.write "<script >alert('"&Cls_WebName&" 提示：\n\n对不起，系统中有同名的邮箱,请重新选择邮箱并继续注册...');history.back(-1);</script>"
	    Response.end
    End if

End if 
Rs.Close


'//提交数据
JobType                    = Replace_text(Request.Form("jobtype"))
Question                   = Replace_Text(Request.Form("Question"))
Answer                     = Replace_Text(Request.Form("Answer"))
RealName                   = Replace_Text(Request.Form("RealName"))
Sex                        = Replace_Text(Request.Form("Sex"))
Nation                     = Replace_Text(Request.Form("Nation"))
Edus                       = Replace_Text(Request.Form("Edus"))
Marry                      = Replace_Text(Request.Form("Marry"))
BirthYear                  = Replace_Text(Request.Form("BirthYear"))
Age                  	   = Cint(Year(Date())) - Cint(BirthYear)
LastSchool                 = Replace_Text(Request.Form("LastSchool"))
ZyClass                    = Replace_Text(Request.Form("ZyClass"))
Speciality                 = Replace_Text(Request.Form("Speciality"))
Door_Area                  = Replace_Text(Request.Form("huji"))
Door_City                  = Replace_Text(Request.Form("huji1"))
Locus_Area                 = Replace_Text(Request.Form("x_suozaidi"))
Locus_City                 = Replace_Text(Request.Form("x_suozaidi1"))
Stature                    = Replace_Text(Request.Form("Stature"))
Tizhong                    = Replace_Text(Request.Form("Tizhong"))
Byear                      = Replace_Text(Request.Form("Byear"))
BirthMonth                 = Replace_Text(Request.Form("BirthMonth"))
BirthDay                   = Replace_Text(Request.Form("BirthDay"))
PersonPhone                = Replace_Text(Request.Form("PersonPhone"))
MsnQQ                      = Replace_Text(Request.Form("MsnQQ"))
WebHome                    = Replace_Text(Request.Form("WebHome"))
Codeid                     = Replace_Text(Request.Form("Codeid"))
CodeType                   = Replace_Text(Request.Form("CodeType"))
Mt                         = Replace_Text(Request.Form("Mt"))
ZipCode                    = Replace_Text(Request.Form("ZipCode"))
Address                    = Replace_Text(Request.Form("Address"))

'//保存数据到数据库[pH_Person_Base]和[pH_Person_Info]表
SQL = "Insert Into [pH_Person_Base] (Perid,Username,Password,UserEmail,Journal,RegDate,LastIp,LastDate,LastUpdate_Time,LoginCount,Question,Answer,Websub,Flag,Nc_Best_Flag,Nc_Best_Level,Cityid) Values ('"&Perid&"','"&Username&"','"&Password&"','"&UserEmail&"',1,getdate(),'"&LastIp&"',getdate(),getdate(),1,'"&Question&"','"&Answer&"','www',0,0,0,"&Cityid&")"
Conn.Execute(SQL)  '//[pH_Person_Base]表

SQL = "Insert Into [pH_Person_Info] (Perid,UserName,RealName,Sex,Nation,Edus,Marry,Age,LastSchool,ZyClass,Speciality,Door_Area,Door_City,Locus_Area,Locus_City,Stature,Tizhong,Byear,BirthYear,BirthMonth,BirthDay,PersonPhone,MsnQQ,WebHome,InterView,ProvideHouse,Post,ViewClicks,ContactKeep,ResumeKeep,PhotoKeep,ResumeMode,Codeid,CodeType,Mt,ZipCode,Address,PerType,JobType,TopAll,Nc_Video,Video_Flag,Video_BestFlag,Industry,Websub) Values ('"&Perid&"','"&Username&"','"&Realname&"',"&Sex&",'"&Nation&"',"&Edus&","&Marry&","&Age&",'"&LastSchool&"','"&ZyClass&"','"&Speciality&"','"&Door_Area&"','"&Door_City&"','"&Locus_Area&"','"&Locus_City&"',"&Stature&","&TiZhong&","&Byear&","&BirthYear&","&BirthMonth&","&BirthDay&",'"&PersonPhone&"','"&MsnQQ&"','"&WebHome&"',0,0,0,0,0,0,0,1,'"&Codeid&"',"&CodeType&",'"&Mt&"','"&ZipCode&"','"&Address&"',1,"&JobType&",0,0,0,0,0,'www')"
Conn.Execute(SQL)  '//[pH_Person_Info]表

'//在论坛会员表中添加记录
'SQL = "Insert Into [User] (User_name,User_Pass,Login_Last_Date,Login_Last_Ip,Login_Count,Creat_Date,Up_Date,Pass_Matter,Pass_Key,Email,MsnQQ,Address,myWeb,TelPhone,RelName) Values ('"&Username&"','"&Replace_text(request.form("password"))&"',getdate(),'"&LastIp&"',1,getdate(),getdate(),'"&Question&"','"&Answer&"','"&UserEmail&"','"&MsnQQ&"','"&Address&"','"&WebHome&"','"&PersonPhone&"','"&Realname&"')"
'Conn.Execute(SQL)

'//网站登陆
Tmp(0) = Username
Tmp(1) = Password
Tmp(2) = Perid
Session("Person") = Tmp
Session("Server") = Request.ServerVariables("Server_Name")
'//论坛登陆
'Session("bbsusername") = Username
'Session("bbsuserflag") = 0
'//关闭数据库连接参数
CloseDB
'//发送邮件给会员
Set Fso = Server.CreateObject("Scripting.FileSystemObject") '///打开文件
Set FileAll = Fso.OpenTextFile(server.mappath("Mail_Register.htm"), 1)
HtmlStr = FileAll.ReadAll
HtmlStr = Replace(HtmlStr,"Html_Username",Username)
HtmlStr = Replace(HtmlStr,"Html_Password",Password2)
Set Fso = Nothing
Call SendEmail(UserEmail,HtmlStr,"您的帐号注册成功")
'//注册结束
Response.Write "<meta http-equiv=refresh content=""5;URL=User_Center.asp"">"
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../Css/Css_Offices.css" type=text/css rel=stylesheet>
<title><%= Cls_WebName %> -- 个人会员注册</title>
</head>

<body>
<p>&nbsp;</p><table width="80%" border="0" align="center" cellspacing="1" bgcolor="#eeeeee">
  <tr> 
    <td height="100" bgcolor="f5f5f5"><table width="90%" border="0" align="center" cellspacing="0" class="text01">
        <tr> 
          <td height="30" align="center">你已经成功地注册成为<font color="#FF0000"><%= Cls_WebName %></font>的个人会员 </td>
        </tr>
        <tr> 
          <td height="3" bgcolor="ff6600"></td>
        </tr>
        <tr> 
          <td height="30" align="center"><font color=#999999>如果不能跳转，请点击这里进入<a href="User_Center.asp"><font color=#999999>个人管理平台</font></a></font></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
