View file onl/sp_onl.php

File size: 1.29Kb
<?php
         // проверка пользователей
         $dire = opendir ($cms.'onl/user/');
          while ($filee = readdir ($dire))
         { if (( $filee != ".") && ($filee != ".."))
          {
           if (ceil(time()/60)-trim(file_get_contents($cms.'onl/user/'.$filee)) > 3)
           {

          	 $o_cnt = trim(file_get_contents($cms.'onl/on_user.txt'));
			 --$o_cnt;
			 $fp = fopen ($cms.'onl/on_user.txt', "w+");
			 flock($fp, LOCK_EX);
			 fwrite ($fp, $o_cnt);
			 flock($fp, LOCK_UN);
			 fclose ($fp);
			 @unlink($cms.'onl/user/'.$filee);
           }
          }
         }
          closedir ($dire);

         // проверка гостей
         $dire = opendir ($cms.'onl/quest/');
          while ($filee = readdir ($dire))
         { if (( $filee != ".") && ($filee != ".."))
          {
           if (ceil(time()/60)-trim(file_get_contents($cms.'onl/quest/'.$filee)) > 3)
           {

          	 $o_cnt = trim(file_get_contents($cms.'onl/on_quest.txt'));
			 --$o_cnt;
			 $fp = fopen ($cms.'onl/on_quest.txt', "w+");
			 flock($fp, LOCK_EX);
			 fwrite ($fp, $o_cnt);
			 flock($fp, LOCK_UN);
			 fclose ($fp);
			 @unlink($cms.'onl/quest/'.$filee);
           }
          }
         }
          closedir ($dire);




?>