Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

problem with session

Go to End



Community Member, 193 Posts

4 December 2008 at 3:24am

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 %>