Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » problem with session

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 671 Views
  • bebabeba
    Community Member
    192 Posts

    problem with session Link to this post

    can you hel me with session? I want that only admin user can see some reserved page. So I have a login area. when a user log as admin in my menu appear other 2 voice. so a normal user can see onlu homepage, admin user ca see homepage, page 1 and page 2.
    It's ok after login but when admin click on page1 or page 2 I see content page but in my menu that voice disappear. I think this is a problem session.
    I post my code can you help me to correct?

    in _config I put: $GLOBALS['a'] = 0;

    in page.php:
    function doLogin($data, $form) {    
    global $a;

    if((($data['nome']) == 'admin')&&(($data['password']) == 'admin'))
    { Session::set('utente_loggato', true);
       $var = array('var' => $a);
        else {
           $var = array('var' => $a);
        return $var;

    function sessione_attiva()
       return Session::get('utente_loggato');

    and in my template:
    <% if var = 1 %>
       <% control Menu(1) %>   
          <li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode"><span>$MenuTitle</span></a></li>
       <% end_control %>
    <% end_if %>

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.