<?php
session_start();
include "conn/config.php";
?>
<!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=utf-8" />
<link type="text/css" rel="stylesheet" href="css/lo_re.css" />
<link type="text/css" rel="stylesheet" href="css/jquery.ui.datepicker.css" />
<link type="text/css" rel="stylesheet" href="css/jquery.ui.theme.css" />
<script type="text/javascript" language="javascript" src="js/jquery-1.5.1.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.ui.datepicker-zh-CN.js"></script>
<title>尘烟博客</title>
</head>

<body>
 <div id="register">
   <link type="text/css" rel="stylesheet" href="css/validator.css"></link>
   <script src="js/formValidator-4.0.1.js" type="text/javascript" charset="UTF-8"></script>
   <script src="js/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
   <script type="text/javascript">
  $(document).ready(function(){
      $.formValidator.initConfig({formID:"form1",onError:function(){alert("校验没有通过，具体错误请看错误提示")}});
      $("#username").formValidator({onShow:"请输入您的用户名",onfocus:"配由数字、26个英文字母或者下划线组成的字符串",onCorrect:"输入正确"}).inputValidator({min:4,max:16,onError:"用户名不能为空"})
      .ajaxValidator({              
      dataType : "html",              
      async : true,              
      url : "register_do.php",              
      success : function(data){                  
      if( data.indexOf("此用户名可以注册!") > 0 ) return true;                  
      return data;              
      },              
      buttons: $("#button"),              
      error: function(jqXHR, textStatus, errorThrown){alert("服务器没有返回数据，可能服务器忙，请重试"+errorThrown);},          
      onError : "该用户名已存在",              
      onWait : "正在对用户名进行合法性校验，请稍候..."          
      })
      $("#password").formValidator({onShow:"请输入密码",onFocus:"6到16个小写英文字符",onCorrect:"密码合法"}).inputValidator({min:6,max:16,empty:{leftEmpty:false,rightEmpty:false,emptyError:"密码两边不能有空符号"},onError:"密码必须为6到16个小写英文字符"}).regexValidator({regExp:"letter_l",dataType:"enum",onError:"您输入的密码格式有误！"});
      $("#repass").formValidator({onShow:"输再次输入密码",onFocus:"请再次输入密码",onCorrect:"密码一致"}).inputValidator({min:1,empty:{leftEmpty:false,rightEmpty:false,emptyError:"重复密码两边不能有空符号"},onError:"重复密码不能为空,请确认"}).compareValidator({desID:"password",operateor:"=",onError:"2次密码不一致,请确认"});
      $("#email").formValidator({onShow:"请输入您的电子邮箱地址",onFocus:"请输入正确的邮箱地址",onCorrect:"邮箱地址正确"}).regexValidator({regExp:"email",dataType:"enum",onError:"您输入的邮箱地址格式不正确"});
	  $("#face").formValidator({onShow:"请单击选择您的头像图片",onFocus:"只能选择一张哦",onCorrect:"图片选择正确"}).inputValidator({min:5,max:9,onError:"表情选择不对！"});
      $("#validatorCode").formValidator({onShow:"请输入图片中的字符",onFocus:"看不清可以点击图片换一张",onCorrect:"填写正确"}).inputValidator({min:4,max:4,onError:"验证码长度不正确！"});
  })
  
  //打开表情选择窗口
  function openface(){
	  window.open("open/openface.php","openface","width=360,height=300,left=200,top=200,scrollbars=yes");  
  }
  </script>
    <div class="re_title">
      <h5>博客注册</h5>
    </div>
    <div class="re_form">
      <form action="register_do.php" method="post" name="form1" id="form1">
          <table>
             <tr>
               <td>
                 <label for="username">用户名称：</label>
                 <input type="text" name="username" id="username" />
                 <div id="usernameTip"></div>
               </td>
             </tr>
             <tr>
               <td>
                 <label for="password">用户密码：</label>
                 <input type="password" name="password" id="password" />
                 <div id="passwordTip"></div>
               </td>
             </tr>
             <tr>
               <td>
                 <label for="repass">确认密码：</label>
                 <input type="password" name="repass" id="repass" />
                 <div id="repassTip"></div>
               </td>
             </tr>
             <tr>
               <td>
                 <label for="email">邮箱地址：</label>
                 <input type="text" name="email" id="email" />
                 <div id="emailTip"></div>
               </td>
             </tr>
             <tr>
               <td>
                 <label for="email">头像选择：</label>
                 <input type="text" name="face" id="face" onclick="openface()" />
                 <div id="faceTip"></div>
               </td>
             </tr>
             <tr>
               <td>
                 <label for="validatorCode">&nbsp;&nbsp;验证码：</label>
                 <input type="text" name="validatorCode" id="validatorCode" />
                 <img class="va_img" src="include/code.php" onclick="this.src='code.php?'+Math.random()" />
                 <div id="validatorCodeTip"></div>
               </td>
             </tr>
             <tr>
               <td>
                 <input type="submit" id="submit" value="提交" />
                 <input type="reset" id="reset" />
                 <input type="button" id="go_lo" value="去登陆" onclick="location.href='login.php'" />
               </td>
             </tr>
          </table>
      </form>
      </div>
      <div class="re_footer">
        <div class="left">
          <img src="images/lo_re__footer_left.gif" />
        </div>
        <div class="bg"></div>
        <div class="right">
          <img src="images/lo_re_footer_right.gif" />
        </div>
      </div>
</div>
</body>
</html>