public function index() { if (!$this->canView) { $this->session->set_flashdata('message', '<strong>Oh snap!</strong> You do not have sufficient permissions to View.'); $this->session->set_flashdata('message_type', 'danger'); redirect(base_url() . "index.php/dashboard"); //redirect } $params = array("menuitem_records_per_page" => 10, "menuitem_search" => '', "menuitem_order_by" => 'id', "menuitem_asc_desc" => 'asc', "menuitem_category_id" => '0'); $result = store_session($params); $per_page = $result["menuitem_records_per_page"]; $search = $result["menuitem_search"]; $order_by = $result["menuitem_order_by"]; $asc_desc = $result["menuitem_asc_desc"]; $category_id = $result["menuitem_category_id"]; //echo p($result); $message = $this->session->flashdata('message') ? $this->session->flashdata('message') : ''; $message_type = $this->session->flashdata('message_type') ? $this->session->flashdata('message_type') : ''; $config['base_url'] = base_url() . "index.php/menuitem/index/"; $config['total_rows'] = $this->Mmenuitem->count_all($search); $config['per_page'] = $per_page; $config['uri_segment'] = 3; $this->load->library("pagination", $config); $start = $this->uri->segment(3); $data['info'] = $this->Mmenuitem->listall($config['per_page'], $start, $search, $order_by, $asc_desc); $data['title'] = "Menu Items - List"; $data['search'] = $search; $data['start_no'] = $start + 1; $data['per_page'] = $per_page; $data['total_rows'] = $config['total_rows']; $data['message'] = $message; $data['message_type'] = $message_type; $data['order_by'] = $order_by; $data['asc_desc'] = $asc_desc; $data['canEdit'] = $this->canEdit; //$data['sltCategory'] = $this->Mmenuitem->stlCategory($category_id); $this->template->write_view("content", "list_menuitem", $data); $this->template->render(); }
function start_session($conn) { //DEBUG //END DEBUG $userAgent = $_SERVER['HTTP_USER_AGENT']; $time = time(); if (!isset($_COOKIE['token'])) { $workerId = $_GET['workerId']; $assignmentId = $_GET['assignmentId']; $timeExpire = $time + 3600; $turkSubmitTo = $_GET['turkSubmitTo']; $token = create_token($workerId, $userAgent, $time); set_app_cookies($token, $workerId, $turkSubmitTo, $timeExpire); store_session($conn, $assignmentId, $workerId, $timeExpire, $time, $userAgent, $token); } else { $truth = validate_session($conn, $_COOKIE['token'], $_COOKIE['workerId'], $userAgent); if (!$truth) { //GOTO FAIL echo 'failed'; header('Location: /gotofail.html'); } } }
public function index_benhnhan() { if (!$this->canView) { $this->session->set_flashdata('message', '<strong>Oh snap!</strong> You do not have sufficient permissions to View.'); $this->session->set_flashdata('message_type', 'danger'); redirect(base_url() . "index.php/dashboard"); //redirect } $params = array("user_records_per_page" => 10, "user_search" => '', "user_order_by" => 'id', "user_asc_desc" => 'asc'); $result = store_session($params); $per_page = $result["user_records_per_page"]; $search = $result["user_search"]; $order_by = $result["user_order_by"]; $asc_desc = $result["user_asc_desc"]; $message = $this->session->flashdata('message') ? $this->session->flashdata('message') : ''; $message_type = $this->session->flashdata('message_type') ? $this->session->flashdata('message_type') : ''; $config['base_url'] = base_url() . "index.php/user/index/"; $config['total_rows'] = $this->Muser->count_all($search, 0, 1); //Lấy toàn bộ danh sách $config['per_page'] = $per_page; $config['uri_segment'] = 3; $this->load->library("pagination", $config); $start = $this->uri->segment(3); $data['info'] = $this->Muser->listall($config['per_page'], $start, $search, $order_by, $asc_desc, 0, 1); //Lấy toàn bộ danh sách $data['title'] = "User - List"; $data['search'] = $search; $data['start_no'] = $start + 1; $data['per_page'] = $per_page; $data['total_rows'] = $config['total_rows']; $data['message'] = $message; $data['message_type'] = $message_type; $data['order_by'] = $order_by; $data['asc_desc'] = $asc_desc; $data['canEdit'] = $this->canEdit; $this->template->write_view("content", "list_userbenhnhan", $data); $this->template->render(); }
function Confirm_store_session() { if (!store_session()) { redirect_to("login.php"); } }