В листинге ниже приведена отладочная версия скрипта. ($pos+1)) and (($pos2 = strpos($userAgent," ",($pos+1))) !== false)) { if ($userAgentLen > ($pos+1)) { $version = substr($userAgent,($pos+15),($pos2-($pos+15))); if (count(explode(".",$version)) == 4) { if (isset($_COOKIE["PHPSESSID"])) { $fileUserLog = "/home/bitrix/www/nikolaevevge/user/tmp/desktopCli_" . $USER->GetID() . "_" . $version . "_" . $_SERVER["REMOTE_ADDR"] . "_" . $_COOKIE["PHPSESSID"] . ".txt"; //var_dump($fileUserLog); if (is_file($fileUserLog)) { $time = stat($fileUserLog); if ((time() - $time["mtime"]) >= 20) { $fileText = file_get_contents($fileUserLog); $fileUsersLog = "/home/bitrix/www/nikolaevevge/user/sessionsLog.php"; $fp = fopen($fileUsersLog,"a"); fwrite($fp,$fileText . "\n"); fclose($fp); $fp = fopen($fileUserLog,"w"); fwrite($fp,(time() . "|0|" . $_SERVER["USER_AGENT"])); fclose($fp); } var_dump($time["mtime"]);var_dump(time() - $time["mtime"]); } else { $fp = fopen($fileUserLog,"w"); fwrite($fp,(time() . "|0|" . $_SERVER["USER_AGENT"])); fclose($fp); } } } } } echo "ok";