cakephp-1.2

Time redirection in cakePHP ?

两盒软妹~` 提交于 2019-12-02 12:53:55
header("refresh:5; url='pagetoredirect.php'"); we can use this if we want to redirect our page in 5 second , is there any way to redirect page in 5 second in cakephp ? if yes please let me know You could try with AppController header() method: http://api.cakephp.org/class/app-controller#method-AppControllerheader In your controller: class CarController{ public function add(){ $this->header("") //Implemented on AppController::header } } /cake/libs/controller/controller.php /** * Convenience and object wrapper method for header(). Useful when doing tests and * asserting that particular headers

CakePHP Security::cipher() is not working specifically on server

萝らか妹 提交于 2019-12-02 01:27:27
问题 I'm having a problem with reading the encrpyted cookie. Debugging revealed that Security::cipher() on server is somehow broken. Is there anyway I could solve it? Below is the breakdown. Code $value = "Hello World"; $key = Configure::read('Security.salt'); $val = Security::cipher($value, $key); debug($val); $ret = Security::cipher($val, $key); debug($ret); Local app\views\pages\home.ctp (line 17) �J��WtJ0� app\views\pages\home.ctp (line 19) Hello World Server app/views/pages/home.ctp (line 17)

How to Limit the paginate in cakephp

老子叫甜甜 提交于 2019-12-01 15:54:09
How to Limit the paginate in cakephp ? Assume that i have 400 records. I need to get only 25 records from 50th record to 75th record and need to display 5 records per page. How i can do this in paginate ? Sample Code: $this->paginate = array( 'contain'=>array('User'), 'recursive' => 2, 'order' => array('Profile.winning' => 'DESC'), 'limit' =>5 ); You can set conditions for the pagination. function listRecords() { $this->paginate = array( 'conditions' => array('Model.id >=' => 50, 'Model.id <=' => 75), 'limit' => 5 ); $this->paginate('Model'); ); EDIT: A solution from here : $this->paginate =

CakePHP Auth component redirect issue

耗尽温柔 提交于 2019-12-01 05:46:18
I am having trouble getting the Auth component do the redirects I want in a CakePHP 1.2.6 app. I have a login form that appears on all pages and I want to keep the user on the page he logs in on. For example, if he is viewing another user's profile, I want to keep him there after logging in, not redirect him to the $this->Auth->loginRedirect action. Also, another thing about my app is that I have no "authenticated access only" pages, every page is accessible to everyone, but if you're logged in you get additional features. What I understood from reading the documentation is that I need to set

How to send a multiple emails at a time in cakephp

二次信任 提交于 2019-11-28 04:42:29
问题 I need to send multiple emails at a time, can any one have example? or any idea ? I need to send mail to all my site users at a time (Mail content is same for all) Currently i using following code in a for loop $this->Email->from = '<no-reply@noreply.com>'; $this->Email->to = $email; $this->Email->subject = $subject ; $this->Email->sendAs = 'html'; 回答1: I think you have 2 possibilities: foreach Let's assume you have a function mail_users within your UsersController function mail_users(

Using DISTINCT in a CakePHP find function

僤鯓⒐⒋嵵緔 提交于 2019-11-27 23:38:00
I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter combination, click filter, and the page shows only the records that match. In people_controller, I have this bit of code: $first_names = $this->Person->find('list', array( 'fields'=>'first_name', 'order'=>'Person.first_name ASC', 'conditions'=> array('Person.status'=>'1') )); $this->set('first_names', $first_names); (Status = 1 because I am using a soft delete.) That creates an ordered list of all first

Using username instead of email in CakePHP's Auth Component

半腔热情 提交于 2019-11-27 16:57:54
问题 Using CakePHP's Auth Component, how do I allow users to authenticate by using either their "username" or "email" field as a username, and a "pass" field as their password? 回答1: what does "using (username and email) both as username " mean? Edit: ok, so you want Auth to look in both username and email fields in the db to compare to the "username" that the user enters? then do this: function beforeFilter() { parent::beforeFilter(); $this->Auth->fields = array('username' => 'username', 'password

How to log SQL queries to a log file with CakePHP

怎甘沉沦 提交于 2019-11-27 08:04:41
问题 I have a CakePHP 1.2 application that makes a number of AJAX calls using the AjaxHelper object. The AjaxHelper makes a call to a controller function which then returns some data back to the page. I would like to log the SQL queries that are executed by the AJAX controller functions. Normally, I would just turn the debug level to 2 in config/core.php, however, this breaks my AJAX functionality because it causes the output SQL queries to be appended to the output that is returned to the client

Using DISTINCT in a CakePHP find function

一世执手 提交于 2019-11-26 23:14:35
问题 I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter combination, click filter, and the page shows only the records that match. In people_controller, I have this bit of code: $first_names = $this->Person->find('list', array( 'fields'=>'first_name', 'order'=>'Person.first_name ASC', 'conditions'=> array('Person.status'=>'1') )); $this->set('first_names',