		<?php
if(empty($_COOKIE['PHPSESSID'])){ die('ENABLE COOKIE'); }

$warning='';
$reg_show=1;

if($reg_ip==1){
$uipq=mysql_query("SELECT login FROM users WHERE ip='$ip'");
if(mysql_num_rows($uipq)>0){
$_SESSION['reged']=1;
$reg_show=2;
$warning=1;
}
}

if(!isset($_POST['u_login'])){
$u_login='';
$u_pass='';
}
else{
$u_qiwi=$_POST['u_qiwi'];
$u_yandex=$_POST['u_yandex'];
$u_payeer=$_POST['u_payeer'];
$u_perfect=$_POST['u_perfect'];
$u_login=$_POST['u_login'];
$u_login=preg_replace('#[^a-zA-Z\-\_0-9]+#','',$u_login);
$u_login=trim($u_login);

if(strlen($u_login)<3){ $warning.='<center><div class="alert alert-dismissable alert-danger">
                             
                                 Логин должен состоять не менее <strong>3 символов</strong>
                              </div></center>'; }
else{
$ulq=mysql_query("SELECT login FROM users WHERE login LIKE '".$u_login."'");
if(mysql_num_rows($ulq)>0){ $warning.='<center><div class="alert alert-dismissable alert-danger">
                               
                                 <strong>Такой логин уже существует в системе проекта!</strong>
                              </div></center>'; }
}

$u_pass=$_POST['u_pass'];
$u_pass=preg_replace('#[^a-zA-Z\-\_0-9]+#','',$u_pass);
if(strlen($u_pass)<3){ $warning.='<center><div class="alert alert-dismissable alert-danger">
                                
                                 Некорректно заполнено поле <strong>"Введите пароль"</strong>
                              </div></center>'; }
if(strlen($u_pass)>30){ $warning.='<center><div class="alert alert-dismissable alert-danger">
                                
                                 Пароль превышвет более <strong>30 символов</strong>
                              </div></center>'; }

$u_email=$_POST['u_email'];
if(strlen($u_email)<5){ $warning.='<center><div class="alert alert-dismissable alert-danger">
                                
                                 Некорректно заполнено поле <strong>"Ваш Email"</strong>
                              </div></center>'; }
$u_name=$_POST['u_name'];
if(strlen($u_name)<2){ $warning.='<center><div class="alert alert-dismissable alert-danger">
                             
                                 Некорректно заполнено поле <strong>"Введите ваше Имя"</strong>
                              </div></center>'; }

if($warning==''){
$u_ref=''; if(!empty($_SESSION['ref_login'])){ $u_ref=$_SESSION['ref_login']; }
$regq=mysql_query("INSERT INTO users (login,pass,ref,date,ip,name,payeer,qiwi,yandex,wmr,email,last_seen) VALUES ('$u_login','".md5($u_pass)."','$u_ref','$time','$ip','$u_name','$u_payeer','$u_qiwi','$u_yandex','$u_perfect','$u_email', '".time()."')");

$regusepq=mysql_query("SELECT uid FROM users");
$r_users=mysql_num_rows($regusepq);
$regtoputnu='';
$regnusq=mysql_query("SELECT login FROM users ORDER BY date DESC LIMIT 80");
while($regnusm=mysql_fetch_row($regnusq)){ $regtoputnu.='<img src="images/nu.png"> '.$regnusm[0].' '; }
mysql_query("UPDATE data SET users='$r_users', new_u1='$u_login', new_u2='$regtoputnu'");

$reg_show=0;
}}
?>
<?php


include $_SERVER['DOCUMENT_ROOT']."/head.php"; // $_SERVER['DOCUMENT_ROOT'] - указывает корневую директорию сайта

?>





		
		<?php if($reg_show==0){ ?>
		
		
		
		<div class="row masonry">
<div class="col-md-12 col-sm-12 col-xs-12 m-top30">
                  <div class=" text-center shop-product border shadow radius" style="
    min-height: 134px;
    padding: 25px;
">
            
						<br><br><br>
                        <div class="title">
                            <h3>Регистрация успешно завершена</h3>
							<br>
                            <p>Используйте кнопку "Вход в личный кабинет" для входа в личный кабинет</p>
						 
				
                        </div>
                    </div>
                </div>   </div>
		
		<?php } ?>
		<?php if($reg_show==1){ ?>
				<?php
if($reg_show==2){
echo '<div class="reg_warning">Регистрация с одного IP запрещена</div>';
}
?>













 
     <div id="main">
        <section class="politcal-section">
            <div class="container">
			<?php
if($warning!=''){
echo ''.$warning.'';
}
?> 
                <div class="registration-box" >
				   
                    <form id="registration" class="registration" action="/?p=registration" method="post">
   <fieldset>
        <strong class="title-form">Регистрация вебмастера</strong>
		   <div class="input-holder">
			<div class="form-group col-lg-6 ">
 


<input type="text"  class="required phonenumber" name="u_name" placeholder="Ваше имя" required="" value="<?php echo $u_name; ?>">

<p class="help-block help-block-error"></p>
</div>            <i class="icon icon-skype"></i>
        </div>
		
		
		
		
		
		
        <div class="input-holder">
			<div class="form-group col-lg-6  required">
 


<input type="text"  class="email" name="u_email"  autofocus="" placeholder="Ваш Email адрес" required="" aria-required="true" value="<?php echo $u_email; ?>">


<p class="help-block help-block-error"></p>
</div>          


  <i class="icon icon-mail"></i>
        </div>
   
		
		    <div class="input-holder">
			<div class="form-group col-lg-6  required">

						
<input type="text"  class="required" name="u_login" placeholder="Придумайте логин" required="" aria-required="true" value="<?php echo $u_login; ?>">

<p class="help-block help-block-error"></p>
</div>            <i class="icon icon-skype"></i>
        </div>
		
 
        <div class="input-holder">
			<div class="form-group col-lg-6 ">
 		


<input type="password"  maxlength="30" class="required" name="u_pass" placeholder="Придумайте пароль" required="" value="<?php echo $u_pass; ?>">

<p class="help-block help-block-error"></p>
</div>            <i class="icon icon-pass"></i>
        </div>
        <div class="button-holder">
		
		
			<button id="btn" onclick="submit();"  type="submit" disabled="" class="btn btn-success" name="signup-button">Регистрация</button>     
<span class="ajax_img"></span> 


			</div>
       
        <div class="checkbox-holder">
		
		
  <input type="checkbox" class="checkbox" id="box_1" onclick="check();" checked="">
  <label for="box_1">С правилами проекта ознакомлен(а)</label>
		 
        </div>
		================================
			 

		<script type="text/javascript">
		<!--
		function check()
			{
				var box_1 = document.getElementById('box_1');
				var btn = document.getElementById('btn');
			
				box_1.checked ? btn.disabled = false : btn.disabled = true;
			}
		//-->
	</script> 
		
		=========================
		
		
		
		
		
		
		
		
    </fieldset>

</form>                </div>
            </div>
        </section>

    </div>

			
			<?php } ?>	


	
<style>
.boxes {
  margin: auto;
    padding: 33px;
      background: linear-gradient(to right,#e8edff,#e7ecff);
    margin-bottom: 30px;
	    border-radius: 20px;
}

/*Checkboxes styles*/
input[type="checkbox"] { display: none; }

input[type="checkbox"] + label {
    display: block;
    position: relative;
    padding-left: 30px;
    /* margin-bottom: 20px; */
    font: 16px/19px 'Open Sans', Arial, sans-serif;
    color: #6580ce;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    text-transform: inherit;
    text-align: left;
    width: 62.33333%;
    float: inherit;
}

input[type="checkbox"] + label:last-child { margin-bottom: 0; }

input[type="checkbox"] + label:before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
   border: 2px solid #6580ce;
  position: absolute;
  left: 0;
  top: 0;
  opacity: .6;
  -webkit-transition: all .12s, border-color .08s;
  transition: all .12s, border-color .08s;
}

input[type="checkbox"]:checked + label:before {
  width: 10px;
  top: -5px;
  left: 5px;
  border-radius: 0;
  opacity: 1;
  border-top-color: transparent;
  border-left-color: transparent;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}
</style>
<?php 

include $_SERVER['DOCUMENT_ROOT']."/footer.php";

?>