qsadfasdgfgads

Untitled

Mar 24th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2. require 'db.php';
  3. $login = $_POST['login'];
  4. $password = $_POST['password'];
  5. $data = $_POST;
  6. $errors = array();
  7. if( isset($data['go']) ){
  8. if( trim($data['login']) == '' )
  9.     {
  10.         $errors[] = 'Введите ваш логин!';
  11.     }
  12.     if( trim($data['email']) == '' )
  13.     {
  14.         $errors[] = 'Введите ваш Email!';
  15.     }
  16.  
  17.     if( $data['password'] == '' )
  18.     {
  19.         $errors[] = 'Введите ваш пароль!';
  20.     }
  21.     if( empty($errors) )
  22.     {
  23.        
  24.         ///Всё хорошо регаем user
  25.         $reg = mysqli_query($connection,"INSERT INTO `users` `login` WHERE '$login' AND `password` WHERE '$password'");
  26.  
  27.     }else {
  28.         echo '<div style="color: red;">'.array_shift($errors).'</div><hr>';
  29.     }
  30.  
  31. }
  32. ?>
  33. <!DOCTYPE html>
  34. <html>
  35. <head>
  36.     <meta charset="utf-8">
  37.     <title>Работа с формами PHP</title>
  38. </head>
  39. <body>
  40. <form action="/index.php" method="POST">
  41. <p>
  42.  <p><strong>Ваш логин</strong></p>
  43.  <input type="text" name="login">
  44. </p>
  45.  
  46. <p>
  47.  <p><strong>Ваш Email</strong></p>
  48.  <input type="email" name="email">
  49. </p>
  50.  
  51. <p>
  52.  <p><strong>Ваш пароль</strong></p>
  53.  <input type="password" name="password">
  54. </p>
  55. <p>
  56.  <button type="submit" name="go">Зарегистрироваться</button>
  57. </p>
  58.  
  59. </form>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment