codeigniter-2

CodeIgniter Paging 404

和自甴很熟 提交于 2019-12-06 22:34:32
I've checked several threads on here regarding paging in CodeIgniter but I haven't found a solution to my problem. I have a controller class located at controllers/admin/index.php called 'Index' that contains the following code: class Index extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper("url"); $this->load->helper( 'events_helper' ); $this->load->helper( 'delegates_helper' ); $this->load->model( 'admin/event_model' ); $this->load->model( 'admin/delegate_model' ); $this->load->library( 'pagination' ); } public function index() { $config =

Only variables should be assigned by reference with function

浪子不回头ぞ 提交于 2019-12-06 21:21:40
问题 I use old version of Codeigniter framework. With new version of php I am gettings this error: Only variables should be assigned by reference I am wondering if this is safe bugfix: Changing: $this->_base_classes =& is_loaded(); to $assign = is_loaded(); $this->_base_classes =& $assign; Is that the same? 回答1: Please see this url https://github.com/bcit-ci/CodeIgniter/issues/904 You can go to file: system/core/Loader.php Then file: system/core/Common.php Line 190 there should be: function &is

get logged in user info in CodeIgniter (HMVC & Ion Auth)

心不动则不痛 提交于 2019-12-06 19:36:46
I am trying to get Logged in user details in CodeIgniter (HMVC & Ion Auth) $data['user'] = $this->ion_auth->user()->row(); When i try to display i am getting error Undefined variable: user I am not sure how to get loggin in user id or email. I need id or email. Please help If your are trying to display it in view, Are you passing the $data variable to the view ? $data['user']=$this->ion_auth->user()->row(); $this->load->view("filename",$data); If you are trying to access it with the controller you can access the variable like $data['user']=$this->ion_auth->user()->row(); $username=$data['user'

CodeIgniter session timeout issue

Deadly 提交于 2019-12-06 16:58:36
I’m using CI 2.1.4 and I set $config['sess_expiration'] = 0; but sometime when I’m in my dashboard I’m unlogged automaticaly by the site… The context is the following : I’m using 2 applications for 1 system, but both applications use the same encryption key, session table and the same timeout. This problem appear when I submit a form then after I pick up session data to add it in the database. Anyone has an idea ? Thanks. I think you have 2 ways to fix it. First, you should download latest code from github and replace session library folder with downloaded code. Second, you can extends the

Codeigniter build validation class at your own needs

匆匆过客 提交于 2019-12-06 15:14:44
I am working in codeigniter and Iam looking to make my own custom validation class using "Validation_form" library and my custom rule where I will place my own validation rules and use that from everywhere in my project, but this seems impossible, I tried in couples ways to handle this but nothing. Codeigniter kindle force me to make my callback methods in my controller but I need them in my library or "method" or wherever else!!! My question is, can I build an specific library where I'll place my validation rules and other functions I need to handle that? you could create a new library in

Controlling User Privileges in Codeigniter

萝らか妹 提交于 2019-12-06 14:56:46
Suppose I am building a web application using Codeigniter. I have two levels of user- 1. Admin and 2. Manager . I want my admin to be able to ADD,EDIT, DELETE, so in my view file I have the following: <a href="somelink">ADD</a> <a href="somelink">EDIT</a> <a href="somelink">DELETE</a> But in some specific pages, I don't want my Manager to be able to delete or edit any record, he will be allowed to add data only . Now my question is since I have multiple types of user and user- privileges do I have to create a new controller and a view file for my manager(and for each other user levels) or

Prevent white space in query being converted to %20

自作多情 提交于 2019-12-06 12:27:02
问题 I have the following function in my model that I want to use to search for phrases and so on. However if I pass in more than one word the spaces are always converted to the %20 symbol which breaks my query. How do I avoid this? Also is this type of query secure by default in codeigniter? or do I need to escape $term first? function get_search_entries($limit, $start, $term) { $this->db->select('statuses.id, title, status, posted_by, created, rating, name'); $this->db->from('statuses'); $this-

Codeigniter update_batch() with included update of the where key

☆樱花仙子☆ 提交于 2019-12-06 12:06:40
I want to update multiple rows in the database with codeigniters update_batch() function. But the field specified in the where should also be changed. The following code should make it clear: $set = array( array( 'token' => '65787131678754', 'device' => 'none', 'new_token_value' => '' ), array( 'token' => '75798451315464', 'device' => 'none', 'new_token_value' => '' ) ); $this->db->update_batch(TBL_NAME, $set, 'token'); Tokens specified in token should be updated with device to 'none' and the token itself should be set to empty string '' . Is this possible with update_batch() function? In sql

Codeigniter - Restricting direct access to controller functions from URL call

梦想与她 提交于 2019-12-06 10:40:43
I want to know if there is any way through which I can restrict access to my controller functions through URL. But I want to give them a call through my link in the site. For example if I have a link in my site which points to a controller function: <a href='test/function'>Call me</a> But I don't want the controller function to be called when I place the above URL in my browser address bar. Can anyone help with this? As you stated in the comment, that if you want to load the link via AJAX: Your markup: <a href="test/function" data-key="abc"> Your jquery: $('a').on('click',function(){ var data

CodeIgniter PDO driver uses query instead of prepare? Isn't this less secure?

随声附和 提交于 2019-12-06 10:33:57
I am new to the CodeIgniter framework for php and was looking at the PDO database driver with Version 2.1.0. I noticed it uses the PDO 'query' function and not 'prepare' and 'bindParam'/'bindValue'. Doesn't this completely miss the point of using PDO in the first place and in fact make it less protected from sql injection than using the normal mysql driver they provide. It doesn't seem to be escaping queries like it does with the other provided drivers? Or am I completely misinterpreting something? EDIT: It looks as if CodeIgniter may in fact be using PDO::quote to sanitize. But even the php