Etomite Community Forums: Trouble with sessions - Etomite Community Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Trouble with sessions

#1 User is offline   Psycho Mantis 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 113
  • Joined: 29-May 05
  • Location:Germany

Posted 19 May 2009 - 05:00 PM

Hi folks,

I'm having some trouble with sessions and Etomite.

Here's what I'm trying to do:
I have a job platform running parallely to an Etomite site. The Etomite site is basically handling the more or less static content, front page, contact pages etc. The job platform is completely inpedendent from it and runs from home brewn PHP scripts with MySQL database.
In order to add new job offerings, people can register an log on to this platform. When doing so, a session is registered called user_id.
In order to replace the "login" button with a "logout" button, I check if the session is active. That works fine with my scripts, Etomite however seems to ignore the existing session. The session is there and active for sure. I tried with a snippet like this

if(!isset($_SESSION['user_id'])){
	  $output .= "Login";  
} else {
	  $output .= "Logout";  
}

return $output;

but Etomite will always display "Login". When I switch back to a page that is generated from my scripts, it still works (so accessing an Etomite page doesn't destroy the session or something).
I'm lacking understanding of Etomite's core, so I'm pretty stuck with this. I'd really appreciate some hints on what might be wrong with this.

Many thanks in advance! :)

This post has been edited by Psycho Mantis: 19 May 2009 - 05:01 PM


#2 User is offline   Jelmer 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,177
  • Joined: 24-February 05
  • Gender:Male
  • Location:Amsterdam, NL

Posted 19 May 2009 - 05:31 PM

I use the code below, give it a try to see whether it makes a difference:
if(isset($_GET['logout'])) $etomite->userLogout($url,$id,$alias="");

if($_SESSION['validated']) { $output = '<a href="[~1~]?logout=1">Uitloggen ('.$_SESSION['shortname'].')</a>'; }
else { $output = '<a href="inloggen.html">Inloggen</a>'; }
return $output;


#3 User is offline   Ralph 

  • Etomite Administrator
  • Group: Admin
  • Posts: 6,418
  • Joined: 01-July 04
  • Gender:Male
  • Location:Jamestown, NY USA
  • Interests:Computers, Camping, Hiking, Aviation

Posted 19 May 2009 - 05:41 PM

You really don't need a separate session... Etomite uses sessions, even in the front end, so you can simply use $etomite->checkPermissions() to see if someone is logged in on the front end... Another way to check is to see if $_SESSION['validated'] is TRUE [true|1]... This variable only gets set when a successful login has been achieved...

If you want to get really fancy you can also require authentication in order to see specific documents or menu items... I write front end modules that require authentication all the time so I can attest that it works...

#4 User is offline   Psycho Mantis 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 113
  • Joined: 29-May 05
  • Location:Germany

Posted 19 May 2009 - 07:20 PM

Sorry folks,

I think I didn't make myself clear.
I'm not checking for an Etomite login. It's a separate login script I'm using for this job platform. It stores the login in a session named "user_id".
What I want to achieve is that on my Etomite pages the user can also see if he is logged on to the job platform. Basically a cross-integration of the login. Or to give another example that will become a topic for me in near future: I want to install a phpBB forum and then place a login/logout link to the board on my Etomite pages.

This post has been edited by Psycho Mantis: 20 May 2009 - 10:42 AM


#5 User is offline   Psycho Mantis 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 113
  • Joined: 29-May 05
  • Location:Germany

Posted 24 May 2009 - 12:23 PM

No one have an idea? :)

Sorry for bumping.

#6 User is offline   Ralph 

  • Etomite Administrator
  • Group: Admin
  • Posts: 6,418
  • Joined: 01-July 04
  • Gender:Male
  • Location:Jamestown, NY USA
  • Interests:Computers, Camping, Hiking, Aviation

Posted 24 May 2009 - 01:10 PM

Nope... I've never tried sharing session information between applications that I can recall... I'm relatively sure it would be possible without any special API or SDK, but don't know exactly where you would start other than becoming well versed with how sessions work in each application...

#7 User is offline   Psycho Mantis 

  • Etomite Forum Fan
  • Pip
  • Group: Member
  • Posts: 113
  • Joined: 29-May 05
  • Location:Germany

Posted 26 May 2009 - 02:37 PM

Hi Ralph,

how do I become well versed in how Etomite handles sessions? :)

I guess, that's essentially the purpose of this thread.

This post has been edited by Psycho Mantis: 26 May 2009 - 02:42 PM


#8 User is offline   DeanC 

  • Etomite Administrator
  • Group: Admin
  • Posts: 4,722
  • Joined: 08-June 04
  • Gender:Male
  • Location:United Kingdom

Posted 26 May 2009 - 02:55 PM

Looking through the parser to see how it does it :)

#9 User is offline   Ralph 

  • Etomite Administrator
  • Group: Admin
  • Posts: 6,418
  • Joined: 01-July 04
  • Gender:Male
  • Location:Jamestown, NY USA
  • Interests:Computers, Camping, Hiking, Aviation

Posted 26 May 2009 - 03:34 PM

View PostDeanC, on May 26 2009, 10:55 AM, said:

Looking through the parser to see how it does it :)


Check manager/includes/config.inc.php, too, because that's where the lions share of session setup resides... The code there is used by both the front end parser and the Etomite manager...

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users