Name: help! 2010-06-17 23:21
<?php
/* Start the session */
session_start();
/* Defines how long the maximum amount of time the session can be inactive. */
define("MAX_IDLE_TIME", 3);
function getOnlineUsers(){
if ( $directory_handle = opendir( session_save_path() ) ) {
$count = 0;
while ( false !== ( $file = readdir( $directory_handle ) ) ) {
if($file != '.' && $file != '..'){
if(time()- fileatime(session_save_path() . '\\' . $file) < MAX_IDLE_TIME * 60) {
$count++;
}
}
closedir($directory_handle);
return $count;
}else {
return false;
}
}
}
echo 'Number of online users: ' . getOnlineUsers() . '<br />';
/*????? I guess $found should let it continue to the path it was already pointed at ??????????*/
// check if count is good
$found = false;
foreach($count < 12) {
$found = true;
}
if (!$found) {
redirect("<meta http-equiv='refresh' content='0;url=http://www.google.com'>");
}
/* Start the session */
session_start();
/* Defines how long the maximum amount of time the session can be inactive. */
define("MAX_IDLE_TIME", 3);
function getOnlineUsers(){
if ( $directory_handle = opendir( session_save_path() ) ) {
$count = 0;
while ( false !== ( $file = readdir( $directory_handle ) ) ) {
if($file != '.' && $file != '..'){
if(time()- fileatime(session_save_path() . '\\' . $file) < MAX_IDLE_TIME * 60) {
$count++;
}
}
closedir($directory_handle);
return $count;
}else {
return false;
}
}
}
echo 'Number of online users: ' . getOnlineUsers() . '<br />';
/*????? I guess $found should let it continue to the path it was already pointed at ??????????*/
// check if count is good
$found = false;
foreach($count < 12) {
$found = true;
}
if (!$found) {
redirect("<meta http-equiv='refresh' content='0;url=http://www.google.com'>");
}