本文整理汇总了PHP中MY_Controller::create_captcha方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Controller::create_captcha方法的具体用法?PHP MY_Controller::create_captcha怎么用?PHP MY_Controller::create_captcha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Controller
的用法示例。
在下文中一共展示了MY_Controller::create_captcha方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unsubscribe
function unsubscribe($email_hash)
{
if ($email_hash !== '') {
$this->load->model('Email_model');
$email_details_array = $this->Email_model->get_email_details_by_hash($email_hash);
$data = array();
$this->load->helper('form');
if ($this->input->post()) {
$this->load->library('form_validation');
$this->form_validation->set_rules('user_email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('captcha_image', 'Image Text', 'trim|required|callback_validate_captcha');
$this->form_validation->set_error_delimiters('<span class="help-block">', '</span>');
if ($this->form_validation->run() && $this->input->post('user_email') === $email_details_array['email_to']) {
$user_details_array = $this->User_model->get_user_by_email($email_details_array['email_to']);
if (count($user_details_array) > 0) {
$time_now = date('Y-m-d H:i:s');
$user_update_array = array('user_security_hash' => md5($time_now . $this->input->post('user_email')), 'newsletter_status' => '0', 'user_modified' => $time_now);
if ($this->User_model->edit($user_details_array['user_id'], $user_update_array)) {
$data['success'] = 'Unsubscribing Complete !!!';
}
} else {
$data['error'] = 'Unsubscribing Incomplete !!!';
}
} else {
$data['error'] = 'Unsubscribing Incomplete !!!';
}
}
$this->load->library('form_validation');
$data['email_to'] = $email_details_array['email_to'];
$data['captcha_image'] = parent::create_captcha();
$this->render_view($data, 'auth');
} else {
redirect('auth/login', 'refresh');
}
}
示例2: array
function reset_password($user_security_hash = '')
{
$max_attempts = 3;
if (!isset($_SESSION['reset_attempt'])) {
$_SESSION['reset_attempt'] = 1;
}
$data = array();
$data['show_form'] = TRUE;
if ($user_security_hash != '') {
$this->load->model('Auth_model');
$this->load->helper('form');
$user_details_array = $this->Auth_model->get_user_details_by_user_security_hash($user_security_hash);
if (count($user_details_array) > 0) {
if (!in_array($user_details_array['user_status'], array('0', '1'))) {
session_destroy();
$this->session->sess_destroy();
$data['error'] = 'Account Suspended !!!';
$data['show_form'] = FALSE;
} else {
$this->load->library('form_validation');
if ($this->input->post()) {
$this->form_validation->set_rules('user_login_password', 'Password', 'trim|required|min_length[5]');
$this->form_validation->set_rules('user_confirm_password', 'Confirm Password', 'trim|required|matches[user_login_password]');
$this->form_validation->set_rules('captcha_image', 'Image Text', 'trim|required|callback_validate_captcha');
$this->form_validation->set_error_delimiters('<span class="help-block">', '</span>');
if ($this->form_validation->run()) {
$this->load->library('encrypt');
$time_now = date('Y-m-d H:i:s');
$user_array = array('user_login_salt' => md5($time_now), 'user_login_password' => md5(md5(md5($time_now) . $this->input->post('user_login_password'))), 'user_password_hash' => $this->encrypt->encode($this->input->post('user_login_password'), md5(md5(md5($time_now) . $this->input->post('user_login_password')))), 'user_security_hash' => md5($time_now . $this->input->post('user_login_password')), 'user_status' => '1', 'user_modified' => $time_now);
if ($this->Auth_model->update_user_details_by_user_security_hash($user_security_hash, $user_array)) {
$data['success'] = 'Password Changed Successfully.';
$data['show_form'] = FALSE;
session_destroy();
$this->session->sess_destroy();
} else {
session_destroy();
$this->session->sess_destroy();
$data['error'] = 'Error Resetting Password !!!';
$data['show_form'] = TRUE;
}
} else {
$_SESSION['reset_attempt'] += 1;
if ($_SESSION['reset_attempt'] > $max_attempts) {
$this->load->library('encrypt');
$time_now = date('Y-m-d H:i:s');
$user_array = array('user_security_hash' => md5($time_now . $this->input->post('user_login_password')), 'user_modified' => $time_now);
if ($this->Auth_model->update_user_details_by_user_security_hash($user_security_hash, $user_array)) {
$data['error'] = 'Link Disabled Permanently !!!';
$data['show_form'] = FALSE;
session_destroy();
$this->session->sess_destroy();
}
} else {
$data['error'] = 'Error Resetting Password !!!';
$data['show_form'] = TRUE;
}
}
}
}
} else {
session_destroy();
$this->session->sess_destroy();
$data['error'] = 'Invalid Link !!!';
$data['show_form'] = FALSE;
}
} else {
session_destroy();
$this->session->sess_destroy();
$data['error'] = 'Invalid Link !!!';
$data['show_form'] = FALSE;
}
$data['captcha_image'] = parent::create_captcha();
$this->render_view($data, 'auth');
}