This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
| class MY_Controller extends Controller | |
| { | |
| function MY_Controller() | |
| { | |
| parent::Controller(); | |
| $this->auth_logged_in(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Privatepage extends MY_Controller { | |
| function __construct() | |
| { | |
| parent::__construct(); | |
| } | |
| function index() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function logout() | |
| { | |
| // Destroy the session | |
| $this->session->sess_destroy(); | |
| // Take the user back to the home page | |
| redirect('/'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if ($this->session->userdata('user_id')) | |
| { | |
| echo 'Hello user '.$this->session->userdata('user_id'); | |
| echo ' '.anchor('users/logout','Logout').'<br />'; | |
| echo anchor('/privatepage','Private page'); | |
| } | |
| else | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <title>User login</title> | |
| </head> | |
| <body> | |
| <?=form_open(current_url())?> | |
| <p><?=form_label('Email')?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function login() | |
| { | |
| // Set required fields | |
| $this->form_validation->set_rules('email', 'Email', 'required'); | |
| $this->form_validation->set_rules('password', 'Password', 'required'); | |
| if ($this->form_validation->run() == FALSE) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class User_model extends Model { | |
| function add_user($user_array) | |
| { | |
| // Insert the new user array into the users table | |
| return $this->db->insert('users',$user_array); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Home extends MY_Controller { | |
| public function index() | |
| { | |
| // Automatically the system will render this view: ./application/views/home/index.php | |
| } | |
| public function page_two() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MY_Controller extends CI_Controller | |
| { | |
| public $data = array(); // Array to store data - passed to views. | |
| protected $view_path = null; // Here to overide the view path if needed. | |
| protected function __construct() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # domain: phawk.co.uk & peteyhawkins.com | |
| <VirtualHost *:80> | |
| ServerName phawk.co.uk | |
| ServerAlias www.phawk.co.uk www.peteyhawkins.com peteyhawkins.com | |
| ProxyPass / http://localhost:9000/ | |
| ProxyPassReverseCookieDomain localhost your.domain | |
| ProxyPreserveHost on | |
| <Location /> | |
| ProxyPassReverse / | |
| </Location> |