Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function regist( $name , $email , $password)
- {
- $email_code = hash("md5",(string) microtime() . $name );
- $this->load->helper('email');
- $this->load->library('email');
- $config['protocol'] = "smtp";
- $config['smtp_host'] = "ssl://smtp.gmail.com";
- $config['smtp_port'] = "465";
- $config['smtp_user'] = "17zrami@gmail.com";
- $config['smtp_pass'] = "xxx";
- $config['charset'] = "utf-8";
- $config['mailtype'] = "html";
- $config['newline'] = "\r\n";
- $this->email->initialize($config);
- $this->email->from('17zrami@gmail.com', '7spectrum');
- $this->email->to($email);
- $this->email->subject('Confirmation Message');
- $message = "<p><h1> Hello {$name} </h1></p>
- <p> Thank you and bla bla bla </p>
- <a href=\" ". base_url() . "/user/confirm/{$email}/{$email_code} \"> Click To Confirm </a> ";
- $this->email->message($message);
- try
- {
- if (! $this->email->send() )
- return 0;
- }
- catch(Exception $e){
- return 0;
- }
- $password = $this->encrypt($password);
- $this->db->insert('user' , array('email' => $email
- , 'activated' => 0 , "name"=>$name , "password" => $password , "regist" => strftime("%Y/%m/%d %H:%M:%S")));
- $this->db->insert('validate' , array('email' => $email ,
- 'code' => $email_code
- ));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement