codeigniter

Encrypted data in URLs

跟風遠走 提交于 2019-12-23 09:55:46
问题 I am developing a PHP application to manage orders for a company. To view an order the URL is currently /orders/view/3502 . I don't want the order ID number to appear in the URL, so I used CodeIgniter's encrypt library to encrypt the ID in the URL. The URL (after encryption) looks like /orders/view/AaffGdQQ . The problem I am having is sometimes the encrypted ID contains a forward slash or a plus sign, which don't work correctly when in a URL. CodeIgniter reads the URL based on slashes, so,

How to get a value from the last inserted row using Codeigniter

别说谁变了你拦得住时间么 提交于 2019-12-23 09:55:45
问题 Is there any codeigniter function to do this? 回答1: try this code: $this->db->insert_id(); Refer: https://www.codeigniter.com/user_guide/database/helpers.html 回答2: There is no special function for that. But you can get the id of row that you've just inserted and then get it's data: $this->db->insert('table_name', $data); $id = $this->db->insert_id(); $q = $this->db->get_where('table_name', array('id' => $id)); return $q->row(); 回答3: I have tips for you. When you want to insert data, please

How to refer to database connection in codeigniter?

醉酒当歌 提交于 2019-12-23 09:50:03
问题 How can I call manually a PHP database function on CodeIgniter's database handler object? How to retrieve the connection ( $dbc ), or call a function like mysql_real_escape_string($dbc, $variable) ? 回答1: You can call any mysql native function and access mysql connection id. See CodeIgniter User Guide 回答2: $this->db->conn_id will get you the current connection link object if you are in a CI context. It will return a mysqli or mysql link object that you can pass into functions like mysql_real

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

Search form with Codeigniter

こ雲淡風輕ζ 提交于 2019-12-23 09:34:05
问题 I am trying to create a search form in Codeigniter. I want to give the user 4 different options to search from. For the result I want a table that displays all 11 columns in the table I am searching from. This is the code I have so far. Controller: public function index(){ $this->searchTest(); } public function searchTest(){ $this->load->model('reg_model'); $search_term = array( 'firstName' => $this->input->post('firstName'), 'lastName' => $this->input->post('lastName'), 'street' => $this-

Codeigniter and PHPWord

霸气de小男生 提交于 2019-12-23 09:27:01
问题 I'm trying to read some document. So I use PHPWord. Here what i got in my library. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH . '/third_party/PhpWord/Autoloader.php'; use PhpWord\Autoloader as Autoloader; Autoloader::register(); class Word extends Autoloader { } when i'm going to use it. I have this error : Fatal error: Class 'PhpOffice\PhpWord\Autoloader' not found in D:\xampp\htdocs\jdih\application\libraries\Word.php on line 6 A PHP

CodeIgniter helper in the view

怎甘沉沦 提交于 2019-12-23 09:19:30
问题 Is it a good workaround and would it be possible to use helper classes in the view, in CodeIgniter. I have a situation when I have to extract with regulars expression from a text couple of strings and generate outputs on matches. I would not like to do this directly in the view and I would like to use for this purpose a helper. application --view ---myview.php and here I should call the helper and return results for example I want to extract from the text the type of processor, than I pass

Undefined property: CI::$session

喜欢而已 提交于 2019-12-23 09:07:28
问题 I am having trouble loading my model on my login page. It has a problem with sessions on here. I have a security class helper which $key is part of it. But I think it is to do with session as error says. I think I have set up num rows correct not sure if also that may be cause of it. A PHP Error was encountered Severity: Notice Message: Undefined property: CI::$session Filename: core/Model.php Line Number: 51 model <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

codeigniter ion auth getting user id

与世无争的帅哥 提交于 2019-12-23 09:06:50
问题 I need to get the user id of the person logged in, so that i can run a query for that user. Im using ion auth, should i use a session or call it from the db, should i use a helper or not? anyway, heres what im trying to do: example: how many work orders does logged in user have? query would be: select * from work_orders WHERE status = "1" AND userid = "%THE LOGGED IN USER" here is my controller, which doesnt have the "get user id" code: public function index() { $this->load->view('templates

How to run a cron job on a CodeIgniter controller that all the URL does is run a query from an API, update the DB & send emails (from within CI)?

我只是一个虾纸丫 提交于 2019-12-23 09:01:21
问题 I have a web application that runs a query on an api, gets new information, changes the variables in the database and sends emails if needed (compares old and new variables). I work with Ubuntu Server, and I tried several variations to run this. my controller looks like this: class Cli_only extends CI_Controller { public function __construct() { parent::__construct(); is_cli() OR show_404(); // If cronjob ! $this->load->model('kas_model'); // Sets the server not to have a time out. ini_set(