users_online

I wanted to have a SCRIPT that will determine who is online & logged into our system. I want to send that information to my db. I do have the script, but I do not know where to put the script.here is the script:========================<?php session_start();$session=session_id();$time=time();$time_check=$time-600; //SET TIME 10 Minute

// Find out how many seconds are in the recordset and extract the first record from the recordset $row_rssignin = mysql_fetch_array($rssignin);

// Now we have to check if the recordset returned any records if($row_rssignin > 0){ // get records and set to session variables $_SESSION['svuid'] = $row_rssignin['persalno']; $_SESSION['svuname'] = $row_rssignin['username']; $_SESSION['svroleid'] = $row_rssignin['roleid'];

// check that the user's role has been set before proceeding if(isset($_SESSION['svroleid'])){ // Connect to the MYSQL server and use dbaddbook require_once('inc_conn.php'); // prepare sql statement to axtract user's access level clearance and corresponding permissions for each level $sql = "SELECT levelid, permid FROM task, roletask WHERE task.taskid = roletask.taskid AND roletask.roleid = '".$_SESSION['svroleid']."'";

// Redirect the user back to the registration page if a duplicate username was found - append a parameter header("Location: index.php"); // somewhere // Prevents the rest of the code form executing break; } else { // Free up the resultset mysql_free_result($rssignin);

// Redirect the user back to the registration page if a duplicate username was found - append a parameter header("Location: login.php?username=notexist"); } // Close the connection mysql_close($connimgp);}?>=========================

i didnt check the script totally.... but you could call it log.php or something and just include it on your main file or something. like if you have a file called layout.php that handles everything.. example: layout.php?page=members/login.php or something like that, include the file in there, but remove the session_start() and place it in the layout.php file.but if its not like that you might have to include it in every file.