\\โค๊ดแจ้งเตือนถ้าเราใส่ข้อมูลในการสมัครสมาชิกผิด
$this->load->library('form_validation');
$this->form_validation->set_rules('account_username', 'lang:account_username', 'trim|required|xss_clean|min_length[1]|no_space_between_text');
$this->form_validation->set_rules('account_email', 'lang:account_email', 'trim|required|valid_email|xss_clean');
$this->form_validation->set_rules('account_password', 'lang:account_password', 'trim|required');
$this->form_validation->set_rules('account_confirm_password', 'lang:account_confirm_password', 'trim|required|matches[account_password]');
$this->form_validation->set_rules('name', 'lang:Name', 'trim|required|xss_clean|min_length[1]|no_space_between_text');
$this->form_validation->set_rules('last_name', 'lang:Last Name', 'trim|required|xss_clean|min_length[1]|no_space_between_text');
$this->form_validation->set_rules('id_card', 'lang:กรุณาใส่เลขประจำตัวประชาชนให้ถูกต้อง', 'trim|required|xss_clean|exact_length[13]');
if ($this->form_validation->run() == false) {
$output['form_status'] = 'error';
$output['form_status_message'] = '<ul>'.validation_errors('<li>', '</li>').'</ul>';
} else {
-----------------------------------------------------------------------------------------------------------------------------------------------------
อันนี้เป็นโค๊ดcaptchaครับ
// check plugin captcha
if ($output['plugin_captcha'] != null) {
// use plugin captcha to check
$plug_captcha_check = $this->modules_plug->do_action('account_register_check_captcha', $_POST);
if (isset($plug_captcha_check['account_register_check_captcha']) && is_array($plug_captcha_check['account_register_check_captcha'])
&& in_array(true, $plug_captcha_check['account_register_check_captcha'], true)) {
$continue = true;
} else {
$output['form_status'] = 'error';
$output['form_status_message'] = $this->lang->line('account_wrong_captcha_code');
}
} else {
อยากให้ช่วยอธิบายหน่อยครับว่าแต่ละบรรทัดทำงานยังไง คร่าวๆก็ได้ครับ ผมต้องเขียนส่งอาจารย์ อ่ะครับ
ช่วยอธิบายโค๊ดแจ้งเตือนการสมัครถ้ากรอกข้อมูลผิดและโค๊ดcaptcha
$this->load->library('form_validation');
$this->form_validation->set_rules('account_username', 'lang:account_username', 'trim|required|xss_clean|min_length[1]|no_space_between_text');
$this->form_validation->set_rules('account_email', 'lang:account_email', 'trim|required|valid_email|xss_clean');
$this->form_validation->set_rules('account_password', 'lang:account_password', 'trim|required');
$this->form_validation->set_rules('account_confirm_password', 'lang:account_confirm_password', 'trim|required|matches[account_password]');
$this->form_validation->set_rules('name', 'lang:Name', 'trim|required|xss_clean|min_length[1]|no_space_between_text');
$this->form_validation->set_rules('last_name', 'lang:Last Name', 'trim|required|xss_clean|min_length[1]|no_space_between_text');
$this->form_validation->set_rules('id_card', 'lang:กรุณาใส่เลขประจำตัวประชาชนให้ถูกต้อง', 'trim|required|xss_clean|exact_length[13]');
if ($this->form_validation->run() == false) {
$output['form_status'] = 'error';
$output['form_status_message'] = '<ul>'.validation_errors('<li>', '</li>').'</ul>';
} else {
-----------------------------------------------------------------------------------------------------------------------------------------------------
อันนี้เป็นโค๊ดcaptchaครับ
// check plugin captcha
if ($output['plugin_captcha'] != null) {
// use plugin captcha to check
$plug_captcha_check = $this->modules_plug->do_action('account_register_check_captcha', $_POST);
if (isset($plug_captcha_check['account_register_check_captcha']) && is_array($plug_captcha_check['account_register_check_captcha'])
&& in_array(true, $plug_captcha_check['account_register_check_captcha'], true)) {
$continue = true;
} else {
$output['form_status'] = 'error';
$output['form_status_message'] = $this->lang->line('account_wrong_captcha_code');
}
} else {
อยากให้ช่วยอธิบายหน่อยครับว่าแต่ละบรรทัดทำงานยังไง คร่าวๆก็ได้ครับ ผมต้องเขียนส่งอาจารย์ อ่ะครับ