codeigniter-2

What Does Doctrine Add Above Active Record - CodeIgniter?

我是研究僧i 提交于 2019-12-06 02:03:48
问题 I really like CodeIgniter's Active Record and how nicely it allows all my needed database queries. But I've also been reading about ORMs like Doctrine. When I read Doctrine's documentation, it does not seem as clear to use as Active Record, and I can't see what makes it better (if it is). What does Doctrine allow that is not possible with Active Record? Does Doctrine make the same job faster, easier, better? Or does it do things Active Record cannot do? Best would be if people could post

How to store multi byte characters in SQL Server database using CodeIgniter

只谈情不闲聊 提交于 2019-12-06 01:59:40
问题 I'm using MS SQL Server and CodeIgniter 2 with Active Record for a project I'm working on, and I just stumbled upon this issue: When I submit a form that contains Chinese or Hindi characters, I store it in a table, and when I view it all I get are question marks. If I try English or Greek characters, everything seems to work fine. The reason I believe this is something to do with the PHP I'm writing, is because if I copy-paste the chinese text directly in SQL Server Management Studio, all

CodeIgniter call same function for all controllers

别来无恙 提交于 2019-12-06 01:38:50
I'm developing an application, where the same function I'm writing for some controllers. So I wanted one common function for all controllers. Please help me out I've stucked up with this. The work would be more appreciated. You can develop a helper or library. codeigniter version 2 : https://codeigniter.com/userguide2/general/creating_libraries.html codeigniter version 3 : https://codeigniter.com/user_guide/general/creating_libraries.html?highlight=library You can create MY_Controller class in application/core Class MY_Controller Extends CI_Controller{ public function __construct(){ parent::_

CodeIgniter: unset all userdata, but not destroy the session

删除回忆录丶 提交于 2019-12-05 18:58:54
Is there a way to unset ALL userdata in a session without having to use session destroy? I'm trying to log my user out and need to unset all userdata one at a time. It's becoming tedious to keep track of all possible userdata set in session. I just want to unset everything that might have been set in userdata. This is very simple! $this->session->unset_userdata('some_name'); or $array_items = array('username' => '', 'email' => ''); $this->session->unset_userdata($array_items); I hope this helps! Edit: It looks like you actually don't keep track of anything in your session (kind of strange?).

Codeigniter Extend custom model produces FATAL ERROR

狂风中的少年 提交于 2019-12-05 17:38:20
I've seen a few different posts on this, but none of them seem to be working for me. I have one class that extends CI_Model: class Users_Model extends CI_Model { public function __construct(){ parent::__construct(); } and then: class Students_Model extends Users_Model { private $_students; public function __construct(){ parent::__construct(); $this->_students = $this->get_students(); } However I then receive this error message: PHP Fatal error: Class 'Users_Model' not found in /Users/rosswilson/Localhost/thedrumrooms/dreamweaver/ci/application/models/students_model.php I've used require_once

Codeigniter CIBonfire how to change mode from development to production?

寵の児 提交于 2019-12-05 17:04:34
I'm creating my first app using CIBonfire and i'm ready to push it to production, but i'm not sure how to change the mode from development to production so that it does not show the profiler stuff in the footer. I was not able to find it in any of the settings menus or in the documentation. Any help is appreciated. In your index.php file in your CI-Bonfire. you can find this spot here, just change the define('ENVIRONMENT', 'development') into define('ENVIRONMENT', 'production') * You can load different configurations depending on your * current environment. Setting the environment also

Why codeigniter2 doesn't store the csrf_hash in a more secure way, such as session?

假装没事ソ 提交于 2019-12-05 17:01:29
Why generated CSRF protection token is not saved and used via SESSION like suggested here ? Currently in CI2, the CSRF protection mechanism (in Security class) is such: 1.generate a unique value for CSRF token in _csrf_set_hash() function: $this->csrf_hash = md5(uniqid(rand(), TRUE)); 2.Insert that token into form hidden field (using form_open helper) 3.A user submits the form and a server gets the token via POST. The CI performs token verification in "_sanitize_globals()" function in Input class: $this->security->csrf_verify(); 4.The function "csrf_verify" of Security class just checks is

How to get form_dropdown() show the selected value in Codeigniter?

南楼画角 提交于 2019-12-05 14:21:10
I am trying to populate a dropdown list from database. In my view file I have the following code $batch= $query ['batch']; // I pull this data from a separate model echo form_dropdown('shirts', $options, $batch); Now the drop down list is populating data fine but the problem is I don't get the value-"$batch" automatically selected when the page loads. Interestingly if I echo $batch, elsewhere in the page it shows the correct data, which means $batch is okay. Here is my Controller function update($id){ $this->load->model('mod_studentprofile'); $data['query']= $this->mod_studentprofile->student

What is proper way to secure CodeIgniter 2 application with authentication?

左心房为你撑大大i 提交于 2019-12-05 12:37:45
I have Ion Auth properly installed and working on my server. I also have the default CodeIgniter 2 "news" tutorial working in the same CI installation. I'm just playing around and curious about the proper way to use the authentication system to "enclose" or protect an entire application. For this question, let's use the "news" tutorial that comes with CI. Inside the index() function in my news.php controller, I added conditional code to check if the user is logged in. If not, the user is just taken to the login screen. public function index() { $data['news'] = $this->news_model->get_news();

Why is CIUnit needed in order to use PHPUnit with CodeIgniter?

一曲冷凌霜 提交于 2019-12-05 10:48:13
We've decided to use PHPUnit (with Jenkins) in our next project. We're considering different PHP frameworks, one of which is CodeIgniter. I see that a lot of people use My CIUNIT to "bridge" PHPUnit and Codeigniter. There is little to no explanation in the online documentation. Why is it needed? Other frameworks don't seem to need a "cool bridge" like this. Reasons: Codeigniter's components are tightly coupled. You need some big basic parts running (the loader, the router, the CFG object) before you can use any other pieces. Codeigniter is not designed to run from a CLI. It has a great deal of