Database Structure:
Controller:
Model:
| <?php | |
| function send_confirmation() { | |
| $this->load->library('email'); //load email library | |
| $this->email->from('admin@mysite.com', 'My Site'); //sender's email | |
| $address = $_POST['email']; //receiver's email | |
| $subject="Welcome to MySite!"; //subject | |
| $message= /*-----------email body starts-----------*/ | |
| 'Thanks for signing up, '.$_POST['fname'].'! | |
| Your account has been created. | |
| Here are your login details. | |
| ------------------------------------------------- | |
| Email : ' . $_POST['email'] . ' | |
| Password: ' . $_POST['password'] . ' | |
| ------------------------------------------------- | |
| Please click this link to activate your account: | |
| ' . base_url() . 'index.php/user_registration/verify?' . | |
| 'email=' . $_POST['email'] . '&hash=' . $this->data['hash'] ; | |
| /*-----------email body ends-----------*/ | |
| $this->email->to($address); | |
| $this->email->subject($subject); | |
| $this->email->message($message); | |
| $this->email->send(); | |
| } | |
| ?> |
| <?php | |
| function verify() { | |
| $result = $this->user_registration_model->get_hash_value($_GET['email']); | |
| if($result){ | |
| if($result['hash']==$_GET['hash']){ | |
| $this->user_registration_model->verify_user($_GET['email']); | |
| } | |
| } | |
| } | |
| ?> |
No comments:
Post a Comment