示例#1
0
 function Ranking()
 {
     $file = RANKING;
     if (!file_exists($file)) {
         return 0;
     }
     $this->fp = FileLock($file);
     $Place = 0;
     while ($line = fgets($this->fp)) {
         $line = trim($line);
         if ($line == "") {
             continue;
         }
         if (count($this->Ranking[$Place]) === $this->SamePlaceAmount($Place)) {
             $Place++;
         }
         $this->Ranking[$Place][] = $line;
     }
     if (!$this->Ranking) {
         return 0;
     }
     foreach ($this->Ranking as $Rank => $SamePlaces) {
         if (!is_array($SamePlaces)) {
             continue;
         }
         foreach ($SamePlaces as $key => $val) {
             $list = explode("<>", $val);
             $this->Ranking["{$Rank}"]["{$key}"] = array();
             $this->Ranking["{$Rank}"]["{$key}"]["id"] = $list["0"];
         }
     }
 }
示例#2
0
function RegularControl($value = null)
{
    /*
    	サーバが重(混み)そうな時間帯は後回しにする。
    	PM 7:00 - AM 2:00 は処理しない。
    	※時刻は or なのに注意!
    */
    if (19 <= date("H") || date("H") <= 1) {
        return false;
    }
    $now = time();
    $fp = FileLock(CTRL_TIME_FILE, true);
    if (!$fp) {
        return false;
    }
    //$ctrltime	= file_get_contents(CTRL_TIME_FILE);
    $ctrltime = trim(fgets($fp, 1024));
    // 周期がまだなら終了
    if ($now < $ctrltime) {
        fclose($fp);
        unset($fp);
        return false;
    }
    // 管理の処理
    RecordManage(date("Y M d G:i:s", $now) . ": auto regular control by {$value}.");
    DeleteAbandonAccount();
    //その1 放棄ユーザの掃除
    // 定期管理が終わったら次の管理時刻を書き込んで終了する。
    WriteFileFP($fp, $now + CONTROL_PERIOD);
    fclose($fp);
    unset($fp);
}
示例#3
0
 function char($file = false)
 {
     if (!$file) {
         return 0;
     }
     $this->Number = basename($file, ".dat");
     $this->file = $file;
     $this->fp = FileLock($file);
     $data = ParseFileFP($this->fp);
     $this->SetCharData($data);
 }
示例#4
0
 function Ranking()
 {
     $file = RANKING;
     if (!file_exists($file)) {
         return 0;
     }
     // ファイルから読んで配列にいれる
     $this->fp = FileLock($file);
     $Place = 0;
     while ($line = fgets($this->fp)) {
         $line = trim($line);
         if ($line == "") {
             continue;
         }
         if (count($this->Ranking[$Place]) === $this->SamePlaceAmount($Place)) {
             $Place++;
         }
         $this->Ranking[$Place][] = $line;
     }
     //$this->Ranking	= file($file);
     // 配列が0なら終了
     if (!$this->Ranking) {
         return 0;
     }
     // 区切って文字列を分割
     foreach ($this->Ranking as $Rank => $SamePlaces) {
         if (!is_array($SamePlaces)) {
             continue;
         }
         foreach ($SamePlaces as $key => $val) {
             $list = explode("<>", $val);
             $this->Ranking["{$Rank}"]["{$key}"] = array();
             $this->Ranking["{$Rank}"]["{$key}"]["id"] = $list["0"];
         }
     }
     //$this->JoinRanking("yqyqqq","last");
     //dump($this->Ranking);
 }
示例#5
0
	function LoadData($file) {
		if(!file_exists($file))
			return false;

		$this->file	= $file;
		$this->fp	= FileLock($this->file);

		$this->UnionNo	= substr(basename($file),0,4);
		$data	= ParseFileFP($this->fp);
		$this->SetCharData($data);
		return true;
	}
示例#6
0
 function ItemArticleRead()
 {
     // ファイルがある場合
     if (file_exists(AUCTION_ITEM)) {
         //$fp	= fopen(AUCTION_ITEM,"r+");
         $this->fp = FileLock(AUCTION_ITEM);
         //if(!$fp) return false;
         //flock($fp,LOCK_EX);
         // 競売番号を先読みする
         $this->ArticleNo = trim(fgets($this->fp));
         while (!feof($this->fp)) {
             $str = fgets($this->fp);
             if (!$str) {
                 continue;
             }
             $article = explode("<>", $str);
             if (strlen($article["1"]) != 10) {
                 continue;
             }
             $this->Article[$article["0"]] = array("No" => $article["0"], "end" => $article["1"], "price" => $article["2"], "exhibitor" => $article["3"], "item" => $article["4"], "amount" => $article["5"], "TotalBid" => $article["6"], "bidder" => $article["7"], "latest" => $article["8"], "comment" => trim($article["9"]), "IP" => trim($article["10"]));
         }
         // ファイルが無い場合
     } else {
         // 何もしない。
     }
 }
示例#7
0
 function LoadUserItem()
 {
     // 2重に読むのを防止。
     if (isset($this->item)) {
         return false;
     }
     $file = USER . $this->id . "/" . ITEM;
     if (file_exists($file)) {
         $this->fp_item = FileLock($file);
         $this->item = ParseFileFP($this->fp_item);
         if ($this->item === false) {
             $this->item = array();
         }
     } else {
         $this->item = array();
     }
 }