Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Here's the PHP portion:
- <?php
- include('User.datatype.php');
- class NewUser {
- function inquireSubmit() {
- if(isset($_POST['register'])) {
- $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
- $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
- }
- else {
- exit;
- }
- }
- function createUser($username, $password) {
- if ($username == '' or $password == '')
- {
- $msg = 'Please enter the required information.';
- header('Location: index.php?error=$msg');
- }
- else {
- $user = new User;
- $user->username = $username;
- $user->password = $password;
- $user->profile = $profile;
- }
- }
- }
- class UserManager {
- function storeData($newUser) {
- $database = mysql_connect("localhost", "root", "");
- mysql_select_db("test") or die(mysql_error('error'));
- $username_e = mysql_real_escape_string($username);
- $password_e = mysql_real_escape_string($password);
- $query = "INSERT INTO users (username, password) VALUES ($username_e, $password_e)";
- $result = mysql_query($query);
- }
- }
- ?>
- // HTML
- <form method="POST" id="register" action="register.php">
- <table cellpadding="2" cellspacing="2" border="0">
- <tr valign="top">
- <td>
- Username: <input name="username" type="text" id="username" />
- </td>
- </tr>
- <tr valign="top">
- <td>
- Password: <input name="password" type="password" id="password" />
- </td>
- <td>
- <button type="submit" name="register">Register</button>
- </td>
- </tr>
- </table>
- </form>
Add Comment
Please, Sign In to add comment