Advertisement
ollleg1997

Untitled

May 13th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.81 KB | None | 0 0
  1. Ошибки:
  2. [Sat May 13 20:12:49.957128 2017] [:error] [pid 31888] [client 188.163.68.144:25652] PHP Notice:  Undefined index: email in /var/www/ullu/ullu.dev/controllers/Registration.php on line 19
  3. [Sat May 13 20:12:49.957186 2017] [:error] [pid 31888] [client 188.163.68.144:25652] PHP Notice:  Undefined index: username in /var/www/ullu/ullu.dev/controllers/Registration.php on line 20
  4. [Sat May 13 20:12:49.957194 2017] [:error] [pid 31888] [client 188.163.68.144:25652] PHP Notice:  Undefined index: password in /var/www/ullu/ullu.dev/controllers/Registration.php on line 21
  5. [Sat May 13 20:12:49.957251 2017] [:error] [pid 31888] [client 188.163.68.144:25652] PHP Fatal error:  Uncaught Exception: Post are empty in /var/www/ullu/ullu.dev/controllers/Registration.php:35\nStack trace:\n#0 /var/www/ullu/ullu.dev/views/client/registration.php(11): controllers\\Registration::createNewUser()\n#1 /var/www/ullu/ullu.dev/controllers/AController.php(12): include('/var/www/ullu/u...')\n#2 /var/www/ullu/ullu.dev/controllers/Registration.php(43): controllers\\AController->render('client/registra...', Array)\n#3 [internal function]: controllers\\Registration->registration()\n#4 /var/www/ullu/ullu.dev/router/Router.php(88): call_user_func_array(Array, Array)\n#5 /var/www/ullu/ullu.dev/router/Router.php(58): router\\Router::executeAction()\n#6 /var/www/ullu/ullu.dev/index.php(24): router\\Router::dispatch()\n#7 {main}\n  thrown in /var/www/ullu/ullu.dev/controllers/Registration.php on line 35
  6.  
  7. Обработчик
  8. public static function createNewUser()
  9.     {
  10.         $email    = $_POST['email'];
  11.         $username = $_POST['username'];
  12.         $password = $_POST['password'];
  13.  
  14.         if(isset($email) && isset($username) && isset($password)) {
  15.             $user = new User();
  16.             $user->setEmail($email)
  17.                 ->setPassword($password)
  18.                 ->setName($username)
  19.                 ->send();
  20.             unset($_POST['email'], $_POST['username'], $_POST['password']);
  21.  
  22.             Header('Location: /auth');
  23.         }
  24.     }
  25.  
  26. Форма
  27.  
  28. <form action="<?php \controllers\Registration::createNewUser() ?>" method="post">
  29.         <label for="username__registration">username</label>
  30.         <input type="text"
  31.                name="username"
  32.                id="username__registration"
  33.                required>
  34.  
  35.  
  36.         <label for="email_registration">email</label>
  37.         <input
  38.             type="email"
  39.             name="email"
  40.             id="email_registration"
  41.             required>
  42.  
  43.  
  44.         <label for="password_registration">password</label>
  45.         <input
  46.             type="password"
  47.             name="password"
  48.             id="password_registration"
  49.             required>
  50.  
  51.         <input
  52.             type="submit"
  53.             name="submit"
  54.             id="submit_registration">
  55.     </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement