View file modile/onl/onl_u.php

File size: 987B
<?php
if (is_file($cms.'user/'.$_SESSION['user_login'].'/profile.php'))
{ // для юзеров
 if (!is_file($cms.'onl/user/'.$_SESSION['user_login'].'.txt'))
 {
 $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);
 }

 $fp = fopen ($cms.'onl/user/'.$_SESSION['user_login'].'.txt', "w+");
 fwrite ($fp, ceil(time()/60));
 fclose ($fp);
}
else
{
 // для гостей
 if ($_SESSION['login'] != '')
 {
  if (!is_file($cms.'onl/quest/'.$_SESSION['login'].'.txt'))
  {
  $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);
  }

  $fp = fopen ($cms.'onl/quest/'.$_SESSION['login'].'.txt', "w+");
  fwrite ($fp, ceil(time()/60));
  fclose ($fp);
 }
}

?>