Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

php help i'm stuck!

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'>");
}

Name: Anonymous 2010-06-17 23:28

The fuck are you trying to do?

Name: Anonymous 2010-06-17 23:29

Strange. I don't see any code at all.

Name: Anonymous 2010-06-17 23:31

trying to limit viewer numbers to a page.

Name: Anonymous 2010-06-17 23:37

>>4
Why the fuck do you want to do that?

Name: Anonymous 2010-06-17 23:37

>>1
Yes, you are stuck; stuck in a world of mediocrity with PHP...

Name: Anonymous 2010-06-17 23:40

to avoid viewer peaks on streams

Name: Anonymous 2010-06-17 23:41

I'll say it here too.

$count = getOnlineUsers();
if($count!==false&&$count>12){
header("Location: http://www.google.com");
}

Must be done before any output eg that echo.

Name: Anonymous 2010-06-17 23:41

I think you're looking for mod_bruteforceandignorance.

Name: Anonymous 2010-06-17 23:46

$count = getOnlineUsers();
if($count!==false&&$count>12){
header("Location: http://www.google.com");
}

I'm still thinking about this. I don't need the echo though that was just a check.

Name: Anonymous 2010-06-18 0:20

Good gracious, helping people who post PHP without the code tags. My, /prog/'s gone downhill.

Name: Anonymous 2010-06-18 1:02

>>11
I don't blame you for not reading the thread, but there has been no help given.

Name: Anonymous 2010-06-18 4:57

>>7
to avoid viewer peaks on streams
On what kind of streams? Video streams? This can't be done reliably with PHP. HTTP requests are supposed to be atomic (sans hacks like comet). Probably what you want to do is limit the number of connections to the streaming service.

Name: Anonymous 2010-11-26 15:55

Name: Anonymous 2011-02-02 22:52


Don't change these.
Name: Email:
Entire Thread Thread List