Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Admin extends CI_Controller {
- /**
- * Index Page for this controller.
- *
- * Maps to the following URL
- * http://example.com/index.php/welcome
- * - or -
- * http://example.com/index.php/welcome/index
- * - or -
- * Since this controller is set as the default controller in
- * config/routes.php, it's displayed at http://example.com/
- *
- * So any other public methods not prefixed with an underscore will
- * map to /index.php/welcome/<method_name>
- * @see http://codeigniter.com/user_guide/general/urls.html
- */
- public function __Construct() {
- parent::__construct();
- if($this->session->userdata('logged_in') == false) {
- redirect('login', 'refresh');
- }
- $this->load->library('form_validation');
- }
- public function index()
- {
- $session_data = $this->session->userdata('logged_in');
- $data['username'] = $session_data['username'];
- $this->load->view('admin/template/menu');
- $this->load->view('admin/dashboard', $data);
- $this->load->view('admin/template/footer');
- }
- public function logout() {
- $this->session->unset_userdata('logged_in');
- redirect('admin', 'refresh');
- }
- public function gebruikers() {
- $this->load->view('admin/template/menu');
- $this->load->view('admin/gebruikers');
- $this->load->view('admin/template/footer');
- }
- public function dashboard() {
- $this->load->view('admin/template/menu');
- $this->load->view('admin/dashboard');
- $this->load->view('admin/template/footer');
- }
- public function optredens() {
- $this->load->view('admin/template/menu');
- $this->load->view('admin/optredens');
- $this->load->view('admin/template/footer');
- }
- public function add_user() {
- $this->load->helper(array('form'));
- $this->form_validation->set_rules('username', 'Username', 'required');
- $this->form_validation->set_rules('password', 'Password', 'required');
- $data['message'] = "";
- $this->load->model('user');
- $input = array(
- 'username' => $this->input->post('username'),
- 'password' => sha1($this->input->post('username'))
- );
- $this->user->add_user($input);
- if ($this->form_validation->run() == FALSE) {
- } else {
- $data['message'] = 'Gefeliciteerd, de gebruiker is succesvol toegevoegd aan de database.';
- }
- $this->load->view('admin/template/menu');
- $this->load->view('admin/gebruikers',$data);
- $this->load->view('admin/template/footer');
- }
- public function add_optreden() {
- $this->load->helper(array('form'));
- $this->$this->form_validation->set_rules('titel', 'Title', 'trim|required|xss_clean');
- $this->$this->form_validation->set_rules('data', 'Data', 'trim|required|xss_clean');
- $this->$this->form_validation->set_rules('locatie', 'Locatie', 'trim|required|xss_clean');
- $this->$this->form_validation->set_rules('beschrijving', 'Beschrijving', 'trim|required|xss_clean');
- $data['message'] = "";
- $this->load->model('optredens')
- $input = array(
- 'titel' => $this->input->post('titel'),
- 'data' => $this->input->post('data'),
- 'locatie' => $this->input->post('locatie'),
- 'beschrijving' => $this->input->post('beschrijving')
- );
- $this->optredens->add_optreden($input);
- if($this->form_validation->run() == false) {
- } else {
- $data['message'] = 'Het optreden is toegevoegd aan de database.';
- }
- $this->load->view('admin/template/menu');
- $this->load->view('admin/optredens',$data);
- $this->load->view('admin/template/footer');
- }
- }
- /* End of file welcome.php */
- /* Location: ./application/controllers/welcome.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement