Guest User

Untitled

a guest
Aug 6th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2.  
  3. ob_start();
  4.  
  5. if (!defined('IN_AEVITAS'))
  6. exit('<b>Aevitas Compiler</b>: Object reference not set to instance of an object.');
  7.  
  8. class register
  9. {
  10. string $token, $username, $password;
  11. bool $token_required;
  12.  
  13. public function __constructor(null $token, $username, $password, $token_required)
  14. {
  15. if ($token != null)
  16. $this -> token = $token;
  17.  
  18. $this -> username = $username;
  19. $this -> password = $password;
  20. }
  21.  
  22. public bool check_token()
  23. {
  24. if ($this -> token == '') throw new exception('register::check_token() -> invalid token specified.');
  25. if (!$this -> token_required) throw new exception('register::check_token() -> token not required for action.');
  26.  
  27. if ($this -> token != '' && $this -> token_required) // All seems OK, and we have no exceptions thrown!
  28. {
  29. $this -> result = mysql_query('SELECT * FROM `tokens` WHERE key=`"' .$this -> token. '"`');
  30. $this -> row = mysql_fetch_array($this -> result);
  31.  
  32. if ($this -> row && count($this -> row) >= 0) // Ensure we actually have some results.
  33. {
  34. return true;
  35. }
  36. }
  37.  
  38. return false;
  39. }
  40. }
  41.  
  42. ?>
Add Comment
Please, Sign In to add comment