<?php
/*
乘风下载管理系统
作者QQ：178575
作者Email：yliangcf@163.com
作者网站：http://www.qqcf.com
详细简介：http://www.qqcf.com/cfdown.htm
上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
因为这些内容可能时常更新，就没有放在程序里，请自己上网站查看
*/
?>
<?php 
session_start();

@include("conn.php");
@include("include/myfunction.php");
@include("config.php");
@include("include/getcookie.php");

//安装锁定文件不存在时，开始安装程序
if(!file_exists('install/install.lock')) gotourl("install/index.php");

$action = isset($_REQUEST["action"]) ? chkstr($_REQUEST["action"],1) : "";

@include("include/cf_do.php");
?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="<?php echo $Rs['title']?>" />
	<meta name="description" content="<?php echo $Rs['title']?>" />
	<meta charset="utf-8">
	<title><?php echo $Rs['title']?></title>
	<link rel="stylesheet" href="images/style2.css" />
	<script src="js/jquery.min.js"></script>
</head>
<body>

<div class="navbar">
	<div class="navbar-inner">
		<div class="container">
			<div class="nav">
				<li><a href="./">首页</a></li>

			</div>
			<div class="navr">

			<?php if ($_COOKIE['cfdownadmin']!="") echo '<a href="../admin/">登录</a>';?>
			</div>
		</div>
	</div>
</div>
<style>
#common_content_main{background:#fff;position:relative;}
.common_content_main .yanshi_xiazai{margin-top:18px;margin-bottom:8px;}
.common_content_main .yanshi_xiazai a{font-size:16px;padding:10px 20px;margin-right:20px;background:#2DBFBE;color:#fff;}
.common_content_main .yanshi_xiazai a:hover{background:#FF6263;}
</style>

<div class="container">       
	<div class="hero-unit">

<center><b><?php echo $Rs['title']?></b>
<div class="common_content_main">
	<p class="yanshi_xiazai">


<DIV class="f-l w-960">
<H2><a class=s-1>用户注册</a>
<DIV class=bdr-right></DIV>
</H2>
<DIV class=bdr>



<?php 
if($RsSet["regstate"]==1)
{
?>
<script>
$(function(){
 $("#username").mouseleave(function(){
  var username = $("#username").val();
  $.ajax({url: "?",type: "post",data:"action=usernamechecksave&username="+username,success: function(response){
   $("#username_text").html($.trim(response));
  }});
 });


$("#userreg").click(function(){

if($('#username').val()==""){
 alert ('用户名必须填写');
 $('#username').focus();
 return false;
}

if(!chkname($('#username').val())){
 alert ('用户名不规则');
 $('#username').focus();
 return false;
}

if($('#pwd').val()==""){
 alert ('密码必须填写');
 $('#pwd').focus();
 return false;
}

if($('#pwd2').val()==""){
 alert ('重复密码必须填写');
 $('#pwd2').focus();
 return false;
}

if($('#pwd2').val()!=$('#pwd').val()){
 alert ('两次填写的密码不一样，请重写填写');
 $('#pwd2').focus();
 return false;
}

if($('#email').val()==""){
 alert ('email必须填写');
 $('#email').focus();
 return false;
}

if(!isValidEmail($('#email').val())){
 alert ('email的格式不正确');
 $('#email').focus();
 return false;
}


});



});




function chkname(String){ 
var Letters = "abcdefghijklmnopqrstuvwxyz1234567890_"; //可以自己增加可输入值
var i;
var c;
if(String.charAt( 0 )=='-')
return false;
if( String.charAt( String.length - 1 ) == '-' )
return false;
for( i = 0; i < String.length; i ++ )
{
c = String.charAt( i );
if (Letters.indexOf( c ) < 0)
return false;
}
return true;
}

function isValidEmail(s){
 var reg1 = new RegExp('^[a-zA-Z0-9][a-zA-Z0-9@._-]{3,}[a-zA-Z]$');
 var reg2 = new RegExp('[@.]{2}');
 if (s.search(reg1) == -1
  || s.indexOf('@') == -1
  || s.lastIndexOf('.') < s.lastIndexOf('@')
  || s.lastIndexOf('@') != s.indexOf('@')
  || s.search(reg2) != -1)
  return false;		
 return true;
}
</script>

<table>
<form name="form2" id="form2" method="post" action="?action=userregsave">
            <tr> 
              <td width="35%" class="td_3">用户名：</td>
              <td><input type="text" name="username" id="username" autoComplete="off" STYLE="ime-mode:inactive;width:220px">
        <font color="#FF0000">*</font>(只能填写小写英文字母,数字或下划线)<span id='username_text'></span>
		</td>
            </tr>
            <tr> 
              <td class="td_3">密　码：</td>
              <td><input name="pwd" id="pwd" type="password" style="ime-mode:inactive;width:220px">
                <font color="#FF0000">*</font></td>
            </tr>
            <tr> 
              <td class="td_3">重复密码：</td>
              <td><input name="pwd2" id="pwd2" type="password" style="ime-mode:inactive;width:220px">
                <font color="#FF0000">*</font></td>
            </tr>
            <tr> 
              <td class="td_3">Email：</td>
              <td><input name="email" id="email" type="text" style="ime-mode:inactive;width:220px">
                <font color="#FF0000">*</font></td>
            </tr>
            <tr> 
              <td class="td_3">Q　Q：</td>
              <td><input name="qq" id="qq" type="text" style="ime-mode:inactive;width:220px"></td>
            </tr>


<tr> 
<td>&nbsp;</td>
<td>
<INPUT type="image" name="userreg" id="userreg" src="images/reg.gif" style="width:53px;height:21px;border:0px;margin:8px 0px">

</td>
</tr>
</form>
</table>
<?php 
}else{
echo "<div style='text-align:center;font-weight:bold;font-size:14px;color:#ff0000;'>对不起,本系统已经暂停新用户注册!</div>";
}?>

	
	</p>
</div>
</center><br />




</div>
</div>


	</div>
</div>
<div class="scf-footer">
<ul class="scf-link-list">合作网站：
<li class="last"><a href="http://www.qqcf.com/" target="_blank">乘风原创程序</a></li>
</ul><p>Copyright <?php echo strftime("%Y",time());?> <a href="http://www.qqcf.com/" target="_blank">乘风下载系统</a>. All Rights Reserved. <a href="http://www.qqcf.com/" target="_blank">乘风</a> 版权所有</div>

</body>
</html>
