Yeah, my solution so far has been to check the last modified time of the
session file and then go from there. If the modified time is > then time
permitted, then that file is removed and the user's session is rendered null
and void. What I am doing is allowing a variable X number of user's to
simultaneously log-in under the same user/pass combo (account), and the
problem I face is, if none of the user's logs-out, then how will I determine
when to pop an inactive account off the stack. Good times.. thanks guys

Christian


"Rob Adams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Christian Calloway" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Yeah thats pretty much what I have concluded. I was absolutely sure
there
> > would be a way to check if a session was still active, but I guess not
> :-(.
> > Thanks though
>
> It depends on your definition of 'active.'  If you wanted to see if the
> specific session you are looking at has been used in the past half hour,
> that is possible.  Following is a script I've used to help debug sessions
> sometimes.  While it's not what you're asking for, it may help you figure
> out how to do it.  It may need tweaking to run on your server.
>
> <?  // sessioninfo.php
>   $path = ini_get('session.save_path');
>   if (isset($_GET['empty']))
>   {
>     if (isset($_COOKIE['PHPSESSID']))
>       setcookie('PHPSESSID', '');
>     header('Location: sessioninfo.php');
>   }
>   if (count($_GET) == 0)
>   {
>  echo "<br>Path: $path<br>";
>     $dir = dir($path);
>  while ($file = $dir->read())
>  {
>    $file_arr[$file]['time'] = filectime($path . '/' . $file);
>    $file_arr[$file]['size'] = filesize($path . '/' . $file);
>  }
>  $dir->close();
>     asort($file_arr);
>  echo '<table
> border=1><tr><th>Time</th><th>Size</th><th>SessionID</th></tr>';
>  foreach($file_arr as $fname => $data)
>     {
>       if ($fname == '.' || $fname == '..')
>         continue;
>       $ftime = date('Y-m-d G:i', $data['time']);
>    $sessid = substr($fname, 5);
>       echo "<tr><td>$ftime</td><td>{$data['size']}</td><td><a
> href=\"?sessionid=$sessid\">$fname</a></td></tr>";
>     }
>  echo '</table>';
>   } else if (isset($_GET['sessionid'])) {
>     setcookie('PHPSESSID', $_GET['sessionid']);
>  header('Location: sessioninfo.php?show=true');
>  exit();
>   } else {
>     session_start();
>     echo '<pre>';
>  print_r($_SESSION);
>  print_r($_GET);
>     echo '</pre>';
>   }
> ?>
>
>
>
> >
> > Christian
> >
> > "Larry Brown" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > I don't know of a function, but you could possibly read the directory
> > where
> > > the SID files are stored.  I use sessions a lot; however, I've not
tried
> > to
> > > accomplish this.  I don't know if by default you can read the SID
> > directory
> > > from a script or if this is blocked for security reasons or not.  If
> not,
> > > you could read the directory, match the SIDs from your list and go
from
> > > there.  There is no way of knowing if the person is still actively
using
> > the
> > > SID this way though.
> > >
> > > Larry.
> > >
> > > -----Original Message-----
> > > From: Christian Calloway [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, February 09, 2004 9:28 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] check if user session exists
> > >
> > >
> > > Given a set of session id's, is it possible to query whether a given
> > session
> > > exists. I am not talking about the current user session, instead I am
> > > referring to any and all possible user sessions currently in play. For
> > > example:
> > >
> > > if (session_exists($sessionId)) doSomething();
> > >
> > > I've been looking very hard for this one and haven't found an answer
at
> > all.
> > > Any ideas?
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to