Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ошибки:
- [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
- [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
- [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
- [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
- Обработчик
- public static function createNewUser()
- {
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- if(isset($email) && isset($username) && isset($password)) {
- $user = new User();
- $user->setEmail($email)
- ->setPassword($password)
- ->setName($username)
- ->send();
- unset($_POST['email'], $_POST['username'], $_POST['password']);
- Header('Location: /auth');
- }
- }
- Форма
- <form action="<?php \controllers\Registration::createNewUser() ?>" method="post">
- <label for="username__registration">username</label>
- <input type="text"
- name="username"
- id="username__registration"
- required>
- <label for="email_registration">email</label>
- <input
- type="email"
- name="email"
- id="email_registration"
- required>
- <label for="password_registration">password</label>
- <input
- type="password"
- name="password"
- id="password_registration"
- required>
- <input
- type="submit"
- name="submit"
- id="submit_registration">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement