function __construct() { parent::__construct(TRUE); $this->load->model('Config_model', NULL, TRUE); $this->Config_model = Config_model::getInstance(); set_userdata('active_menu', strtolower(get_class($this))); }
function __construct() { parent::__construct(true); $this->load->model('Editor_Box_model', NULL, TRUE); $this->load->model('Editor_Box_Item_model', NULL, TRUE); $this->Editor_Box_model = Editor_Box_model::getInstance(); $this->Editor_Box_Item_model = Editor_Box_Item_model::getInstance(); $this->_config = $this->config->config; set_userdata('active_menu', strtolower(get_class($this))); }
public function index($page = 'index') { if (!file_exists('application/views/admin_series/' . $page . '.php')) { show_404(); } $temp = isset($_GET['rand']) ? $_GET['rand'] : ''; if (isset($_POST['status'])) { $data = $_POST; set_userdata('admin_search_series_params', $data); } else { if (!empty($temp)) { unset_userdata('admin_search_series_params'); } } $params = userdata('admin_search_series_params'); //echo "<pre>"; print_r($params); $data['params'] = $params; $selectedStatus = isset($params['status']) ? intval($params['status']) : -1; $selectedCountry = isset($params['country']) ? intval($params['country']) : -1; $selectedType = isset($params['type']) ? intval($params['type']) : -1; $statusSelectbox = selectBox($this->_config['status'], array('Name' => 'status', 'Selected' => $selectedStatus, 'MainOption' => TRUE)); $data['statusSelectbox'] = $statusSelectbox; $countrySelectbox = selectBox($this->_config['countries'], array('Name' => 'country', 'Selected' => $selectedCountry, 'MainOption' => TRUE)); $data['countrySelectbox'] = $countrySelectbox; $typeSelectbox = selectBox($this->_config['video_type'], array('Name' => 'type', 'Selected' => $selectedType, 'MainOption' => TRUE)); $data['typeSelectbox'] = $typeSelectbox; $offset = isset($_GET['o']) ? intval($_GET['o']) : 0; $this->layout->title('List series'); $whereClause = "1"; if (isset($params['keyword']) && !empty($params['keyword'])) { $keywork = addslashes($params['keyword']); $whereClause .= " AND title LIKE '%{$keywork}%' "; } if (isset($params['status']) && $params['status'] != -1) { $whereClause .= " AND status ='{$selectedStatus}' "; } if (isset($params['country']) && !empty($params['country']) && $params['country'] != -1) { $whereClause .= " AND country ='{$selectedCountry}' "; } if (isset($params['type']) && !empty($params['type']) && $params['type'] != -1) { $whereClause .= " AND type ='{$selectedType}' "; } $total = $this->Series_model->getTotal($whereClause); $listObject = $this->Series_model->getRange($whereClause, $offset, ITEM_PER_PAGE); $uri = "admin_series/index"; $data['countries'] = $this->_config['countries']; $data['video_type'] = $this->_config['video_type']; $data['listObject'] = $listObject; $data['total'] = $total; $data['max'] = ITEM_PER_PAGE; $data['offset'] = $offset; $data['uri'] = $uri . '?o='; $this->layout->view('admin_series/' . $page, $data); }
function __construct() { parent::__construct(TRUE); set_userdata('active_menu', strtolower(get_class($this))); $this->_config = $this->config->config; $this->load->library('simple_html_dom'); $this->load->file(APPPATH . 'components/ImportDramaCool.php'); $this->dramaCool = new ImportDramaCool(); $this->load->model('Config_model', NULL, TRUE); $this->Config_model = Config_model::getInstance(); set_time_limit(0); }
public function register() { $this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean|is_unique[user.user_name]'); $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean'); $this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email|is_unique[user.user_email]'); $this->form_validation->set_message('is_unique', 'The %s has been registered'); if ($this->form_validation->run()) { $code = generate_code(12); $name = $this->input->post('name'); $password = $this->input->post('password'); $email = $this->input->post('email'); $data = array('user_name' => $name, 'user_password' => enkripsi($password), 'user_email' => $email, 'user_status' => 'active', 'user_created_date' => now(), 'user_image' => 'default.jpg', 'user_registation_reff' => 'web'); $iduser = $this->model_user->store($data); $row = $this->model_user->find($iduser); set_userdata('session_user', $row); set_userdata('user_level', 'member'); $outs['msg'] = 'Registration success'; $outs['flag'] = 1; } else { $outs['msg'] = validation_errors(); $outs['flag'] = 0; } echo json_encode($outs); }
function set_flash_error($message) { $ci =& get_instance(); set_userdata('error', $message); }
function get_cpu() { $file = file("/proc/stat"); $tmp = explode(" ", $file[0]); $cpu_user_old = get_userdata("cpu_user"); $cpu_nice_old = get_userdata("cpu_nice"); $cpu_sys_old = get_userdata("cpu_sys"); $cpu_idle_old = get_userdata("cpu_idle"); $cpu_io_old = get_userdata("cpu_io"); $cpu_user = $tmp[2]; $cpu_nice = $tmp[3]; $cpu_sys = $tmp[4]; $cpu_idle = $tmp[5]; $cpu_io = $tmp[6]; $diff_used = $cpu_user - $cpu_user_old + ($cpu_nice - $cpu_nice_old) + ($cpu_sys - $cpu_sys_old) + ($cpu_io - $cpu_io_old); $diff_total = $cpu_user - $cpu_user_old + ($cpu_nice - $cpu_nice_old) + ($cpu_sys - $cpu_sys_old) + ($cpu_io - $cpu_io_old) + ($cpu_idle - $cpu_idle_old); $cpu = $diff_used / $diff_total * 100; set_userdata(array("cpu_user" => $cpu_user, "cpu_nice" => $cpu_nice, "cpu_sys" => $cpu_sys, "cpu_idle" => $cpu_idle, "cpu_io" => $cpu_io)); return $cpu; }
public function ajax_login() { $username = $this->input->get("user_name"); $password = $this->input->get("user_password"); $row = $this->model_user->get_single('user', 'username', $username); if (count($row) > 0) { if ($row->is_idap) { $_GET['username'] = $username; $_GET['password'] = $password; //akses menggunakan LDAP $result = $this->check_idap($username, $password); if ($result == 'berhasil') { $row->level_name = $this->auth->level_name_by_idlevel($row->level); set_userdata('session_user', $row); set_userdata("admin_id", $row->iduser); $this->model_user->change($row->iduser, array('last_login' => date('Y-m-d H:i:s'))); echo json_encode(array("message" => "<div class='text-successs'>Success Login with LDAP</div>", "result" => 1)); } else { echo json_encode(array("message" => "<div class='text-danger'>Invalid username or password</div>", "result" => 0)); } } else { //akses tidak menggunakan LDAP if (!($row = $this->model_user->cek_login($username, enkripsi($password)))) { echo json_encode(array("message" => "<div class='text-danger'>Invalid username or password</div>", "result" => 0)); } else { $row->level_name = $this->auth->level_name_by_idlevel($row->level); set_userdata('session_user', $row); set_userdata("admin_id", $row->iduser); $this->model_user->change($row->iduser, array('last_login' => date('Y-m-d H:i:s'))); echo json_encode(array("message" => "<div class='text-successs'>Success Login</div>", "result" => 1)); } } } else { echo json_encode(array("message" => "<div class='text-danger'>Invalid username or password</div>", "result" => 0)); } }
function retrieve_external_userdata() { global $data_dir, $username, $password; include "../plugins/retrieveuserdata/config.php"; include "../plugins/retrieveuserdata/{$retrieve_data_from}"; $cleartext_password = OneTimePadDecrypt($password, $onetimepad); $userdata = retrieve_data($username, $cleartext_password); if (!$userdata["error"]) { set_userdata($userdata["common_name"], $userdata["mail_address"]); set_userdata_backup($userdata["common_name"], $userdata["mail_address"]); setPref($data_dir, $username, "got_external_userdata", 1); } }
public function add() { $this->auth->check_access("task_add"); $this->template->title(APP_NAME, "task Add"); $this->form_validation->set_rules("project_id", "Project ID", "required"); $this->form_validation->set_rules("task_type", "Task Type", "required"); $this->form_validation->set_rules("plan_date", "Plan Date", "required"); $this->form_validation->set_rules("remark", "Remark", "required"); if (isset($_POST['idsite'])) { $idsite = $_POST['idsite']; set_userdata("idsite", $idsite); } if ($this->form_validation->run()) { $data['pm_idsite'] = $this->input->post("idsite"); $data['pm_plan'] = $this->input->post("plan_date"); $data['pm_date_added'] = date("Y-m-d H:i:s"); $this->model_task->store($data); set_flashdata("notif", alert("berhasil menambah data")); unset_userdata('idsite'); redirect("admin/user"); } $data = array(); if (userdata('idsite')) { $data['result_site'] = userdata('idsite'); } else { $data['result_site'] = array(); } $this->renderAdmin('admin/task/task_add', $data); }