<?php
/**
 * @version        Somao_Search X1.0 9:23 2012-1-1 Somao $
 * @package        Somao_Search.Site
 * @copyright      Copyright (c) 2009 - 2012, Somao, Inc.
 * @license        http://www.somao123.com/
 * @link           http://www.somao.cc/
 */
require("global.php");
include '../uc_client/client.php';
$action=trim(HtmlReplace($_POST["action"]));
if($action=="savereg")
{
     $user_name=trim(HtmlReplace($_POST["user_name"]));
	 $password=trim(HtmlReplace($_POST["passwd1"]));
	 $email=trim(HtmlReplace($_POST["email"]));
	 $real_name=trim(HtmlReplace($_POST["real_name"]));
	 $question=trim(HtmlReplace($_POST["question"]));
	 $answer=trim(HtmlReplace($_POST["answer"]));
	 $qq=trim(HtmlReplace($_POST["qq"]));
	 $tel=trim(HtmlReplace($_POST["tel"]));
	 #api{{
     if(constant('UC_OFF')==1) {
			$check=$db->get_one("select * from ve123_member where user_name='".$user_name."'");
	        if(empty($check)){
			  $uid = uc_user_register($user_name, $password, $email);
               if($uid <= 0)
               {
                if($uid == -1){
					jsalert ("用户名不合法!");
		            exit(); 
                } elseif($uid == -2){
					jsalert ("包含要允许注册的词语!");
		            exit(); 
                }elseif($uid == -3){
					jsalert ("你指定的用户名 {$user_name} 已存在，请使用别的用户名!");
		            exit(); 
                }elseif($uid == -5){
					jsalert ("你使用的Email 不允许注册!");
		            exit();
                }elseif($uid == -6){
					jsalert ("你使用的Email已经被另一帐号注册，请使其它帐号!");
		            exit(); 
                }else{
					jsalert ("注册失败!");
		            exit();
                }
               }else {
				$ucsynlogin = uc_user_synlogin($uid);
				$array=array('user_name'=>$user_name,'password'=>md5($password),'real_name'=>$real_name,'question'=>$question,'answer'=>$answer,'email'=>$email,'reg_ip'=>ip(),'reg_time'=>time(),'points'=>$config["zs_points"],'qq'=>$qq,'tel'=>$tel);
		        $db->insert("ve123_member",$array);
		        $_SESSION["user_name"]=$user_name;
		        header("location:./");
               }
	        }else{
				jsalert ("用户名已存在,请换个再试!");
		        exit(); 
	      }
        }else{
			$check=$db->get_one("select * from ve123_member where user_name='".$user_name."'");
	        if(empty($check)){
	         $array=array('user_name'=>$user_name,'password'=>md5($password),'real_name'=>$real_name,'question'=>$question,'answer'=>$answer,'email'=>$email,'reg_ip'=>ip(),'reg_time'=>time(),'points'=>$config["zs_points"]);
		     $db->insert("ve123_member",$array);
		     $_SESSION["user_name"]=$user_name;
		     header("location:./");
	        }else{
				jsalert ("用户名已存在,请换个再试!");
		        exit(); 
	        }
		}
      #/aip}}
		
	 
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>注册 - 推广中心</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script>
function fEvent(sType,oInput){
  switch (sType){
   case "focus" :
    oInput.isfocus = true;
   case "mouseover" :
    oInput.style.borderColor = '#9ecc00';
    break;
   case "blur" :
    oInput.isfocus = false;
   case "mouseout" :
    if(!oInput.isfocus){
     oInput.style.borderColor='#84a1bd';
    }
    break;
  }
 }
</script>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
<script src="css/WebResource.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
</head>
<body style="background:#dfebf5 url(css/log.jpg) repeat-x left top;text-align:left">
<div id="wrap">
  <div class="head">
    <div class="http://www.zxyt.cn/user/css/logo2.png"></div>
    <div class="logotxt">- 注册</div>
    <div class="headlink" ><a href="/">首页</a> | <a href="login.php">已有帐号返回登录</a> | <a href="http://www.zxyt.cn/" target="_blank">泽许官方</a></div>
    <div class="clearit"></div>
  </div>
  <div class="main">
    <form name="form1" method="post" action="reg.php" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
    <input type=hidden name=action value=savereg>
     <div class="main_top_com">
        <div style="height:34px;"></div>
        <p class="title" style="margin-top:10px;">选择用户名<span class="title_sub orange">您用于登陆的账户名称，注册后不能修改</span> </p>
        <ul class="maintable">
          <li>
            <div class="mt_l"><span class="red">*</span>用户名：</div>
            <div class="mt_r" style="z-index:3;">
              <div class="inputbox">
                <input name="user_name" type="text" id="user_name" maxlength="17" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RequiredFieldValidator1" style="color:Red;display:none;">不能为空！</span>
              </div>
              <div class="inputtxt zi_9">4-16位之间，请用英文小写、数字、下划线，不能全部是数字或下划线。</div>
            </div>
          </li>
        </ul>
      </div>
      <div class="main_cen">
        <p class="title">设置安全信息<span class="title_sub orange">以下信息对保护您的帐号安全极为重要，请慎重填写并牢记</span></p>
        <ul class="maintable">
          <li>
            <div class="mt_l"><span class="red">*</span>登录密码：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="passwd1" type="password" id="passwd1" maxlength="17" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RequiredFieldValidator2" style="color:Red;display:none;">不能为空！</span>
              </div>
              <div class="inputtxt zi_9">6-16位字符（字母、数字、符号），区分大小写</div>
            </div>
          </li>
          
          <li>
            <div class="mt_l"><span class="red">*</span>再次输入密码：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="passwd2" type="password" id="passwd2" maxlength="17" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RequiredFieldValidator3" style="color:Red;display:none;">不能为空！</span>
                <span id="CompareValidator1" style="color:Red;display:none;">两次输入的密码不一致！</span>
              </div>
            </div>
          </li>
          
          <li>
            <div class="mt_l"><span class="red">*</span>找回密码问题：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="question" type="text" id="question" maxlength="17" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RequiredFieldValidator31" style="color:Red;display:none;">不能为空！</span>
              </div>
            </div>
          </li>
          
          <li>
            <div class="mt_l"><span class="red">*</span>找回密码答案：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="answer" type="text" id="answer" maxlength="17" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RequiredFieldValidator32" style="color:Red;display:none;">不能为空！</span>
              </div>
            </div>
          </li>
          
          <li>
            <div class="mt_l">电子邮件：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="email" type="text" id="email" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RegularExpressionValidator3" style="color:Red;display:none;">邮箱格式不正确！</span>
                <span id="RegularExpressionValidator33" style="color:Red;display:none;">不能为空！</span>
              </div>
              <div class="inputtxt zi_9">您常用的电子邮件地址</div>
            </div>
          </li>
        </ul>
        <p class="title">填写个人资料</p>
        <ul class="maintable">
          <li>
            <div class="mt_l"> <span class="red">*</span>手机号码：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="tel" type="text" id="tel" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RegularExpressionValidator1" style="color:Red;display:none;">手机或固定电话号码不正确！</span>
                <span id="RequiredFieldValidator4" style="color:Red;display:none;">不能为空！</span>
              </div>
              <div class="inputtxt zi_9">4-20位数字，您的电话或者手机号码</div>
            </div>
          </li>
          <li>
            <div class="mt_l"> <span class="red">*</span>QQ号码：</div>
            <div class="mt_r">
              <div class="inputbox">
                <input name="qq" type="text" id="qq" maxlength="20" onBlur="fEvent('blur',this)" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onMouseOut="fEvent('mouseout',this)" />
              </div>
              <div class="onWrap">
                <span id="RegularExpressionValidator2" style="color:Red;display:none;">QQ号码不正确！</span>
                <span id="RequiredFieldValidator5" style="color:Red;display:none;">不能为空！</span>
              </div>
              <div class="inputtxt zi_9">5-20位数字，您的QQ号码</div>
            </div>
          </li>
          <li>
            <div class="mt_l"></div>
            <div class="mt_r">
              <input type="submit" name="Button1" value="确定注册" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Button1&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="Button1" class="sign" />
              <input type="reset" value="重新填写" name="B12" Class="sign" />
            </div>
          </li>
        </ul>
      </div>
      <div class="main_bottom"></div>
</form>
  </div>

<script type="text/javascript">
//<![CDATA[
var Page_Validators =  new Array(document.getElementById("RequiredFieldValidator1"), document.getElementById("RequiredFieldValidator2"), document.getElementById("RequiredFieldValidator3"), document.getElementById("RequiredFieldValidator31"), document.getElementById("RequiredFieldValidator32"), document.getElementById("CompareValidator1"), document.getElementById("RegularExpressionValidator3"), document.getElementById("RegularExpressionValidator33"), document.getElementById("RegularExpressionValidator1"), document.getElementById("RequiredFieldValidator4"), document.getElementById("RegularExpressionValidator2"), document.getElementById("RequiredFieldValidator5"));

var RequiredFieldValidator1 = document.all ? document.all["RequiredFieldValidator1"] : document.getElementById("RequiredFieldValidator1");
RequiredFieldValidator1.controltovalidate = "user_name";
RequiredFieldValidator1.errormessage = "不能为空！";
RequiredFieldValidator1.display = "Dynamic";
RequiredFieldValidator1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator1.initialvalue = "";



var RequiredFieldValidator2 = document.all ? document.all["RequiredFieldValidator2"] : document.getElementById("RequiredFieldValidator2");
RequiredFieldValidator2.controltovalidate = "passwd1";
RequiredFieldValidator2.errormessage = "不能为空！";
RequiredFieldValidator2.display = "Dynamic";
RequiredFieldValidator2.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator2.initialvalue = "";

var RequiredFieldValidator3 = document.all ? document.all["RequiredFieldValidator3"] : document.getElementById("RequiredFieldValidator3");
RequiredFieldValidator3.controltovalidate = "passwd2";
RequiredFieldValidator3.errormessage = "不能为空！";
RequiredFieldValidator3.display = "Dynamic";
RequiredFieldValidator3.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator3.initialvalue = "";

var CompareValidator1 = document.all ? document.all["CompareValidator1"] : document.getElementById("CompareValidator1");
CompareValidator1.controltovalidate = "passwd2";
CompareValidator1.errormessage = "两次输入的密码不一致！";
CompareValidator1.display = "Dynamic";
CompareValidator1.evaluationfunction = "CompareValidatorEvaluateIsValid";
CompareValidator1.controltocompare = "passwd1";
CompareValidator1.controlhookup = "passwd1";

var RequiredFieldValidator31 = document.all ? document.all["RequiredFieldValidator31"] : document.getElementById("RequiredFieldValidator31");
RequiredFieldValidator31.controltovalidate = "question";
RequiredFieldValidator31.errormessage = "不能为空！";
RequiredFieldValidator31.display = "Dynamic";
RequiredFieldValidator31.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator31.initialvalue = "";


var RequiredFieldValidator32 = document.all ? document.all["RequiredFieldValidator32"] : document.getElementById("RequiredFieldValidator32");
RequiredFieldValidator32.controltovalidate = "answer";
RequiredFieldValidator32.errormessage = "不能为空！";
RequiredFieldValidator32.display = "Dynamic";
RequiredFieldValidator32.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator32.initialvalue = "";

var RegularExpressionValidator33 = document.all ? document.all["RegularExpressionValidator33"] : document.getElementById("RegularExpressionValidator33");
RegularExpressionValidator33.controltovalidate = "email";
RegularExpressionValidator33.errormessage = "不能为空！";
RegularExpressionValidator33.display = "Dynamic";
RegularExpressionValidator33.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RegularExpressionValidator33.initialvalue = "";

var RegularExpressionValidator3 = document.all ? document.all["RegularExpressionValidator3"] : document.getElementById("RegularExpressionValidator3");
RegularExpressionValidator3.controltovalidate = "email";
RegularExpressionValidator3.errormessage = "邮箱格式不正确！";
RegularExpressionValidator3.display = "Dynamic";
RegularExpressionValidator3.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
RegularExpressionValidator3.validationexpression = "\\w+([-+.\']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";

var RegularExpressionValidator1 = document.all ? document.all["RegularExpressionValidator1"] : document.getElementById("RegularExpressionValidator1");
RegularExpressionValidator1.controltovalidate = "tel";
RegularExpressionValidator1.errormessage = "手机或固定电话号码不正确！";
RegularExpressionValidator1.display = "Dynamic";
RegularExpressionValidator1.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
RegularExpressionValidator1.validationexpression = "(^(\\d{2,4}[-_－—]?)?\\d{3,8}([-_－—]?\\d{3,8})?([-_－—]?\\d{1,7})?$)|(^0?1[35]\\d{9}$)";
var RequiredFieldValidator4 = document.all ? document.all["RequiredFieldValidator4"] : document.getElementById("RequiredFieldValidator4");
RequiredFieldValidator4.controltovalidate = "tel";
RequiredFieldValidator4.errormessage = "不能为空！";
RequiredFieldValidator4.display = "Dynamic";
RequiredFieldValidator4.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator4.initialvalue = "";
var RegularExpressionValidator2 = document.all ? document.all["RegularExpressionValidator2"] : document.getElementById("RegularExpressionValidator2");
RegularExpressionValidator2.controltovalidate = "qq";
RegularExpressionValidator2.errormessage = "QQ号码不正确！";
RegularExpressionValidator2.display = "Dynamic";
RegularExpressionValidator2.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
RegularExpressionValidator2.validationexpression = "^\\d*$";
var RequiredFieldValidator5 = document.all ? document.all["RequiredFieldValidator5"] : document.getElementById("RequiredFieldValidator5");
RequiredFieldValidator5.controltovalidate = "qq";
RequiredFieldValidator5.errormessage = "不能为空！";
RequiredFieldValidator5.display = "Dynamic";
RequiredFieldValidator5.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator5.initialvalue = "";


var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
    ValidatorOnLoad();
}

function ValidatorOnSubmit() {
    if (Page_ValidationActive) {
        return ValidatorCommonOnSubmit();
    }
    else {
        return true;
    }
}
        //]]>
</script>