<?php safe_include("models/app_model.php"); class Car_Model extends App_model { function __construct() { parent::__construct(); $this->_table = 'cars'; } function get_cars() { $this->db->select('*'); $this->db->from('cars'); return $this->db->get()->result_array(); } function get_makes() { $this->db->select('*'); $this->db->from('car_makes'); return $this->db->get()->result_array(); } function get_models($make_id = null) { $this->db->select('*'); if (!is_null($make_id)) { $this->db->where('make_id', $make_id); } $this->db->from('car_models'); return $this->db->get()->result_array(); }
<?php //require_once("libraries/models/App_model.php"); safe_include(COREPATH . "models/App_model.php"); class Lang_model extends App_Model { function __construct() { parent::__construct(); $this->_table = 'language'; } function listing() { $this->_fields = "*,id as id, IF(is_active='1','Active','Inactive') as is_active"; foreach ($this->criteria as $key => $value) { if (!is_array($value) && strcmp($value, '') === 0) { continue; } switch ($key) { case 'lang': $this->db->like($key, $value); break; } } return parent::listing(); } function get_menu($table_name, $where) { $result = $this->db->get_where($table_name, $where); return $result->result_array(); }
<?php safe_include("libraries/controllers/Cart_controller.php"); class Paypal_exp extends Cart_controller { public function __construct() { parent::__construct(); $this->load->library('paypal_express/payexp/SetExpressCheckout', array(), 'SetExpressCheckout'); $this->load->library('paypal_express/payexp/DoExpressCheckoutPayment', array(), 'DoExpressCheckoutPayment'); $this->load->library("cart"); $this->load->model("checkout_model"); } public function index() { $this->setCheckout(); } function setCheckout() { try { //Shiiping and billing Information $shipment = $this->session->userdata('shipping_info'); $params = $this->common_params("get_express_check"); $this->SetExpressCheckout->initialize($params); $response = $this->SetExpressCheckout->setEC(); //print_r($response);exit; if ((strcmp($response['ACK'], 'Success') === 0 || strcmp($response['ACK'], 'SuccessWithWarning') === 0) && !empty($response['TOKEN'])) { //$redirect_url="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$response->Token; redirect($response['REDIRECTURL']); } else { $msg = "";
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } safe_include("controllers/app_controller.php"); class Admin_controller extends App_controller { public $namespace; public $_search_conditions = array("search_type", "search_text"); public $_narrow_search_conditions = array(); public $_session_namespace; public $_session_narrow_namespace; public $previous_url = ''; function __construct() { parent::__construct(); //set name-spaces for session-storage of each controller-method pair. $this->namespace = strtolower($this->uri->segment(1, 'admin') . '_' . $this->uri->segment(2, 'index') . '_' . $this->uri->segment(3, 'index')); //echo '<pre>';print_r($this->session->all_userdata()); //get all session keys $sess_keys = array_keys($this->session->all_userdata()); /*unset session-data stored by using namespaces.But except the current controller-methos pair's data. There are list of methods if current method is one of those, dont unset the session.*/ $current_method = $this->uri->segment(3, 'index'); $methods_list = array('index', 'price_list', 'test'); // these are the methods which are having grid-view if (in_array($current_method, $methods_list)) { $keys = array('search_conditions', 'search_narrow_conditions', 'fields', 'per_page', 'order_field', 'direction'); foreach ($sess_keys as $key => $value) { foreach ($keys as $key) {
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } safe_include(COREPATH . "controllers/App_controller.php"); class Admin_Controller extends App_Controller { public $namespace; public $_search_conditions = array("search_type", "search_text"); public $_narrow_search_conditions = array(); public $_session_namespace; public $_session_narrow_namespace; public $previous_url = ''; protected $_logged_in_only = false; public $error_message = ''; public $data = array(); public $role = ''; public $load_css = array(); public $load_js = array(); public $ins_data = array(); protected $_login_validation_rules = array(array('field' => 'email', 'label' => 'Email', 'rules' => 'trim|required|xss_clean'), array('field' => 'password', 'label' => 'Password', 'rules' => 'trim|required|xss_clean|min_length[4]|max_length[20]|alpha_dash')); protected $useradd_validation_rules = array(); protected $role_validation_rules = array(); public $init_scripts = array(); public function __construct() { parent::__construct(); //set name-spaces for session-storage of each controller-method pair. $this->namespace = strtolower($this->uri->segment(1, 'admin') . '_' . $this->uri->segment(2, 'index')); //echo '<pre>';print_r($this->session->all_userdata());
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } safe_include("controllers/admin/admin_controller.php"); class Login extends Admin_Controller { protected $_login_validation_rules = array(array('field' => 'email', 'label' => 'Email', 'rules' => 'trim|required|xss_clean'), array('field' => 'password', 'label' => 'Password', 'rules' => 'trim|required|xss_clean|min_length[4]|max_length[20]|alpha_dash')); function __construct() { parent::__construct(); $this->load->library('form_validation'); $this->load->model('login_model'); } public function index() { $this->login(); } public function login() { $this->form_validation->set_rules($this->_login_validation_rules); if ($this->form_validation->run()) { $form = $this->input->post(); if ($this->login_model->login($form['email'], $form['password'])) { redirect("admin/dashboard"); } } $this->layout->view("login/login"); } public function logout()
| | If your server is behind a reverse proxy, you must whitelist the proxy | IP addresses from which CodeIgniter should trust headers such as | HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify | the visitor's IP address. | | You can use both an array or a comma-separated list of proxy addresses, | as well as specifying whole subnets. Here are a few examples: | | Comma-separated: '10.0.1.200,192.168.5.0/24' | Array: array('10.0.1.200', '192.168.5.0/24') */ $config['proxy_ips'] = ''; /* Since this config file is slightly different (it is loaded by CI without using the Config class) */ /* I added here the support for including config.local.php (@crodas) */ if ($file = safe_include("config/config_live.php", false)) { require $file; } function safe_include($path, $load = true) { if (is_file(APPPATH . $path)) { $fpath = APPPATH . $path; } else { if (is_file(COREPATH . $path)) { $fpath = COREPATH . $path; } else { if (is_file(BASEPATH . $path)) { $fpath = BASEPATH . $path; } } }
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections | - good for ensuring strict SQL while developing | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). | | The $active_record variables lets you determine whether or not to load | the active record class */ $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost'; $db['default']['username'] = '******'; $db['default']['password'] = ''; $db['default']['database'] = 'rs'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; if ($file = safe_include("config/database.local.php", false)) { require $file; } /* End of file database.php */ /* Location: ./application/config/database.php */
<?php if (!defined("BASEPATH")) { exit('No direct script access allowed'); } safe_include('controllers/admin/admin_controller.php'); class Role extends Admin_Controller { function __construct() { parent::__construct(); } function index() { $this->layout->add_javascripts(array('listing', 'rwd-table')); $this->load->library('listing'); $this->simple_search_fields = array('name' => 'Role'); $this->_narrow_search_conditions = array(); $str = '<a href="' . site_url('admin/role/edit/{id}') . '" class="table-link"> <span class="fa-stack"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-pencil fa-stack-1x fa-inverse"></i> </span> </a>'; $this->listing->initialize(array('listing_action' => $str)); $listing = $this->listing->get_listings('role_model', 'listing'); if ($this->input->is_ajax_request()) { $this->_ajax_output(array('listing' => $listing), TRUE); } $this->data['bulk_actions'] = array('' => 'select', 'print' => 'Print'); $this->data['simple_search_fields'] = $this->simple_search_fields;