// ◆2009.05.08 ランキングメモ作成開始 // ◆2009.05.19 ver1.0 完成 // ◆2009.05.19 ver2.0 作成 2009年6月版に対応 $ERR = 0; $CHK_IP = "221.186.64.139"; // ■ DB connect ---------------------------------------------- if (0) { $db_name = "LA11730164"; $table_name = "gcb_deck"; $dbHandle = @mysql_connect("mysql34.lolipop.jp", $db_name, "pr1231"); //MySQL接続1 if ($dbHandle == False) { // DB1コネクト失敗 $db_name = "tamashin"; $dbHandle = mysql_connect("localhost", "ocn", "ocn0304"); //MySQL接続2 if ($dbHandle == False) { $ERR = 1; } // DB2コネクト失敗 } if ($ERR) { print("SQL接続エラー $ERR \n"); exit; } // 異常終了1 if ( (!$ERR) && (!mysql_select_db($db_name, $dbHandle)) ) { // デフォルトDBとして選択 print("データベース選択エラー ($db_name)\n"); exit; // 異常終了2 } } function make_html() { $hhead = '
順位 | ' . $_POST["gname"] . ' | ' . $_POST["gname2"] . ' | ' . $_POST["gname3"] . ' | ' . $_POST["gname4"] . ' | 順位 |
---|---|---|---|---|---|
';
$A .= ' ';
if ($_POST["rank" . ($i)]) { // 入力あり
if (substr($_POST["rank" . ($i)], 0, 7) != "UPDATE ") {
$_POST["rank" . ($i)] = "UPDATE " . $_POST["rank" . ($i)];
}
// 読み込み部
if (1) { // NEW:2009.06.03 -
$text = trim(substr($_POST["rank" . ($i)], 24));
$text = str_replace("少尉", "少尉 ", $text);
$text = str_replace("中尉", "中尉 ", $text);
$text = str_replace("大尉", "大尉 ", $text);
$text = str_replace("少佐", "少佐 ", $text);
$text = str_replace("中佐", "中佐 ", $text);
$text = str_replace("大佐", "大佐 ", $text);
$text = str_replace("准将", "准将 ", $text);
$text = str_replace("少将", "少将 ", $text);
$text = str_replace("中将", "中将 ", $text);
$text = str_replace("大将", "大将 ", $text);
$text = str_replace("0pt", "0pt,", $text); $text = str_replace("1pt", "1pt,", $text);
$text = str_replace("2pt", "2pt,", $text); $text = str_replace("3pt", "3pt,", $text);
$text = str_replace("4pt", "4pt,", $text); $text = str_replace("5pt", "5pt,", $text);
$text = str_replace("6pt", "6pt,", $text); $text = str_replace("7pt", "7pt,", $text);
$text = str_replace("8pt", "8pt,", $text); $text = str_replace("9pt", "9pt,", $text);
$lines = explode("pt,", $text);
unset($rank);
for ($j = 0; $j < 100; $j++) {
if ($j == 99) {
$no = substr($lines[$j], 0, 3);
if ($no == 100) { $lines[$j] = substr($lines[$j], 3); }
} else if ($j >= 10) {
$no = substr($lines[$j], 0, 2);
if ( ($no > 10) && ($no < 100) ) { $lines[$j] = substr($lines[$j], 2); }
}
$rank[$j + 1] = $lines[$j];
}
} else { // OLD
$pos = strpos($_POST["rank" . ($i)], "ドットコム |");
$text = substr($_POST["rank" . $i], $pos + 12);
$lines = explode("\n", $text);
unset($rank);
$rank[1] = str_replace("ポイント", "", trim($lines[0]));
$rank[2] = str_replace("ポイント", "", trim($lines[1]));
$rank[3] = str_replace("ポイント", "", trim($lines[2]));
for ($j = 4; $j <= 100; $j++) {
$rank[$j] = str_replace("ポイント", "", trim($lines[($j * 2) - 5]));
}
}
// 出力部
for ($j = 1; $j <= 100; $j++) {
$A .= $rank[$j] . ' ';
$A .= ''; } } else { // 入力なし if ( ($i == 0) || ($i == 5) ) { for ($j = 1; $j <= 100; $j++) { $A .= $j . ' '; } } } $A .= ' | ';
}
// print_r($rank);
$A .= '