From de8c6598d7be3f7d729149850f84962d2c7230f3 Mon Sep 17 00:00:00 2001 From: santic-zombie Date: Thu, 26 Mar 2020 23:15:41 +0300 Subject: [PATCH] Added script for counting listeners --- index.php | 19 +++++++++++++ online.dat | 0 online.php | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 online.dat create mode 100644 online.php diff --git a/index.php b/index.php index db771a3..4f82e09 100755 --- a/index.php +++ b/index.php @@ -49,6 +49,8 @@
+
+
title
@@ -95,6 +97,23 @@ }); + + diff --git a/online.dat b/online.dat new file mode 100644 index 0000000..e69de29 diff --git a/online.php b/online.php new file mode 100644 index 0000000..0840ce8 --- /dev/null +++ b/online.php @@ -0,0 +1,80 @@ +$str) + { + if($str=="$user::$time\r\n") + { + $ok=$i; + break; + } + } + foreach($online_array as $j=>$str) + { + if($ok==$j) { $online_array[$ok]="$user::$time\r\n"; break;} + } + endif; + + $writedata=fopen($data,"w") or die("Не могу открыть файл $data"); + flock($writedata,2); + if($online_array=="") $online_array[]="$user::$time\r\n"; + foreach($online_array as $str) + fputs($writedata,"$str"); + flock($writedata,3); + fclose($writedata); + + $readdata=fopen($data,"r") or die("Не могу открыть файл $data"); + $data_array=file($data); + fclose($readdata); + $online=count($data_array); + + echo "Listeners : $online"; +?>