func_history를 예전버전으로 롤백
This commit is contained in:
+11
-19
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('../e_lib/util.php');
|
|
||||||
include "func_http.php";
|
include "func_http.php";
|
||||||
|
|
||||||
function getHistory($count, $year, $month, $isFirst=0) {
|
function getHistory($count, $year, $month, $isFirst=0) {
|
||||||
@@ -35,7 +34,7 @@ function getGenHistory($count, $year, $month, $isFirst=0) {
|
|||||||
@fseek($fp, -$count*300, SEEK_END);
|
@fseek($fp, -$count*300, SEEK_END);
|
||||||
$file = @fread($fp, $count*300);
|
$file = @fread($fp, $count*300);
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
$log = explode("\n",$file);
|
$log = explode("\r\n",$file);
|
||||||
|
|
||||||
$str = "";
|
$str = "";
|
||||||
$prefix = "</>{$month}월:";
|
$prefix = "</>{$month}월:";
|
||||||
@@ -73,25 +72,17 @@ function LogHistory($connect, $isFirst=0) {
|
|||||||
$admin['month'] = 12;
|
$admin['month'] = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: 웹 접속이 아닌 콘솔일 경우에 대응책 필요. conf등에 저장하는 것을 고려
|
$file = explode('/', __FILE__);
|
||||||
$current_url = util::get_current_url();
|
$url = '/'.$file[count($file)-3].'/'.$file[count($file)-2].'/map.php?type=2&graphic=0';
|
||||||
$map_path = explode('/',parse_url($current_url, PHP_URL_PASS));
|
|
||||||
array_pop($map_path);
|
|
||||||
array_push($map_path, 'map.php?type=2&graphic=0');
|
|
||||||
$map_path = join('/', $map_path);
|
|
||||||
//$file = explode('/', __FILE__);
|
|
||||||
//$url = '/'.$file[count($file)-3].'/'.$file[count($file)-2].'/map.php?type=2&graphic=0';
|
|
||||||
|
|
||||||
/* 소켓 통신을 통하여 필요한 html정보를 가져옴 */
|
/* 소켓 통신을 통하여 필요한 html정보를 가져옴 */
|
||||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', Start HTTP');
|
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', Start HTTP');
|
||||||
|
$http = new HTTP("62che.com", 80, 10);
|
||||||
//$http = new HTTP("62che.com", 80, 10);
|
|
||||||
$http = new HTTP(parse_url($current_url, PHP_URL_HOST), parse_url($current_url, PHP_URL_PORT), 10);
|
|
||||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', Connect end, '.$http->GetError());
|
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', Connect end, '.$http->GetError());
|
||||||
if($http->GetErr() == true) { return false; }
|
if($http->GetErr() == true) { return false; }
|
||||||
$http->setHttpVersion("1.1");
|
$http->setHttpVersion("1.1");
|
||||||
$cookie = "";
|
$cookie = "";
|
||||||
$http->Get($map_path, $cookie);
|
$http->Get($url, $cookie);
|
||||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', Response end, '.$http->GetError());
|
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', Response end, '.$http->GetError());
|
||||||
if($http->GetErr() == true) { return false; }
|
if($http->GetErr() == true) { return false; }
|
||||||
$map = $http->Response["body"];
|
$map = $http->Response["body"];
|
||||||
@@ -114,13 +105,13 @@ function LogHistory($connect, $isFirst=0) {
|
|||||||
for($i=0; $i < $nationcount; $i++) {
|
for($i=0; $i < $nationcount; $i++) {
|
||||||
$nation = MYDB_fetch_array($result);
|
$nation = MYDB_fetch_array($result);
|
||||||
|
|
||||||
$query = "select city from city where nation='{$nation['nation']}'";
|
$query = "select city from city where nation='$nation[nation]'";
|
||||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
$citycount = MYDB_num_rows($cityresult);
|
$citycount = MYDB_num_rows($cityresult);
|
||||||
|
|
||||||
$nationStr .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>";
|
$nationStr .= "<font color=cyan>◆</font> <font style=color:".newColor($nation[color]).";background-color:$nation[color];>$nation[name]</font><br>";
|
||||||
$powerStr .= "국력 {$nation['power']}<br>";
|
$powerStr .= "국력 $nation[power]<br>";
|
||||||
$genStr .= "장수 {$nation['gennum']}<br>";
|
$genStr .= "장수 $nation[gennum]<br>";
|
||||||
$cityStr .= "속령 $citycount<br>";
|
$cityStr .= "속령 $citycount<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,10 +121,11 @@ function LogHistory($connect, $isFirst=0) {
|
|||||||
insert into history (
|
insert into history (
|
||||||
year, month, map, log, genlog, nation, power, gen, city
|
year, month, map, log, genlog, nation, power, gen, city
|
||||||
) values (
|
) values (
|
||||||
'{$admin['year']}', '{$admin['month']}', '$map', '$log', '$genlog', '$nationStr', '$powerStr', '$genStr', '$cityStr'
|
'$admin[year]', '$admin[month]', '$map', '$log', '$genlog', '$nationStr', '$powerStr', '$genStr', '$cityStr'
|
||||||
)",
|
)",
|
||||||
$connect) or Error(__LINE__.MYDB_error($connect),"");
|
$connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', LogHistory Finish');
|
if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', LogHistory Finish');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user