Guest User

Untitled

a guest
Jan 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('db_fns.php');
  4. require_once('user_auth_fns.php');
  5.  
  6. $username = $_POST['username'];
  7. $password1 = $_POST['password1'];
  8. $password2 = $_POST['password2'];
  9. $email = $_POST['email'];
  10. session_start();
  11.  
  12. try {
  13.  
  14.     if (!isset($_POST['$username']) ||
  15.         !isset($_POST['$password1']) ||
  16.         !isset($_POST['$password2']) ||
  17.         !isset($_POST['$email'])
  18.     ) {
  19.         throw new Exception("You didn't completely fill out your register information.<br/>Please return to the previous page and fill out the form.");
  20.     }
  21.  
  22.     register($username, $password1, $email);
  23.     $_SESSION['valid_user'] = $username;
  24.     new PageGenerator('Registration Succesful',
  25.             '<h1>Congratulations!</h1>' .
  26.             '<p>You have succesfully registered to the website, welcome ' . $_SESSION['valid_user']);
  27. }
  28. catch (Exception $e) {
  29.     new PageGenerator('Error',
  30.             '<h1>Error</h1>' .
  31.             '<h2>The following error occured</h2>' .
  32.             '<p>' .
  33.             $e->getMessage() .
  34.             '</p>');
  35. }
  36.  
  37. ?>
Add Comment
Please, Sign In to add comment