public function index() { $this->mLayout = "empty"; $this->mTheme = 'login-page'; $this->mViewFile = 'login'; if (validate_form()) { $username = $this->input->post('username'); $password = $this->input->post('password'); $this->load->model('Backend_user_model', 'backend_users'); $user = $this->backend_users->get_by('username', $username); // only admin and staff can login if (verify_role(['admin', 'staff-1', 'staff-2', 'staff-3'], $user)) { // password correct if (verify_pw($password, $user['password'])) { // limited fields to store in session $fields = array('id', 'role', 'username', 'full_name', 'created_at'); $user_data = elements($fields, $user); login_user($user); // success set_alert('success', 'Login success'); redirect('home'); exit; } } // failed set_alert('danger', 'Invalid Login'); redirect('login'); } }
/** * Constructor with common logic for pages that required login */ public function __construct() { parent::__construct(); // redirect to Login page if user not logged in $this->mUser = get_user(); if (empty($this->mUser)) { redirect('login'); exit; } // basic URL params $this->mCtrler = $this->router->fetch_class(); $this->mAction = $this->router->fetch_method(); $this->mParam = $this->uri->segment(3); // Use default language if the Backend System only support single locale $this->mLocale = $this->config->item('language'); // default values for page output $this->mLayout = "default"; // switch theme by login user roles $this->mTheme = verify_role('admin') ? THEME_ADMIN : THEME_STAFF; // side menu items $this->config->load('menu_' . $this->mUser['role']); $this->mMenu = $this->config->item('menu'); // breadcrumb entries $this->mBreadcrumb = array(); $this->push_breadcrumb('Home', '', 'home'); // setup basic view data $this->mViewData = array('locale' => $this->mLocale, 'ctrler' => $this->mCtrler, 'action' => $this->mAction, 'user' => $this->mUser, 'menu' => $this->mMenu); }
public function __construct() { parent::__construct(); // only admin role can access this controller if (!verify_role('admin')) { redirect(); exit; } $this->load->helper('crud'); }
public function index() { // only admin role can access this controller if (!verify_role('admin')) { redirect(); exit; } // CRUD table $crud = generate_crud('activites'); $crud->set_subject('activites'); $crud->set_field_upload('image1', 'assets/uploads/'); $crud->set_field_upload('image2', 'assets/uploads/'); $crud->set_field_upload('image3', 'assets/uploads/'); $crud->set_field_upload('image4', 'assets/uploads/'); $crud->set_field_upload('image5', 'assets/uploads/'); $crud->display_as('id_modepaiement', 'Mode de paiement'); $crud->display_as('id_service', 'Service'); $this->load->model('restaurants_model'); $myarrapaiement = array(); $modepaiements = $this->restaurants_model->getInfos('modepaiement'); if (count($modepaiements->result()) > 0) { foreach ($modepaiements->result() as $row) { $myarrapaiement[$row->id] = $row->nom; } $crud->field_type('id_modepaiement', 'multiselect', $myarrapaiement); } $myarrayservice = array(); $modepaiements = $this->restaurants_model->getInfos('modepaiement'); if (count($modepaiements->result()) > 0) { foreach ($modepaiements->result() as $row) { $myarrayservice[$row->id] = $row->nom; } $crud->field_type('id_service', 'multiselect', $myarrayservice); } $myarrayvilles = array(); $villes = $this->restaurants_model->getVilles(); if (count($villes->result()) > 0) { foreach ($villes->result() as $row) { $myarrayvilles[$row->nom] = $row->nom; } $crud->field_type('ville', 'dropdown', $myarrayvilles); } $this->db->select('id, nom'); $results = $this->db->get('sous_activite')->result(); $types = array(); foreach ($results as $result) { $types[$result->nom] = $result->nom; } $crud->field_type('type', 'dropdown', $types); $this->mTitle = "Activités"; $this->mViewFile = '_partial/crud'; $this->mViewData['crud_data'] = $crud->render(); }
public function __construct() { parent::__construct(); // only admin role can access this controller if (!verify_role('admin')) { redirect(); exit; } $this->load->helper('crud'); $this->load->model('classroom_model', 'classroom'); $this->load->model('furniture_model', 'furniture'); }
public function seo() { if (!verify_role('admin')) { redirect(); exit; } $this->load->helper('crud'); // CRUD table $crud = generate_crud('seo'); $crud->field_type('page', 'dropdown', array('accueil' => 'Accueil', 'restaurants' => 'Se restaurer', 'sejourner' => 'Séjourner', 'divertir' => 'Se divertir', 'evenements' => 'Événements', 'commerces' => 'Commerces')); $crud->set_subject('seo'); $this->mTitle = "SEO"; $this->mViewFile = '_partial/crud'; $this->mViewData['crud_data'] = $crud->render(); }
<!-- Author: Blake McGillis Date: March 21, 2015 Phase: 7 --> <?php //Require the class before the session_start call require "classes/user.php"; require "classes/course.php"; require "classes/application.php"; session_start(); require_once "inc/helper/functions.php"; if (!verify_role('administrator')) { $_SESSION['requestedPage'] = 'Location: adminCoursList.php'; $_SESSION['needsLoginAdmin'] = true; header('Location: login.php'); } //If this page was reached via GET, set up the session variables and variables if (isset($_GET['course_num'])) { $courseNumGet = $_SESSION['course_num_get'] = $_GET['course_num']; $courseNameGet = $_SESSION['course_name_get'] = $_GET['course_name']; } else { $courseNumGet = $_SESSION['course_num_get']; $courseNameGet = $_SESSION['course_name_get']; } //If this page was reached via POST, require updateCourse if (isset($_POST['course_num'])) { require "inc/updateCourse.php"; } //Now call pullSingleCourse.php to get the instructors and interested TAs
<!-- Author: Blake McGillis Date: March 21, 2015 Phase: 7 --> <?php /*Require classes and start the session*/ require "classes/user.php"; require "classes/course.php"; require "classes/application.php"; session_start(); require_once "inc/helper/functions.php"; if (!verify_role('applicant')) { $_SESSION['requestedPage'] = 'Location: appForm.php'; $_SESSION['needsLoginApp'] = true; header('Location: login.php'); } /*Find the application selected by the user*/ $selectedApp = find_app_by_time($_SESSION['applications'], $_GET['time']); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Blake McGillis - Application Display</title> <meta name="author" content="Blake McGillis"> <meta name="date" content="March 21, 2015"> <meta name="phase" content="7"> <link rel="stylesheet" href="styles/styles.css"/>