codeigniter-2

Very high latency in first HTTP request on CodeIgniter project

冷暖自知 提交于 2019-12-23 10:59:37
问题 A friend and I just started working in a project which other people stopped developing a couple of years ago, and we're trying to resurrect it. We've already solved most of the setup-related issues, but there's a really annoying one that we can't figure out. In our localhosts, all the pages take A LOT of time to load/refresh. And I don't mean assets, scripts or anything, the problem is the latency until the first request completes. Most times it takes 15 to 30 seconds, which is unacceptable,

Codeigniter: Paypal IPN and csrf_protection

给你一囗甜甜゛ 提交于 2019-12-23 09:36:33
问题 I'm working with codeigniter-paypal-ipn and have csrf_protection enabled. This seems to block the access from Paypal to my IPN controller. If i disable csrf_protection it works just fine, with csrf_protection enabled, paypal IPN service throws a 500 Internal Server Error. Is there a way to solve this without disabling the csrf_protection? If not, can i disable the csrf_protection just for that controller? Thanks. 回答1: Alex the creator of codeigniter-paypal-ipn here. At the moment I'm not

Check number of affected rows in CodeIgniter

 ̄綄美尐妖づ 提交于 2019-12-23 07:39:17
问题 I am trying to check in my model method if there was affected any rows if so return true else return false, but I don't know how to get it?: class User_model extends CI_Model { function __construct() { parent::__construct(); } function save_new_user ($name, $email, $password) { $data = array( 'name' => $name, 'email' => $email, 'password' => $password, 'time' => time() ); $this->db->insert('users', $data); // if (affected rows > 0) return true else return false if ([AFFECTED_ROWS] > 0) return

auto redirect after no user action [duplicate]

二次信任 提交于 2019-12-23 06:28:09
问题 This question already has answers here : How to detect idle time in JavaScript elegantly? (36 answers) Closed 6 years ago . T-mobile already uses this logic but I don't know how to do it. This is the scenario: I login to my website and don't do anything at all for 2 minutes, just sit and look at the screen. In such case, I should be redirected to logout page where session will be destroyed. How can I do this? Examples on web are based on user actions such as check something (last activity etc

How to insert and update existing array data with one single query in Codeigniter ?

大憨熊 提交于 2019-12-23 05:49:09
问题 i have all data from table in arrays . In which we updated existing data and some added new data . This data had import from CSV and stored into array . The Question is: How to insert and update existing data with one single query in Codeigniter with " ON DUPLICATE KEY UPDATE "? Table before like this.. id(auto incre) invoice_code item_code item_rate 1 INPO311018-1 pip640up 62 2 INPO311019-43 plxliupp 43 3 INPO311012-05 al6408f 24 after insert&update at same time table would look like this.

Codeigniter build validation class at your own needs

落花浮王杯 提交于 2019-12-23 03:39:10
问题 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

CodeIgniter Paging 404

落花浮王杯 提交于 2019-12-23 03:32:00
问题 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(

Codeigniter Class Inheritance between modules (wiredesigns)

时光毁灭记忆、已成空白 提交于 2019-12-23 02:43:43
问题 My CI2 app is using the wiredesigns modular layout. I have a two modules called item and product in a a folder called modules like so: /application /modules /item /product In Item I have a controller called item which starts like this. class Item extends MX_Controller { //code here } What do I need to do to make my products controller extend my item controller in a different module 回答1: My guess is you are trying to keep your code "DRY" (http://en.wikipedia.org/wiki/Don't_repeat_yourself)

Codeigniter - Restricting direct access to controller functions from URL call

佐手、 提交于 2019-12-23 00:24:15
问题 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? 回答1: As you stated in the comment, that if you want to load the link via

Calling/invoking a hook manually in Codeigniter

↘锁芯ラ 提交于 2019-12-22 12:23:58
问题 I searched for calling/invoking a hook manually and similar stuff on the web but couldn't find anything. Is there a such thing in codeigniter? I have a hook below which gets triggered as expected but just in case if doesn't, then I want to invoke it manually in my code. Thanks $hook['post_controller_constructor'] [] = array( 'class' => 'load_designs', 'function' => 'do_load', 'filename' => 'load_designs_hook.php', 'filepath' => 'hooks', 'params' => '' ); 回答1: In order to call a hook, you