Advertisement
Guest User

Untitled

a guest
Feb 15th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <?php
  2.  
  3. class Ipb extends Plugin
  4. {
  5. /**
  6. * Runtime values
  7. */
  8. private $username;
  9. private $password;
  10. private $email;
  11. private $db;
  12.  
  13. /**
  14. * Receive the user information
  15. * @param String $username
  16. * @param String $password
  17. * @param String email
  18. */
  19. public function register($username, $password, $email)
  20. {
  21. $this->username = $username;
  22. $this->password = $password;
  23. $this->email = $email;
  24.  
  25. $this->db = $this->CI->load->database($this->CI->config->item('bridge'), TRUE);
  26.  
  27. $this->process();
  28. $this->authenticate();
  29. }
  30.  
  31. /**
  32. * Add the account
  33. */
  34. private function process()
  35. {
  36.  
  37. $this->db->query("INSERT INTO ".$this->CI->config->item('forum_table_prefix')."xf_user(`username`, `email`, `visible`, `user_group_id`, `register_date`) VALUES(?, ?, '1', ?, ?)", array($this->username, $this->email, time()));
  38. }
  39.  
  40. private function process()
  41. {
  42. $salt = str_replace( '\\', "\\\\", $salt );
  43. $password = $this->encryptPassword($salt);
  44. }
  45.  
  46. /**
  47. * Encrypt the password with a specific algorithm
  48. * @return String
  49. */
  50. private function encryptPassword($salt)
  51. {
  52. return sha256(sha256($salt) . sha256($this->password));
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement