/** * Verify an account */ public function getVerifyAccount() { $user_id = 0; $token = $_GET['token']; // look up the token $user_pending = UserPending::where('token', '=', $token)->first(); if ($user_pending) { $user_id = $user_pending->user_id; } if ($user_id > 0) { $user = User::find($user_id); $user->active = 1; $user->save(); UserPending::where('token', '=', $token)->delete(); $this->response->redirectTo("/account-activated"); } else { $this->response->withView('page-not-found')->withError("Page not found!")->withResponseCode(404)->render(); } }
public function getVerifyAccount() { $user_id = 0; $token = $_GET['token']; // look up the token $user_pending = UserPending::where('token', '=', $token)->get(); foreach ($user_pending as $item) { $user_id = $item->user_id; } if ($user_id > 0) { // make the user account active $user = User::find($user_id); $user->active = 1; $user->save(); UserPending::where('token', '=', $token)->delete(); header("Location: /account-activated"); exit; } else { header("Location: /page-not-found"); exit; } }
public function getVerifyAccount() { $user_id = 0; $token = $_REQUEST['token']; //look up the token $users_pending = UserPending::where('token', '=', $token)->first(); if ($users_pending != null) { //echo $this->blade->render("verify-account"); $user_id = $users_pending->user_id; $user = User::find($user_id); $user->active = 1; $user->save(); //delete token from table UserPending::where('token', '=', $token)->delete(); header("Location: /account-activated"); exit; } else { header("Location: /page-not-found"); exit; } //echo $this->blade->render("verify-account"); }