Jump to content

Mahdi

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mahdi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the reply. I was of course going to pair this information with a database, but the problem for me was knowing how long a user has been logged in, and when they sign off. Similar to the "Total time logged in:" function of these php forums.
  2. Hello, I wanted to know if it is possible to monitor $_SESSION data that is currently active on the server. I.E. We set $_SESSION['userID'] when someone logs into their account, we would like to actively monitor the time that this session remains active. So if the user is online for 6 hours, we use a PHP page that pulls this information. start time = 8:00AM user1 logs on at 8:15AM user2 logs on at 8:45AM user3 logs on at 9:30AM current time = 10:00AM user1 is offline, session was active for 45 minutes (logged off at 9:00AM) user2 is active, and has been on for 1h 15mins user3 is active, and has been on for 30mins ______________ Kind of a rough idea I know, but I wanted to know if getting this kind of information is even possible with sessions, or cookies for that matter. Thanks a ton! Mahdi
  3. This has really been confusing me. I have my php script set up to take the user ID out of the database, and put it into a session variable, however.. This will only work as long as I navigate through one directory. i.e user/index.php --> user/account.php holds the info, but user/index.php --> account/index.php gives me this error: "Notice: Undefined index: user_id in (host root dir)/account/index.php on line 14" Now for the code.. Function that sets the info for $_SESSION['user_id']: [code] function getId() } $email = $_POST['txtEmail']; $password = $_POST['txtPassword']; $sql = "SELECT login_id        FROM tbl_login        WHERE login_password = ('$password') AND login_email = ('$email')";         $result = mysql_query($sql);         $row = mysql_fetch_assoc($result);         $_SESSION['user_id'] = $row['login_id']; { [/code] user/library/functions.php - holds the getId() function. user/login.php - calls the function and registers the session. user/account/index.php - tries to get the session info but fails (yes I put session_start() before I called the info) "Notice: Undefined index: user_id in (host root dir)/account/index.php on line 14" The wierdest thing is about this, is that when I go back to user/login.php to check if the session is registered or not, it says that it is. But then I go back to account.php and of course its not.. stays this way till I unregister. like I said.. if I keep in in the same directory everything runs fine. As far as I understand sessions are supposed to retain data no matter which directory you are on as long as staying in the root dir (or untill you unregister/close browser). Anything helps. My main goal is to be able to hold this login_id info from 'blahblah/var.php' to 'blahblah/anything/var.php' Thank you very much in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.