Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. <?php
  2.  
  3. require "db.php";
  4. $data = $_POST;
  5. if( isset($data['do_signup']) )
  6. {
  7. $errors = array();
  8. if ( trim ($data['login']) == '' )
  9. {
  10. $errors[] = 'Введите логин!';
  11. }
  12.  
  13.  
  14. if ( trim ($data['email']) == '' )
  15. {
  16. $errors[] = 'Введите email!';
  17. }
  18.  
  19.  
  20. if ($data['password'] == '' )
  21. {
  22. $errors[] = 'Введите пароль!';
  23. }
  24.  
  25.  
  26. if ($data['password_2'] != $data['password'] )
  27. {
  28. $errors[] = 'повторный пароль введен не верно!';
  29. }
  30.  
  31. if ( empty($errors) )
  32. {
  33. $user = R::dispense('users');
  34. $user->login = $data['login'];
  35. $user->email = $data['email'];
  36. $user->password = $data['password'];
  37. R::store($user);
  38. echo '<div id="confirm">Вы успешно зарегестрированы!</div>';
  39. } else {
  40. echo '<div id="failed">'.array_shift($errors).'</div>';
  41. }
  42. }
  43.  
  44. ?>
  45.  
  46. <html lang="en">
  47. <head>
  48.  
  49. <title>Battlefield Blog</title>
  50.  
  51.  
  52. <link href="css/bootstrap.min.css" rel="stylesheet">
  53.  
  54. <link rel="stylesheet" type="text/css" href="../1/css/style.css">
  55.  
  56. <script src="../1/checkpass.php"></script>
  57. <script src='../1/assets/jquery/jquery-3.2.1.min.js' type='text/javascript'></script>
  58.  
  59.  
  60. <style type="text/css">
  61. #indicator {
  62. background:#d9d6d6;
  63. width:200px;
  64. height:10px;
  65. margin-top:5px;
  66. margin-left:21.5%;
  67. }
  68. #confirm {
  69. font-size:30px;
  70. font-weight: bold;
  71. text-align: center;
  72. color:green;
  73. position:absolute;
  74. top:50%;
  75. left:50%;
  76. z-index: 2;
  77. }
  78. #failed {
  79. font-size:30px;
  80. font-weight: bold;
  81. text-align:center;
  82. color:red;
  83. padding:100px;
  84. position:absolute;
  85. left:50%;
  86. top:40%;
  87. z-index: 3;
  88. }
  89. </style>
  90.  
  91.  
  92. <script type="text/javascript">
  93. $(function() {
  94. $('#pass').keyup(function () {
  95. val = $('#pass').val();
  96. $.ajax({
  97. type: "POST",
  98. url: "checkpass.php",
  99. data: "password="+val,
  100. success: function(html){
  101. $("#indicator").html(html);
  102. }
  103. });
  104. });
  105. });
  106. </script>
  107. </head>
  108.  
  109. <body>
  110. <div id="page-wrapper">
  111. <header id="header">
  112. <div class="container">
  113. <div id="primary-menu">
  114. <ul>
  115. <li> <a href=#>Главная</a></li>
  116. <li> <a href=#>Категории</a></li>
  117. <li> <a href=#>О нас</a></li>
  118. <li> <a href=#>Контакты</a></li>
  119. </ul>
  120. </div>
  121. <div id="secondary-menu">
  122. <ul>
  123. <li> <a href=#>Новости</a></li>
  124. <li> <a href=#>Летсплей</a></li>
  125. <li> <a href=#>Гайды</a></li>
  126. <li id="logo"><img src="images/SF6E48OYJ2UC.jpg" alt=""></li>
  127. <li> <a href=#>Читы</a></li>
  128. <li> <a href=#>Форум</a></li>
  129. <li> <a href=#>Разное</a></li>
  130. </ul>
  131. </div>
  132. </div>
  133. </header>
  134.  
  135. <div id="content-wrapper" class="container">
  136. <div id="sidebar">
  137. <div class="row">
  138. <div class="well span4 offset4">
  139. <legend> Авторизация</legend>
  140.  
  141. <form method="POST" accept-charset="UTF-8">
  142. <input id="login" type="text" class="span4" placeholder="Логин" name="login">
  143. <input id="password" type="password" class="span4" placeholder="Пароль" name="password">
  144. <label class="checkbox">
  145. <input type="checkbox" value="1" name="remember"> Запомнить меня
  146. </label>
  147. <button id="button1" name="sumbit" class="btn btn-block btn-success">Авторизироваться</button>
  148. <button id="button2" name="sumbit" class="btn btn-block btn-warning">Регистрация</button>
  149.  
  150. </form>
  151. </div>
  152. </div>
  153. </div>
  154.  
  155.  
  156.  
  157.  
  158. <div id="registration">
  159.  
  160. <form action="signup.php" method="POST">
  161.  
  162. <p></p>
  163. <p><strong>Ваш логин</strong>:</p>
  164. <input type="text" name="login" value="<?php echo @$data['login']; ?>">
  165.  
  166.  
  167. <p></p>
  168. <p><strong>Ваш email</strong>:</p>
  169. <input type="email" name="email" value="<?php echo @$data['email']; ?>">
  170.  
  171. <p></p>
  172.  
  173. <p><strong>Ваш пароль</strong>:</p>
  174. <input type="password" name="password" id="pass" value="<?php echo @$data['password']; ?>"/>
  175.  
  176.  
  177. <div id="indicator"></div>
  178.  
  179. <p></p>
  180.  
  181. <p><strong>Введите ваш пароль еще раз</strong>:</p>
  182. <input type="password" name="password_2" value="<?php echo @$data['password_2']; ?>">
  183.  
  184.  
  185. <p></p>
  186.  
  187. <button type="submit" name="do_signup">Зарегестрироваться</button>
  188.  
  189. </form>
  190.  
  191. </div>
  192.  
  193. <div class="clear"></div>
  194. </div>
  195.  
  196. <div class="container">
  197. <footer id="footer">
  198. 2017 All rights reserved.
  199. </footer>
  200. </div>
  201.  
  202.  
  203. </div>
  204.  
  205.  
  206.  
  207. </body>
  208. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement