Guest User

Untitled

a guest
Jan 5th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2.  
  3. include('User.datatype.php');
  4.  
  5. class NewUser {
  6.  
  7.     function inquireSubmit() {
  8.         if(isset($_POST['register'])) {
  9.             $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
  10.             $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
  11.         }
  12.         else {
  13.             exit;
  14.         }
  15.     }
  16.  
  17.     function createUser($username, $password) {
  18.         if ($username == '' or $password == '')
  19.         {
  20.             $msg = 'Please enter the required information.';
  21.             header('Location: index.php?error=$msg');
  22.         }
  23.    
  24.         else {
  25.             $user = new User;
  26.             $user->username = $username;
  27.             $user->password = $password;
  28.             $user->profile = $profile;
  29.         }
  30.     }
  31. }
  32.  
  33. class UserManager {
  34.  
  35.     function storeData($user) {
  36.         $database = mysql_connect("localhost", "root", "");
  37.         mysql_select_db("test") or die(mysql_error('error'));
  38.  
  39.         $username_e = mysql_real_escape_string($this->username);
  40.         $password_e = mysql_real_escape_string($this->password);
  41.  
  42.         $query = "INSERT INTO users (username, password) VALUES ($username_e, $password_e)";
  43.         $result = mysql_query($query);
  44.         return $result;
  45.     }
  46. }
Add Comment
Please, Sign In to add comment