Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'includes/global.inc.php';
- $username = "";
- $password = "";
- $password_confirm = "";
- $email = "";
- $error = "";
- if(isset($_POST['submit-form'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $password_confirm = $_POST['password-confirm'];
- $email = $_POST['email'];
- $success = true;
- $userTools = new UserTools();
- if($userTools -> checkUsernameExists($username))
- {
- $error .= "That username is already taken.<br/> nr";
- $success = false;
- }
- if($password != $password_confirm) {
- $error .= "Passwords do not match.<br/> nr";
- $success = false;
- }
- if($success)
- {
- $data['username'] = $username;
- $data['password'] = md5($password);
- $data['email'] = $email;
- $newUser = new User($data);
- $newUser->save(true);
- $userTools -> login($username, $password);
- header("Location: welcome.php");
- }
- }
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" href="forma.css" type="text/css">
- </head>
- <body>
- <form action="registration.php" method="POST" id="loginform">
- <div class="field">
- <label>Имя пользователя:</label>
- <div class="input"><input type="text" value="<?php echo $username;?>" name="username"></div>
- </div>
- <div class="field">
- <label>Пароль:</label>
- <div class="input"><input type="password" value="<?php echo $password;?>" name="password"></div>
- </div>
- <div class="field">
- <label>Подтверждение пароля:</label>
- <div class="input"><input type="password" value="<?php echo $password_confirm;?>" name="password-confirm"></div>
- </div>
- <div class="field">
- <label>E-mail:</label>
- <div class="input"><input type="text" value="<?php echo $email;?>" name="email"></div>
- </div>
- <div class="submit">
- <button type="submit" value="Register" name="submit-form">Зарегистрироваться</button>
- </div>
- </form>
- </body>
- </html>
- $userTools = new UserTools();
- if($userTools -> checkUsernameExists($username))
- if($userTools->checkUsernameExists($username))
Add Comment
Please, Sign In to add comment