Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. public function regist( $name , $email , $password)
  2. {
  3. $email_code = hash("md5",(string) microtime() . $name );
  4.  
  5. $this->load->helper('email');
  6. $this->load->library('email');
  7. $config['protocol'] = "smtp";
  8. $config['smtp_host'] = "ssl://smtp.gmail.com";
  9. $config['smtp_port'] = "465";
  10. $config['smtp_user'] = "17zrami@gmail.com";
  11. $config['smtp_pass'] = "xxx";
  12. $config['charset'] = "utf-8";
  13. $config['mailtype'] = "html";
  14. $config['newline'] = "\r\n";
  15.  
  16. $this->email->initialize($config);
  17.  
  18. $this->email->from('17zrami@gmail.com', '7spectrum');
  19.  
  20. $this->email->to($email);
  21. $this->email->subject('Confirmation Message');
  22. $message = "<p><h1> Hello {$name} </h1></p>
  23. <p> Thank you and bla bla bla </p>
  24. <a href=\" ". base_url() . "/user/confirm/{$email}/{$email_code} \"> Click To Confirm </a> ";
  25.  
  26. $this->email->message($message);
  27. try
  28. {
  29. if (! $this->email->send() )
  30. return 0;
  31. }
  32. catch(Exception $e){
  33. return 0;
  34. }
  35.  
  36.  
  37.  
  38.  
  39. $password = $this->encrypt($password);
  40.  
  41.  
  42. $this->db->insert('user' , array('email' => $email
  43. , 'activated' => 0 , "name"=>$name , "password" => $password , "regist" => strftime("%Y/%m/%d %H:%M:%S")));
  44.  
  45. $this->db->insert('validate' , array('email' => $email ,
  46. 'code' => $email_code
  47. ));
  48.  
  49. return 1;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement