如何编辑这个PHP功能,并添加假的在线用户作为额外?

时间:2013-11-21 17:44:14

标签: php sql-server

如何添加“假的额外在线用户”。让我说我有真正的30,但我需要额外30假。任何想法如何调整它?

  function GetLoggedInCount()
  {
   $cachefile = './cache/playercount.txt';
   $db = $this->database[ADB];   
   if (!file_exists($cachefile) || (time() - 300) >= filemtime($cachefile))
   {
    $count = 0;
    $num_rows = $db->doQuery('SELECT COUNT(strCharID) as pCount FROM CURRENTUSER');
    if ($num_rows == 1)
    {
     $row = $db->doRead();
     $count = $row['pCount'];
     $fp = fopen($cachefile, 'w');
     fwrite($fp, $count);
     fclose($fp);
    }
    return $count;
   }
   else if ((time() - 300) < filemtime($cachefile))
   {
    $fp = fopen($cachefile, 'r');
    $content = fread($fp, filesize($cachefile));
    fclose($fp);
    return intval($content);
   }
  }

0 个答案:

没有答案