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 Testing extends CI_Driver_Library | |
| { | |
| protected $valid_drivers = array(); | |
| private $ci; | |
| public function __construct() | |
| { | |
| //get the super object | |
| $this->ci =& get_instance(); |
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 | |
| public function admin_home() | |
| { | |
| check_login(); | |
| $this->load->view('admin_home_view'); | |
| } | |
| ?> |
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 Admin_model extends CI_Model | |
| { | |
| function __construct() | |
| { | |
| parent:: __construct(); | |
| } | |
| public function verify_user($email, $password) |
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 check_login() | |
| { | |
| $CI =& get_instance(); | |
| $user = $CI->session->userdata('username'); | |
| if(!isset($user)) | |
| { | |
| redirect('admin'); | |
| } |
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 | |
| public function index() | |
| { | |
| $user = $this->session->userdata('username'); | |
| if(isset($user)) | |
| { | |
| redirect('admin/admin_home'); | |
| } | |
| $this->form_validation->set_rules('email_address', 'Email Address', 'valid_email|required'); |
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 Admin extends MX_Controller | |
| { | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| $this->load->helper('admin'); | |
| $this->load->library('form_validation'); |
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 | |
| public function searchterm_handler($searchterm) | |
| { | |
| if($searchterm) | |
| { | |
| $this->session->set_userdata('searchterm', $searchterm); | |
| return $searchterm; | |
| } | |
| elseif($this->session->userdata('searchterm')) | |
| { |
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
| <form action ="<?=base_url()?>welcome/search" method="post" id="searchform"> | |
| Search the database: | |
| <input type="text" name="searchterm" id="searchterm" value="<?=$searchterm?>" /> | |
| <input type="submit" value="Search >>" id="submit" /> | |
| </form> |
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 | |
| public function search($searchterm,$limit) | |
| { | |
| $sql = "SELECT * FROM Country | |
| WHERE Continent LIKE '%" . $searchterm . "%' LIMIT " .$limit . ",20"; | |
| $q = $this->db->query($sql); | |
| if($q->num_rows() > 0) | |
| { | |
| foreach($q->result() as $row) | |
| { |
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 | |
| public function search_record_count($searchterm) | |
| { | |
| $sql = "SELECT COUNT(*) As cnt FROM Country | |
| WHERE Continent LIKE '%" . $searchterm . "%'"; | |
| $q = $this->db->query($sql); | |
| $row = $q->row(); | |
| return $row->cnt; | |
| } |