Please find my complete code of controller fyi:

<?php

class UsersController extends AppController {

    var $name = 'Users';
    var $uses = array('Incoming', 'User');
    var $helpers = array('Html', 'Paginator', 'Form', 'Csv');
    var $components = array('Auth');
    var $paginate = array(
        'limit' => 20,
        'fields' => array('date', 'time', 'msisdn', 'shortcode', 'operator',
'circle', 'keyword', 'answer', 'age', 'gender', 'status'),
        'order' => array('Incoming.id' => 'desc')
    );

    function beforeFilter() {
        $this->Auth->autoRedirect = false;
        parent::beforeFilter();
        //$this->Auth->allow('register');
    }

    function index() {
        $this->redirect(array('action' => 'login'));
    }

    function login() {
        $this->User->set($this->data);
        if ($this->User->validates()) {
            if (isset($this->data['User'])) {
                if ($this->Auth->login($this->data['User'])) {
                    $this->Session->setFlash('You\'ve successfully logged
in.');
                    //$this->redirect('view');
                    $this->redirect('report');
                }
                $this->Session->setFlash("Username/Password is incorrect");
            }
        }
    }

    function logout() {
        $this->Auth->logout();
        $this->Session->setFlash('You are now logged out.');
        $this->redirect('login');
    }

    function view() {
        if ($this->data) {
            $startday = $this->data['Incoming']['StartDate']['day'];
            $startmonth = $this->data['Incoming']['StartDate']['month'];
            $startyear = $this->data['Incoming']['StartDate']['year'];
            $starthour = $this->data['Incoming']['StartDate']['hour'];
            $startmin = $this->data['Incoming']['StartDate']['min'];
            $startdate = "$startyear-$startmonth-$startday
$starthour:$startmin:00";
            $endday = $this->data['Incoming']['EndDate']['day'];
            $endmonth = $this->data['Incoming']['EndDate']['month'];
            $endyear = $this->data['Incoming']['EndDate']['year'];
            $endhour = $this->data['Incoming']['EndDate']['hour'];
            $endmin = $this->data['Incoming']['EndDate']['min'];
            $enddate = "$endyear-$endmonth-$endday $endhour:$endmin:00";
            $this->Session->write('startdate', $startdate);
            $this->Session->write('enddate', $enddate);
            $this->set('records', $this->paginate('Incoming',
array("Incoming.created >= '$startdate' AND Incoming.created <= '$enddate'
")));
        } else {
            $startdate = $this->Session->read('startdate');
            $enddate = $this->Session->read('enddate');
            $this->set('records', $this->paginate('Incoming',
array("Incoming.created >= '$startdate' AND Incoming.created <= '$enddate'
")));
        }
    }

    function report() {

    }

    function export() {
        $this->layout = '';
        $startdate = $this->Session->read('startdate');
        $enddate = $this->Session->read('enddate');
        $this->set('Export', $this->Incoming->find('all', array(
                    'fields' => array('date', 'time', 'msisdn', 'shortcode',
'operator', 'circle', 'keyword', 'answer', 'age', 'gender'),
                    'order' => "Incoming.id desc",
                    'conditions' => array("Incoming.created >= '$startdate'
AND Incoming.created <= '$enddate' "),
                    'contain' => false)));
    }

}

?>

Regards
Tapan Thapa
India

On Mon, Feb 21, 2011 at 4:06 PM, Tapan Kumar Thapa <
[email protected]> wrote:

> i am writing startdate and enddate to the session but i don't know if i am
> writing in Auth session or not.
>
> Please find my view vode for reading first_name from session.
>
> View:
>
> <p align="center"><b><?php echo 'Welcome ' .
> $this->Session->read('Auth.User.first_name'); ?></b></p>
>
> My controller code which writes startdate and enddate in session:
> $this->Session->write('startdate', $startdate);
> $this->Session->write('enddate', $enddate);
>
> Fyi: All is working fine in my development machine but i don't know why in
> QA.
>
>
> Please suggest.
>
> Regards
> Tapan Thapa
> India
> On Mon, Feb 21, 2011 at 3:31 PM, Jeremy Burns | Class Outfit <
> [email protected]> wrote:
>
>> If your code and data is identical (the data isn't actually identical, but
>> I guess the differences are not important) then can you show your code? What
>> is your log in method? Are you writing anything to the Auth session key
>> anywhere else?
>>
>>
>> Jeremy Burns
>> *Class Outfit*
>> *
>> *
>> [email protected] <[email protected]>
>> http://www.classoutfit.com
>>
>> On 21 Feb 2011, at 09:56, Tapan Kumar Thapa wrote:
>>
>> Hello Community,
>>
>> Can you please suggest something?
>>
>> Regards
>> Tapan Thapa
>> India
>>
>> On Mon, Feb 21, 2011 at 1:37 PM, Tapan Kumar Thapa <
>> [email protected]> wrote:
>>
>>> Yes
>>>
>>> QA:
>>>
>>> "id"    "username"    "password"    "email"    "first_name"
>>> "last_name"    "created"    "modified"
>>> "1"    "admin"    "fb1d00be1616be244194b049468f6c571c56d927"    "
>>> [email protected]"    "Administrator"    "Admin"    \N    \N
>>>
>>> Development:
>>>
>>> "id"    "username"    "password"    "email"    "first_name"
>>> "last_name"    "created"    "modified"
>>> "1"    "khbk"    "fb1d00be1616be244194b049468f6c571c56d927"    "
>>> [email protected]"    "Mahuaa"    "Television"    \N    \N
>>>
>>> Please suggest.
>>>
>>> Point noted: I am using cakephp 2.0 (cakephp-8cbd9fc) development version
>>> on QA  and also using cakephp 2.0 (cakephp-'Not know') development version
>>> on development machine.
>>>
>>> Regards
>>> Tapan Thapa
>>> India
>>>
>>> On Mon, Feb 21, 2011 at 1:18 PM, Jeremy Burns | Class Outfit <
>>> [email protected]> wrote:
>>>
>>>> And the tables contain the same data?
>>>>
>>>>
>>>> Jeremy Burns
>>>> *Class Outfit*
>>>> *
>>>> *
>>>> [email protected] <[email protected]>
>>>> http://www.classoutfit.com
>>>>
>>>> On 21 Feb 2011, at 07:46, Tapan Kumar Thapa wrote:
>>>>
>>>> Yes DB structure,code and model files are identical.
>>>>
>>>> From Development: (Fetched from mysql yog)
>>>>
>>>> CREATE TABLE `users` (
>>>>    `id` int(10) NOT NULL AUTO_INCREMENT,
>>>>    `username` varchar(40) NOT NULL,
>>>>    `password` varchar(40) NOT NULL,
>>>>    `email` varchar(255) NOT NULL,
>>>>    `first_name` varchar(40) NOT NULL,
>>>>    `last_name` varchar(40) NOT NULL,
>>>>    `created` datetime DEFAULT NULL,
>>>>    `modified` datetime DEFAULT NULL,
>>>>    PRIMARY KEY (`id`),
>>>>    UNIQUE KEY `username` (`username`,`email`)
>>>>  ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
>>>>
>>>> From QA: (fetched from cli)
>>>>
>>>> mysql> show create table users;
>>>>
>>>> +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>>>> | Table | Create
>>>> Table
>>>> |
>>>>
>>>> +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>>>> | users | CREATE TABLE `users` (
>>>>   `id` int(10) NOT NULL auto_increment,
>>>>   `username` varchar(40) NOT NULL,
>>>>   `password` varchar(40) NOT NULL,
>>>>   `email` varchar(255) NOT NULL,
>>>>   `first_name` varchar(40) NOT NULL,
>>>>   `last_name` varchar(40) NOT NULL,
>>>>   `created` datetime default NULL,
>>>>   `modified` datetime default NULL,
>>>>   PRIMARY KEY  (`id`),
>>>>   UNIQUE KEY `username` (`username`,`email`)
>>>> ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 |
>>>>
>>>> +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>>>> 1 row in set (0.00 sec)
>>>>
>>>> mysql>
>>>>
>>>> Please suggest.
>>>>
>>>> Regards
>>>> Tapan Thapa
>>>>
>>>> On Mon, Feb 21, 2011 at 1:11 PM, Jeremy Burns | Class Outfit <
>>>> [email protected]> wrote:
>>>>
>>>>> Then your value is not being set in the session and you won't be able
>>>>> to retrieve it. Are you database structures the same? Have you changed
>>>>> anything to do with your User model? Are the code sets identical?
>>>>>
>>>>>
>>>>> Jeremy Burns
>>>>> *Class Outfit*
>>>>> *
>>>>> *
>>>>> [email protected] <[email protected]>
>>>>> http://www.classoutfit.com
>>>>>
>>>>> On 21 Feb 2011, at 07:39, Tapan Kumar Thapa wrote:
>>>>>
>>>>> Please find the debug info from development machine and QA machine.
>>>>>
>>>>> Development:
>>>>>
>>>>> Array
>>>>> (
>>>>>     [id] => 1
>>>>>     [username] => khbk
>>>>>     [email] => [email protected]
>>>>>
>>>>>     [first_name] => Mahuaa
>>>>>     [last_name] => Television
>>>>>     [created] =>
>>>>>     [modified] =>
>>>>> )
>>>>>
>>>>> QA:
>>>>>
>>>>> Array
>>>>> (
>>>>>     [username] => admin
>>>>>     [password] => suresh
>>>>>
>>>>> )
>>>>>
>>>>> Please suggest
>>>>>
>>>>> Regards
>>>>> Tapan Thapa
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Feb 21, 2011 at 1:07 PM, Jeremy Burns | Class Outfit <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> What happens when you debug out the value of the auth session
>>>>>> variables? Is the value there?
>>>>>>
>>>>>> Jeremy Burns
>>>>>> *Class Outfit*
>>>>>> *
>>>>>> *
>>>>>> [email protected] <[email protected]>
>>>>>> http://www.classoutfit.com
>>>>>>
>>>>>> On 21 Feb 2011, at 07:34, Tapan Kumar Thapa wrote:
>>>>>>
>>>>>> Unfortunately i am not getting any error but my view shows blank in
>>>>>> case no value retrieved from session for first_name. But if i change the
>>>>>> code to read username from session it start displaying in my view.
>>>>>>
>>>>>> Please suggest.
>>>>>>
>>>>>> Regards
>>>>>> Tapan Thapa
>>>>>>
>>>>>> On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> will u please tell what error is coming out?
>>>>>>>
>>>>>>> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>>>>>>> <[email protected]> wrote:
>>>>>>> > Hello Community,
>>>>>>> >
>>>>>>> > I am using auth component in my code and while retrieving
>>>>>>> first_name from
>>>>>>> > session ($this->Session->read('Auth.User.first_name')) on my
>>>>>>> development
>>>>>>> > machine(windows with wamp), it is working fine.
>>>>>>> >
>>>>>>> > However if deploying the same code on QA machine (linux with apache
>>>>>>> and php
>>>>>>> > separately), i am not able to get the first_name from session
>>>>>>> although i
>>>>>>> > have noticed if i am trying to retrieve username or password from
>>>>>>> session,
>>>>>>> > it is working.
>>>>>>> >
>>>>>>> > Working on QA - $this->Session->read('Auth.User.username')
>>>>>>> > Working on QA - $this->Session->read('Auth.User.password')
>>>>>>> > *Not working on QA - $this->Session->read('Auth.User.first_name) or
>>>>>>> > $this->Session->read('Auth.User.email')*
>>>>>>> >
>>>>>>> > Please suggest.
>>>>>>> >
>>>>>>> > Regards
>>>>>>> > Tapan Thapa
>>>>>>> > India
>>>>>>>
>>>>>>> --
>>>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>>>> http://tv.cakephp.org
>>>>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>>>>> help others with their CakePHP related questions.
>>>>>>>
>>>>>>>
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected] For more options, visit this
>>>>>>> group at http://groups.google.com/group/cake-php
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>>> http://tv.cakephp.org
>>>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>>>> help others with their CakePHP related questions.
>>>>>>
>>>>>>
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected] For more options, visit this
>>>>>> group at http://groups.google.com/group/cake-php
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>>> http://tv.cakephp.org
>>>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>>>> help others with their CakePHP related questions.
>>>>>>
>>>>>>
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected] For more options, visit this
>>>>>> group at http://groups.google.com/group/cake-php
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>> http://tv.cakephp.org
>>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>>> help others with their CakePHP related questions.
>>>>>
>>>>>
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected] For more options, visit this
>>>>> group at http://groups.google.com/group/cake-php
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Our newest site for the community: CakePHP Video Tutorials
>>>>> http://tv.cakephp.org
>>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>>> help others with their CakePHP related questions.
>>>>>
>>>>>
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected] For more options, visit this
>>>>> group at http://groups.google.com/group/cake-php
>>>>>
>>>>
>>>>
>>>> --
>>>> Our newest site for the community: CakePHP Video Tutorials
>>>> http://tv.cakephp.org
>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>> help others with their CakePHP related questions.
>>>>
>>>>
>>>> To unsubscribe from this group, send email to
>>>> [email protected] For more options, visit this
>>>> group at http://groups.google.com/group/cake-php
>>>>
>>>>
>>>>
>>>> --
>>>> Our newest site for the community: CakePHP Video Tutorials
>>>> http://tv.cakephp.org
>>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>>> help others with their CakePHP related questions.
>>>>
>>>>
>>>> To unsubscribe from this group, send email to
>>>> [email protected] For more options, visit this
>>>> group at http://groups.google.com/group/cake-php
>>>>
>>>
>>>
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>>
>>  --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to