Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. function register2(){
  2. $objReg = new registration($_POST['username'],$_POST['password'],$_POST['email']);
  3. $objReg->register();
  4. unset($objReg);
  5. }
  6.  
  7. class clean
  8. {
  9. public function process($data)
  10. {
  11. $data = trim($data);
  12. $data = stripslashes($data);
  13. $data = htmlspecialchars($data);
  14. return $data;
  15. }
  16. }
  17.  
  18. class registration
  19. {
  20. // Registration stuffs
  21. private $regUser = NULL;
  22. private $regPass = NULL;
  23. private $regEmail = NULL;
  24.  
  25. public function __construct($regName, $regPass, $regEmail)
  26. {
  27. //Set the class properties if they aren't NULL.
  28. if (!empty($regName) AND !empty($regPass) AND !empty($regEmail)){
  29. $objClean = new clean;
  30. $this->regUser = $objClean->process($regName);
  31. $this->regPass = $objClean->process($regPass);
  32. $this->regEmail = $objClean->process($regEmail);
  33. unset($objClean);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement