Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require "db.php";
- $data = $_POST;
- if( isset($data['do_signup']) )
- {
- $errors = array();
- if ( trim ($data['login']) == '' )
- {
- $errors[] = 'Введите логин!';
- }
- if ( trim ($data['email']) == '' )
- {
- $errors[] = 'Введите email!';
- }
- if ($data['password'] == '' )
- {
- $errors[] = 'Введите пароль!';
- }
- if ($data['password_2'] != $data['password'] )
- {
- $errors[] = 'повторный пароль введен не верно!';
- }
- if ( empty($errors) )
- {
- $user = R::dispense('users');
- $user->login = $data['login'];
- $user->email = $data['email'];
- $user->password = $data['password'];
- R::store($user);
- echo '<div id="confirm">Вы успешно зарегестрированы!</div>';
- } else {
- echo '<div id="failed">'.array_shift($errors).'</div>';
- }
- }
- ?>
- <html lang="en">
- <head>
- <title>Battlefield Blog</title>
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link rel="stylesheet" type="text/css" href="../1/css/style.css">
- <script src="../1/checkpass.php"></script>
- <script src='../1/assets/jquery/jquery-3.2.1.min.js' type='text/javascript'></script>
- <style type="text/css">
- #indicator {
- background:#d9d6d6;
- width:200px;
- height:10px;
- margin-top:5px;
- margin-left:21.5%;
- }
- #confirm {
- text-align: center;
- color:green;
- }
- #failed {
- text-align:center;
- color:red;
- }
- </style>
- <script type="text/javascript">
- $(function() {
- $('#pass').keyup(function () {
- val = $('#pass').val();
- $.ajax({
- type: "POST",
- url: "checkpass.php",
- data: "password="+val,
- success: function(html){
- $("#indicator").html(html);
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <div id="page-wrapper">
- <header id="header">
- <div class="container">
- <div id="primary-menu">
- <ul>
- <li> <a href=#>Главная</a></li>
- <li> <a href=#>Категории</a></li>
- <li> <a href=#>О нас</a></li>
- <li> <a href=#>Контакты</a></li>
- </ul>
- </div>
- <div id="secondary-menu">
- <ul>
- <li> <a href=#>Новости</a></li>
- <li> <a href=#>Летсплей</a></li>
- <li> <a href=#>Гайды</a></li>
- <li id="logo"><img src="images/SF6E48OYJ2UC.jpg" alt=""></li>
- <li> <a href=#>Читы</a></li>
- <li> <a href=#>Форум</a></li>
- <li> <a href=#>Разное</a></li>
- </ul>
- </div>
- </div>
- </header>
- <div id="content-wrapper" class="container">
- <div id="sidebar">
- <div class="row">
- <div class="well span4 offset4">
- <legend> Авторизация</legend>
- <form method="POST" accept-charset="UTF-8">
- <input id="login" type="text" class="span4" placeholder="Логин" name="login">
- <input id="password" type="password" class="span4" placeholder="Пароль" name="password">
- <label class="checkbox">
- <input type="checkbox" value="1" name="remember"> Запомнить меня
- </label>
- <button id="button1" name="sumbit" class="btn btn-block btn-success">Авторизироваться</button>
- <button id="button2" name="sumbit" class="btn btn-block btn-warning"><a href="signup.php">Регистрация</a></button>
- </form>
- </div>
- </div>
- </div>
- <div id="registration">
- <form action="signup.php" method="POST">
- <p></p>
- <p><strong>Ваш логин</strong>:</p>
- <input type="text" name="login" value="<?php echo @$data['login']; ?>">
- <p></p>
- <p><strong>Ваш email</strong>:</p>
- <input type="email" name="email" value="<?php echo @$data['email']; ?>">
- <p></p>
- <p><strong>Ваш пароль</strong>:</p>
- <input type="password" name="password" id="pass" value="<?php echo @$data['password']; ?>"/>
- <div id="indicator"></div>
- <p></p>
- <p><strong>Введите ваш пароль еще раз</strong>:</p>
- <input type="password" name="password_2" value="<?php echo @$data['password_2']; ?>">
- <p></p>
- <button type="submit" name="do_signup">Зарегестрироваться</button>
- </form>
- </div>
- <div class="clear"></div>
- </div>
- <div class="container">
- <footer id="footer">
- 2017 All rights reserved.
- </footer>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement