Error with email varification(helper/controller) |
Hello!
When I press activtate to login after register I get an error 404 code. I seems as if the code created withn DB is not linking well. I have a helper and controller but cant seem to figure out which is causing it: Code(helper): Account verification email sender function */ if(! function_exists('emailVerification')){ function emailVerification($userID){ $ci =& get_instance(); $ci->load->library('email'); $ci->load->model('user'); $con['returnType'] = 'single'; $con['conditions'] = array( 'id' => $userID ); $user = $ci->user->getRows($con); $emailVerifyLink = base_url().'verifyEmail/'.$user['activation_code']; $config['mailtype'] = 'html'; $ci->email->initialize($config); $ci->email->to($user['email']); $ci->email->from(' [email protected]', 'Cultured Kink'); $ci->email->subject('Please Confirm Your Email | Cultured Kink'); $ci->email->message($mailContent); $ci->email->send(); return true; } } Code(controller): * User email verification */ public function verifyEmail($activation_code){ //redirect logged in user to dashboard if($this->userId){ redirect('dashboard'); } $data = array(); //if the activation code is available if(!empty($activation_code)){ //check whether the activation code exists in the database $con['conditions'] = array( 'activation_code' => $activation_code ); $con['returnType'] = 'single'; $checkUser = $this->user->getRows($con); //if activation code is matched if(!empty($checkUser)){ //activate user for login $actData = array('activated' => '1'); $update = $this->user->update($actData, array('activation_code' => $activation_code)); //send user registration email @userRegistrationEmail($checkUser['id'], '*****'); //store status message $this->session->set_userdata('success_msg', 'Email verification for your account was successful. Please login to your account.'); //redirect to login page redirect('login'); }else{ $this->session->set_userdata('error_msg', 'You have clicked on the wrong verification link, please check your email and try again.'); redirect('login'); } }else{ //redirect to login page redirect('login'); } } I apologize if this question is redundant..just need help trying to connect the two so that when a new member gets email they can log in with ease. , Mekaboo (07-21-2019, 06:13 AM)php_rocs Wrote: @Mekaboo, Hey there! I got it figured out..the issue was within my webhost. I didnt have the proper code with my .htaccess file. My webhost updated it for me and now things are working wonderfully!! Thanks so very much
Code like that should be placed in a library not in a method/function.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |