Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.11 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. text-align: center;
  70. color:green;
  71. }
  72. #failed {
  73. text-align:center;
  74. color:red;
  75. }
  76. </style>
  77.  
  78.  
  79. <script type="text/javascript">
  80. $(function() {
  81. $('#pass').keyup(function () {
  82. val = $('#pass').val();
  83. $.ajax({
  84. type: "POST",
  85. url: "checkpass.php",
  86. data: "password="+val,
  87. success: function(html){
  88. $("#indicator").html(html);
  89. }
  90. });
  91. });
  92. });
  93. </script>
  94. </head>
  95.  
  96. <body>
  97. <div id="page-wrapper">
  98. <header id="header">
  99. <div class="container">
  100. <div id="primary-menu">
  101. <ul>
  102. <li> <a href=#>Главная</a></li>
  103. <li> <a href=#>Категории</a></li>
  104. <li> <a href=#>О нас</a></li>
  105. <li> <a href=#>Контакты</a></li>
  106. </ul>
  107. </div>
  108. <div id="secondary-menu">
  109. <ul>
  110. <li> <a href=#>Новости</a></li>
  111. <li> <a href=#>Летсплей</a></li>
  112. <li> <a href=#>Гайды</a></li>
  113. <li id="logo"><img src="images/SF6E48OYJ2UC.jpg" alt=""></li>
  114. <li> <a href=#>Читы</a></li>
  115. <li> <a href=#>Форум</a></li>
  116. <li> <a href=#>Разное</a></li>
  117. </ul>
  118. </div>
  119. </div>
  120. </header>
  121.  
  122. <div id="content-wrapper" class="container">
  123. <div id="sidebar">
  124. <div class="row">
  125. <div class="well span4 offset4">
  126. <legend> Авторизация</legend>
  127.  
  128. <form method="POST" accept-charset="UTF-8">
  129. <input id="login" type="text" class="span4" placeholder="Логин" name="login">
  130. <input id="password" type="password" class="span4" placeholder="Пароль" name="password">
  131. <label class="checkbox">
  132. <input type="checkbox" value="1" name="remember"> Запомнить меня
  133. </label>
  134. <button id="button1" name="sumbit" class="btn btn-block btn-success">Авторизироваться</button>
  135. <button id="button2" name="sumbit" class="btn btn-block btn-warning"><a href="signup.php">Регистрация</a></button>
  136.  
  137. </form>
  138. </div>
  139. </div>
  140. </div>
  141.  
  142.  
  143.  
  144.  
  145. <div id="registration">
  146.  
  147. <form action="signup.php" method="POST">
  148.  
  149. <p></p>
  150. <p><strong>Ваш логин</strong>:</p>
  151. <input type="text" name="login" value="<?php echo @$data['login']; ?>">
  152.  
  153.  
  154. <p></p>
  155. <p><strong>Ваш email</strong>:</p>
  156. <input type="email" name="email" value="<?php echo @$data['email']; ?>">
  157.  
  158. <p></p>
  159.  
  160. <p><strong>Ваш пароль</strong>:</p>
  161. <input type="password" name="password" id="pass" value="<?php echo @$data['password']; ?>"/>
  162.  
  163.  
  164. <div id="indicator"></div>
  165.  
  166. <p></p>
  167.  
  168. <p><strong>Введите ваш пароль еще раз</strong>:</p>
  169. <input type="password" name="password_2" value="<?php echo @$data['password_2']; ?>">
  170.  
  171.  
  172. <p></p>
  173.  
  174. <button type="submit" name="do_signup">Зарегестрироваться</button>
  175.  
  176. </form>
  177.  
  178. </div>
  179.  
  180. <div class="clear"></div>
  181. </div>
  182.  
  183. <div class="container">
  184. <footer id="footer">
  185. 2017 All rights reserved.
  186. </footer>
  187. </div>
  188.  
  189.  
  190. </div>
  191.  
  192.  
  193.  
  194. </body>
  195. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement