Re: simple session question - for Authentication

2008-09-21 Thread Brett Wilton

in your controller you can use

$this->Auth->user('id') or $this->session->read('Auth.User.id')

or in your view

$session->read('Auth.User.id')

---
Brett Wilton
http://wiltonsoftware.com

On Sat, Sep 20, 2008 at 3:51 AM, gabriel <[EMAIL PROTECTED]> wrote:
>
> Hi, sorry..found the solution to allow pages without a controller -
> stick it in the app_controller.. which only leaves me know with the
> question..
>
> SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
> get all the sessions - see below..I want the user_id, I have tried
> print_r($_SESSION['Config']['User']['id']) which works but when I put
> in the
>
>
> link("My classified adds ", array("controller" =>
> "items", "action" =>
> "view", ".$_SESSION['Config']['User']['id']).")); ?>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: simple session question - for Authentication

2008-09-19 Thread Gabriel Kolbe

NOPE !!! sorry made a mistake, can't stick the $this->Auth->allow in
the app_controller...

On Fri, Sep 19, 2008 at 4:51 PM, gabriel <[EMAIL PROTECTED]> wrote:
>
> Hi, sorry..found the solution to allow pages without a controller -
> stick it in the app_controller.. which only leaves me know with the
> question..
>
> SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
> get all the sessions - see below..I want the user_id, I have tried
> print_r($_SESSION['Config']['User']['id']) which works but when I put
> in the
>
>
> link("My classified adds ", array("controller" =>
> "items", "action" =>
> "view", ".$_SESSION['Config']['User']['id']).")); ?>
>
>
> it does not work, any ideas, anyone??? I have tried $session-
>
>
>
>>read('id'), which does not work..( in the view)
>
>
> On 19 Sep, 16:45, gabriel <[EMAIL PROTECTED]> wrote:
>> Hi, Yes!! just figured it out as well
>>
>> function beforeFilter(){
>> $this->Auth->allow('add', '');
>>
>>   }
>>
>> How do you 'allow' page which is not in a controler??
>>
>> ~AND Any ideas on ...
>>
>> SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
>> get all the sessions - see below..I want the user_id, I have tried
>> print_r($_SESSION['Config']['User']['id']) which works but when I put
>> in the
>>
>> link("My classified adds ", array("controller" =>
>> "items", "action" =>
>> "view", ".$_SESSION['Config']['User']['id']).")); ?>
>>
>> it does not work, any ideas, anyone??? I have tried $session-
>>
>> >read('id'), which does not work..( in the view)
>>
>> On 19 Sep, 15:39, avairet <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > Hi,
>>
>> > Just an idea for the first issue: put " $this->Auth->allow('add') " in
>> > your "beforeFilter()" function!
>>
>> > On 19 sep, 16:31, gabriel <[EMAIL PROTECTED]> wrote:
>>
>> > > Hi, I have followed the Authentication in the Cookbook. I have a few
>> > > problems, maybe someone can help me. Firstly to 'allow' certain pages,
>> > > I place the $this->Auth->allow('add');  in the Users controller and
>> > > get and error, I have also tried to include it in the add and login
>> > > functions, but it does not seems to work, the error is
>>
>> > > Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
>> > > in C:\xampp\htdocs\testsite\app\controllers\users_controller.php on
>> > > line 8
>>
>> > > class UsersController extends AppController {
>>
>> > > var $name = 'Users';
>> > > var $helpers = array('Html', 'Form', 'Session');
>>
>> > > // var $components = array('Auth'); //declared in app_controller.php
>>
>> > >   $this->Auth->allow('add');
>>
>> > > SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
>> > > get all the sessions - see below..I want the user_id, I have tried
>> > > print_r($_SESSION['Config']['User']['id']) which works but when I put
>> > > in the
>>
>> > > link("My classified adds ", array("controller" =>
>> > > "items", "action" =>
>> > > "view", ".$_SESSION['Config']['User']['id']).")); ?>
>>
>> > > it does not work, any ideas, anyone??? I have tried $session-
>>
>> > > >read('id'), which does not work..( in the view)
>>
>> > > Array
>> > > (
>> > > [User] => Array
>> > > (
>> > > [id] => 3
>> > > [username] => test
>> > > [name] => piet
>> > > [lname] => test
>> > > [email] => [EMAIL PROTECTED]
>> > > [tell] => 123
>> > > [cell] => 321
>> > > [hnum] => 2
>> > > [street] => car
>> > > [city_id] => 1
>> > > [county_id] => 2
>> > > [country_id] => 3
>> > > [pcode] => mnh
>> > > [admin] => 7
>> > > [maillist] => 0
>> > > [created] => -00-00 00:00:00
>> > > [modified] => -00-00 00:00:00
>> > > [ip] => 1
>> > > [last_visit] => 2011-11-01 00:00:00
>> > > [group_id] => 1
>> > > [active] => 0
>> > > [emailssend] => 0
>> > > [browser_id] => 1
>> > > [screen] => 11
>> > > )
>>
>> > > )
>> > > Array
>> > > (
>> > > [Config] => Array
>> > > (
>> > > [userAgent] => a8c0ddfcbb06197967f6ae13f3fdd732
>> > > [time] => 1221835585
>> > > [rand] => 21704
>> > > [timeout] => 10
>> > > )
>>
>> > > [Message] => Array
>> > > (
>> > > )
>>
>> > > [Auth] => Array
>> > > (
>> > > [User] => Array
>> > > (
>> > > [id] => 3
>> > > [username] => test
>> > > [name] => piet
>> > > [lname] => test
>> > > [email] => [EMAIL PROTECTED]
>> > > [tell] => 123
>> > > [cell] => 321
>> > > [hnum] => 2
>> > > [street] => car
>> > > [city_id] => 1
>

Re: simple session question - for Authentication

2008-09-19 Thread gabriel

Hi, sorry..found the solution to allow pages without a controller -
stick it in the app_controller.. which only leaves me know with the
question..

SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
get all the sessions - see below..I want the user_id, I have tried
print_r($_SESSION['Config']['User']['id']) which works but when I put
in the


link("My classified adds ", array("controller" =>
"items", "action" =>
"view", ".$_SESSION['Config']['User']['id']).")); ?>


it does not work, any ideas, anyone??? I have tried $session-



>read('id'), which does not work..( in the view)


On 19 Sep, 16:45, gabriel <[EMAIL PROTECTED]> wrote:
> Hi, Yes!! just figured it out as well
>
> function beforeFilter(){
>     $this->Auth->allow('add', '');
>
>   }
>
> How do you 'allow' page which is not in a controler??
>
> ~AND Any ideas on ...
>
> SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
> get all the sessions - see below..I want the user_id, I have tried
> print_r($_SESSION['Config']['User']['id']) which works but when I put
> in the
>
> link("My classified adds ", array("controller" =>
> "items", "action" =>
> "view", ".$_SESSION['Config']['User']['id']).")); ?>
>
> it does not work, any ideas, anyone??? I have tried $session-
>
> >read('id'), which does not work..( in the view)
>
> On 19 Sep, 15:39, avairet <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > Just an idea for the first issue: put " $this->Auth->allow('add') " in
> > your "beforeFilter()" function!
>
> > On 19 sep, 16:31, gabriel <[EMAIL PROTECTED]> wrote:
>
> > > Hi, I have followed the Authentication in the Cookbook. I have a few
> > > problems, maybe someone can help me. Firstly to 'allow' certain pages,
> > > I place the $this->Auth->allow('add');  in the Users controller and
> > > get and error, I have also tried to include it in the add and login
> > > functions, but it does not seems to work, the error is
>
> > > Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
> > > in C:\xampp\htdocs\testsite\app\controllers\users_controller.php on
> > > line 8
>
> > > class UsersController extends AppController {
>
> > >         var $name = 'Users';
> > >         var $helpers = array('Html', 'Form', 'Session');
>
> > > // var $components = array('Auth'); //declared in app_controller.php
>
> > >   $this->Auth->allow('add');
>
> > > SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
> > > get all the sessions - see below..I want the user_id, I have tried
> > > print_r($_SESSION['Config']['User']['id']) which works but when I put
> > > in the
>
> > > link("My classified adds ", array("controller" =>
> > > "items", "action" =>
> > > "view", ".$_SESSION['Config']['User']['id']).")); ?>
>
> > > it does not work, any ideas, anyone??? I have tried $session-
>
> > > >read('id'), which does not work..( in the view)
>
> > > Array
> > > (
> > >     [User] => Array
> > >         (
> > >             [id] => 3
> > >             [username] => test
> > >             [name] => piet
> > >             [lname] => test
> > >             [email] => [EMAIL PROTECTED]
> > >             [tell] => 123
> > >             [cell] => 321
> > >             [hnum] => 2
> > >             [street] => car
> > >             [city_id] => 1
> > >             [county_id] => 2
> > >             [country_id] => 3
> > >             [pcode] => mnh
> > >             [admin] => 7
> > >             [maillist] => 0
> > >             [created] => -00-00 00:00:00
> > >             [modified] => -00-00 00:00:00
> > >             [ip] => 1
> > >             [last_visit] => 2011-11-01 00:00:00
> > >             [group_id] => 1
> > >             [active] => 0
> > >             [emailssend] => 0
> > >             [browser_id] => 1
> > >             [screen] => 11
> > >         )
>
> > > )
> > > Array
> > > (
> > >     [Config] => Array
> > >         (
> > >             [userAgent] => a8c0ddfcbb06197967f6ae13f3fdd732
> > >             [time] => 1221835585
> > >             [rand] => 21704
> > >             [timeout] => 10
> > >         )
>
> > >     [Message] => Array
> > >         (
> > >         )
>
> > >     [Auth] => Array
> > >         (
> > >             [User] => Array
> > >                 (
> > >                     [id] => 3
> > >                     [username] => test
> > >                     [name] => piet
> > >                     [lname] => test
> > >                     [email] => [EMAIL PROTECTED]
> > >                     [tell] => 123
> > >                     [cell] => 321
> > >                     [hnum] => 2
> > >                     [street] => car
> > >                     [city_id] => 1
> > >                     [county_id] => 2
> > >                     [country_id] => 3
> > >                     [pcode] => mnh
> > >                     [admin] => 7
> > >                     [maillist] => 0
> > >                     [created] => -00-00 00:00:00
> > >                     [modified] => -00-00 00:00

Re: simple session question - for Authentication

2008-09-19 Thread gabriel

Hi, Yes!! just figured it out as well

function beforeFilter(){
$this->Auth->allow('add', '');

  }

How do you 'allow' page which is not in a controler??

~AND Any ideas on ...

SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
get all the sessions - see below..I want the user_id, I have tried
print_r($_SESSION['Config']['User']['id']) which works but when I put
in the


link("My classified adds ", array("controller" =>
"items", "action" =>
"view", ".$_SESSION['Config']['User']['id']).")); ?>


it does not work, any ideas, anyone??? I have tried $session-



>read('id'), which does not work..( in the view)




On 19 Sep, 15:39, avairet <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Just an idea for the first issue: put " $this->Auth->allow('add') " in
> your "beforeFilter()" function!
>
> On 19 sep, 16:31, gabriel <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi, I have followed the Authentication in the Cookbook. I have a few
> > problems, maybe someone can help me. Firstly to 'allow' certain pages,
> > I place the $this->Auth->allow('add');  in the Users controller and
> > get and error, I have also tried to include it in the add and login
> > functions, but it does not seems to work, the error is
>
> > Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
> > in C:\xampp\htdocs\testsite\app\controllers\users_controller.php on
> > line 8
>
> > class UsersController extends AppController {
>
> >         var $name = 'Users';
> >         var $helpers = array('Html', 'Form', 'Session');
>
> > // var $components = array('Auth'); //declared in app_controller.php
>
> >   $this->Auth->allow('add');
>
> > SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
> > get all the sessions - see below..I want the user_id, I have tried
> > print_r($_SESSION['Config']['User']['id']) which works but when I put
> > in the
>
> > link("My classified adds ", array("controller" =>
> > "items", "action" =>
> > "view", ".$_SESSION['Config']['User']['id']).")); ?>
>
> > it does not work, any ideas, anyone??? I have tried $session-
>
> > >read('id'), which does not work..( in the view)
>
> > Array
> > (
> >     [User] => Array
> >         (
> >             [id] => 3
> >             [username] => test
> >             [name] => piet
> >             [lname] => test
> >             [email] => [EMAIL PROTECTED]
> >             [tell] => 123
> >             [cell] => 321
> >             [hnum] => 2
> >             [street] => car
> >             [city_id] => 1
> >             [county_id] => 2
> >             [country_id] => 3
> >             [pcode] => mnh
> >             [admin] => 7
> >             [maillist] => 0
> >             [created] => -00-00 00:00:00
> >             [modified] => -00-00 00:00:00
> >             [ip] => 1
> >             [last_visit] => 2011-11-01 00:00:00
> >             [group_id] => 1
> >             [active] => 0
> >             [emailssend] => 0
> >             [browser_id] => 1
> >             [screen] => 11
> >         )
>
> > )
> > Array
> > (
> >     [Config] => Array
> >         (
> >             [userAgent] => a8c0ddfcbb06197967f6ae13f3fdd732
> >             [time] => 1221835585
> >             [rand] => 21704
> >             [timeout] => 10
> >         )
>
> >     [Message] => Array
> >         (
> >         )
>
> >     [Auth] => Array
> >         (
> >             [User] => Array
> >                 (
> >                     [id] => 3
> >                     [username] => test
> >                     [name] => piet
> >                     [lname] => test
> >                     [email] => [EMAIL PROTECTED]
> >                     [tell] => 123
> >                     [cell] => 321
> >                     [hnum] => 2
> >                     [street] => car
> >                     [city_id] => 1
> >                     [county_id] => 2
> >                     [country_id] => 3
> >                     [pcode] => mnh
> >                     [admin] => 7
> >                     [maillist] => 0
> >                     [created] => -00-00 00:00:00
> >                     [modified] => -00-00 00:00:00
> >                     [ip] => 1
> >                     [last_visit] => 2011-11-01 00:00:00
> >                     [group_id] => 1
> >                     [active] => 0
> >                     [emailssend] => 0
> >                     [browser_id] => 1
> >                     [screen] => 11
> >                 )
>
> >         )
>
> > )
> > v- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: simple session question - for Authentication

2008-09-19 Thread avairet

Hi,

Just an idea for the first issue: put " $this->Auth->allow('add') " in
your "beforeFilter()" function!




On 19 sep, 16:31, gabriel <[EMAIL PROTECTED]> wrote:
> Hi, I have followed the Authentication in the Cookbook. I have a few
> problems, maybe someone can help me. Firstly to 'allow' certain pages,
> I place the $this->Auth->allow('add');  in the Users controller and
> get and error, I have also tried to include it in the add and login
> functions, but it does not seems to work, the error is
>
> Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
> in C:\xampp\htdocs\testsite\app\controllers\users_controller.php on
> line 8
>
> class UsersController extends AppController {
>
>         var $name = 'Users';
>         var $helpers = array('Html', 'Form', 'Session');
>
> // var $components = array('Auth'); //declared in app_controller.php
>
>   $this->Auth->allow('add');
>
> SECONDLY: I am trying to do a on sessions, if I do pr($_SESSION); I
> get all the sessions - see below..I want the user_id, I have tried
> print_r($_SESSION['Config']['User']['id']) which works but when I put
> in the
>
> link("My classified adds ", array("controller" =>
> "items", "action" =>
> "view", ".$_SESSION['Config']['User']['id']).")); ?>
>
> it does not work, any ideas, anyone??? I have tried $session-
>
> >read('id'), which does not work..( in the view)
>
> Array
> (
>     [User] => Array
>         (
>             [id] => 3
>             [username] => test
>             [name] => piet
>             [lname] => test
>             [email] => [EMAIL PROTECTED]
>             [tell] => 123
>             [cell] => 321
>             [hnum] => 2
>             [street] => car
>             [city_id] => 1
>             [county_id] => 2
>             [country_id] => 3
>             [pcode] => mnh
>             [admin] => 7
>             [maillist] => 0
>             [created] => -00-00 00:00:00
>             [modified] => -00-00 00:00:00
>             [ip] => 1
>             [last_visit] => 2011-11-01 00:00:00
>             [group_id] => 1
>             [active] => 0
>             [emailssend] => 0
>             [browser_id] => 1
>             [screen] => 11
>         )
>
> )
> Array
> (
>     [Config] => Array
>         (
>             [userAgent] => a8c0ddfcbb06197967f6ae13f3fdd732
>             [time] => 1221835585
>             [rand] => 21704
>             [timeout] => 10
>         )
>
>     [Message] => Array
>         (
>         )
>
>     [Auth] => Array
>         (
>             [User] => Array
>                 (
>                     [id] => 3
>                     [username] => test
>                     [name] => piet
>                     [lname] => test
>                     [email] => [EMAIL PROTECTED]
>                     [tell] => 123
>                     [cell] => 321
>                     [hnum] => 2
>                     [street] => car
>                     [city_id] => 1
>                     [county_id] => 2
>                     [country_id] => 3
>                     [pcode] => mnh
>                     [admin] => 7
>                     [maillist] => 0
>                     [created] => -00-00 00:00:00
>                     [modified] => -00-00 00:00:00
>                     [ip] => 1
>                     [last_visit] => 2011-11-01 00:00:00
>                     [group_id] => 1
>                     [active] => 0
>                     [emailssend] => 0
>                     [browser_id] => 1
>                     [screen] => 11
>                 )
>
>         )
>
> )
> v
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---