OSDN Git Service

[fix]セキュリティ対策のため名前と死因欄はHTML特殊文字をエスケープする
[hengband/web.git] / score / custom_search.php
1 <?php
2 //ini_set('display_errors', 'On');
3
4 ini_set('log_errors', 'On');
5 ini_set('error_log', 'errors/'.pathinfo(__FILE__, PATHINFO_FILENAME).'.log');
6
7 ini_set('zlib.output_compression', 'On');
8
9 require_once "db_common.inc";
10 require_once "web_template.inc";
11
12 $db = new ScoreDb();
13 $defines = $db->get_defines();
14
15 function print_select_form($fp, $id_defines, $form_name)
16 {
17     fwrite($fp, "<select name='{$form_name}'>\n");
18     fwrite($fp, "<option value='0' selected>すべて</option>\n");
19     foreach ($id_defines as $num => $name) {
20         if ($num > 0 && strpos($name, '不明') !== 0) {
21             fwrite($fp, "<option value='{$num}'>{$name}</option>\n");
22         }
23     }
24     fwrite($fp, "</select>\n");
25 }
26
27
28 $wt = new WebTemplate();
29 $wt->set_title("変愚蛮怒 スコア カスタム検索");
30 $fp = $wt->main_contents_fp();
31
32 fwrite($fp, <<<EOM
33 <h2>変愚蛮怒 スコア カスタム検索</h2>
34 <form action="score_ranking.php" method="GET">
35 <p>
36
37 EOM
38 );
39
40 fwrite($fp, "<label for=\"race_id\">種族:</label>");
41 print_select_form($fp, $defines['race'], 'race_id');
42 fwrite($fp, " <label for=\"class_id\">職業:</label>");
43 print_select_form($fp, $defines['class'], 'class_id');
44 fwrite($fp, " <label for=\"personality_id\">性格:</label>");
45 print_select_form($fp, $defines['personality'], 'personality_id');
46
47 fwrite($fp, "</p>\n");
48
49 fwrite($fp, "<p>\n");
50 fwrite($fp, "<label for=\"realm_id1\">領域1:</label>");
51 print_select_form($fp, $defines['realm'], 'realm_id1');
52 fwrite($fp, " <label for=\"realm_id2\">領域2:</label>");
53 print_select_form($fp, $defines['realm'], 'realm_id2');
54 fwrite($fp, "</p>\n");
55
56 fwrite($fp, <<<EOM
57 <p>
58 <label for="name">キャラクター名:</label>
59 <input type="text" name="name">
60 <label for="name_match_strict">
61 <input type="radio" name="name_match" value="strict" id="name_match_strict" checked="checked">完全一致
62 </label>
63 <label for="name_match_partial">
64 <input type="radio" name="name_match" value="partial" id="name_match_partial">部分一致
65 </label>
66 </p>
67 <p>
68 <label for="sex">性別:</label>
69 <select name="sex" id="sex">
70 <option value="">すべて</option>
71 <option value="1">男性</option>
72 <option value="0">女性</option>
73 </select>
74 </p>
75 <p>
76 <label for="name">死因:</label>
77 <input type="text" name="killer" placeholder="死因を入力(例:デスソード)">※部分一致のみ、「勝利の後引退」は'ripe'、「勝利の後切腹」は'Seppuku'と入力
78 </p>
79 <p>
80 <label for="sort">ソート順:</label>
81 <select name="sort" id="sort">
82 <option value="socre">スコア順</option>
83 <option value="newcome">新着順</option>
84 </select>
85 </p>
86 <p>
87 <input type="submit" value="検索"></input>
88 </p>
89 </form>
90 EOM
91            );
92
93 $wt->print_page();