function forgetPassword() { $msg = ''; error_reporting(0); if ($_SERVER['REQUEST_METHOD'] == "POST") { $email = $this->input->post('email'); $user = new Estateuser(); $user->get_by_email($email); if (!$user->exists()) { $msg = 'Địa chỉ email không tồn tại. Vui lòng kiểm tra lại'; } else { $newPassword = substr($user->password, 1, 6); $user->password = md5($newPassword); $subject = "Lấy lại mật khẩu tài khoản SotayNhadat.vn"; $content = "Chào bạn " . $user->name; $content .= "<br /><br />Tài khoản của bạn tại website " . base_url() . " đã được Chúng tôi cấp lại mật khẩu. Bạn vui lòng truy cập " . base_url() . " và đăng nhập với mật khẩu mới, sau đó bạn cần thay đổi lại mật khẩu."; $content .= "<br /><br />Tên đăng nhập: " . $user->username; $content .= "<br />Mật khẩu: " . $newPassword; $content .= "<br /><br />Nếu bạn gặp khó khăn, bạn có thể liên hệ với Chúng tôi để được hỗ trợ:"; $content .= "<br />Email: info@sotaynhadat.vn – Hotline: 0168 200 0080"; $content .= "<br /><br />-------------------------------------------------------------"; $content .= "<br />BQT SotayNhadat.vn"; if ($this->_send_email('myemail', $subject, $content, $user->email)) { $user->save(); } $msg = "Chúng tôi đã gửi email chứa mật khẩu mới của bạn. Vui lòng kiểm tra hộp thư spam hay bulk nếu không tìm thấy email của chúng tôi."; } } $view = "front/user/forgotPassword"; $dis['base_url'] = base_url(); $dis['view'] = $view; $dis['msg'] = $msg; /*$dis['view'] = $view; $dis['type'] = $type;*/ $this->viewfront($dis); }
function lock($id = 0, $value) { if ($id != 0) { $estateuser = new Estateuser($id); if (!$estateuser->exists()) { show_404(); } $estateuser->isLock = ($estateuser->isLock + 1) % 2; $estateuser->save(); } flash_message('success', "Thao tác thành công."); redirect($_SERVER['HTTP_REFERER']); }