Guest User

Untitled

a guest
Apr 19th, 2018
103
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php require "include/config.php"; ?>
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>Register</title>
  7. <link rel="stylesheet" href="css/bootstrap.min.css">
  8. <link rel="stylesheet" type="text/css" href="css/log_reg.css">
  9. </head>
  10. <body>
  11.  
  12. <?php
  13. $data = $_POST;
  14. if (isset($data['do_signup']))
  15. {
  16. $errors = array();
  17. if (trim($data['login'] == ''))
  18. {
  19. $errors[] = 'Type your login';
  20. }
  21. if (trim($data['email'] == ''))
  22. {
  23. $errors[] = 'Type your email';
  24. }
  25. if (trim($data['password'] == ''))
  26. {
  27. $errors[] = 'Type your password';
  28. }
  29. if ($data['password'] != $data['password__2'])
  30. {
  31. $errors[] = 'Passwords do not match';
  32. }
  33. if (R::find('users',' login = ? ', array( $data['login'])))
  34. {
  35. $errors[] = 'User with login exists';
  36. }
  37. if (R::find('users',' email = ? ', array( $data['email'])))
  38. {
  39. $errors[] = 'User with email exists';
  40. }
  41. if (empty($errors))
  42. {
  43. $user = R::dispense('users');
  44. $user->login = $data['login'];
  45. $user->email = $data['email'];
  46. $user->position = 'user';
  47. $user->password = password_hash($data['password'], PASSWORD_DEFAULT);
  48. R::store($user);
  49. $errors__test = true;
  50. $_SESSION['logged_user'] = $user['login'];
  51. echo '<script type="text/javascript">';
  52. echo 'window.location.href="'.'index.php'.'";';
  53. echo '</script>';
  54. }
  55. else
  56. {
  57. $errors__test = false;
  58. }
  59. }
  60. ?>
  61.  
  62. <header>
  63. <div class="container">
  64. <div class="row">
  65. <div class="col-lg-2">
  66. <div class="back__button">
  67. <a href="index.php">Go back</a>
  68. </div>
  69. </div>
  70. <div class="col-lg-4 ml-auto">
  71.  
  72. </div>
  73. </div>
  74.  
  75. <div class="row">
  76.  
  77. <div class="col-lg-5 head__content__section">
  78. <div class="head__content__box">
  79. <h3>Register</h3>
  80. <form action="register.php" method="POST">
  81. <p>
  82. <input type="text" name="login" placeholder="login" value="<?php echo @$data['login']; ?>">
  83. </p>
  84. <p>
  85. <input type="email" name="email" placeholder="email" value="<?php echo @$data['email']; ?>">
  86. </p>
  87. <p>
  88. <input type="password" name="password" placeholder="password">
  89. </p>
  90. <p>
  91. <input type="password" name="password__2" placeholder="repeat password">
  92. </p>
  93. <?php
  94. if ($errors__test == true) {
  95. echo '<div style="color: green;">'.'Success!'.'</div>';
  96. }
  97. if ($errors__test == false) {
  98. error_reporting(0);
  99. echo '<div style="color: red;">'.array_shift($errors).'</div>';
  100. }
  101. ?>
  102. <p>
  103. <button type="submit" name="do_signup">Sign up!</button>
  104. </p>
  105. </form>
  106. </div>
  107. </div>
  108.  
  109. <div class="col-lg-6 ml-auto head__content__section">
  110. <div>
  111. <img src="img/d7blog_mod.png" alt="d7 blog here..." class="head__text__logo">
  112. <p><img src="img/morpheus_mod.png" border="0" alt="" class="head__logo" usemap="#pills"></p>
  113. <p><map name="pills">
  114. <area shape="circle" coords="97,350,15" href="#pill_jump" alt="">
  115. <area shape="circle" coords="387,352,15" href="https://www.google.com" alt="">
  116. </map></p>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </header>
  122.  
  123. </body>
  124. </html>
RAW Paste Data