OSDN Git Service

r74 更新履歴マージ
[trpgtools-onweb/AjaxChat.git] / auth.php
index 80db39a..d3e6d6b 100644 (file)
--- a/auth.php
+++ b/auth.php
@@ -1,9 +1,9 @@
 <?php
 /*
- * Ajax Chat for TRPG ver.2.0
* (c)2007-2008 Cake All rights reserved.
Mail : cake_67@users.sourceforge.jp
Home : http://trpgtools-onweb.sourceforge.jp/
+ Ajax Chat for TRPG ver.2.6.2
(c)2007-2009 Cake All Rights Reserved.
+ Mail : cake_67@users.sourceforge.jp
+ Home : http://trpgtools-onweb.sourceforge.jp/
  */
 
 // 設定ファイルの読み込み
@@ -12,12 +12,20 @@ require_once './lib/trpgchat.php';
 
 // 受信データの成形
 if (!$request = request()) {
-    error('リクエストを受信できません');
+    error('リクエストを受信できません', true);
 }
 
 // パスワードの照合
 if (MASTERPASS && $request['admin_pwd'] != MASTERPASS) {
-    error('パスワードが違います。');
+    error('パスワードが違います。', false, true);
+}
+
+// 遷移先の確認
+$whitelist = array(
+    'admin.php',
+);
+if (!in_array($request['action'], $whitelist)) {
+    error('リクエストが不正です');
 }
 
 // 設定セット
@@ -34,7 +42,8 @@ access_block();
 $_SESSION['admin_pwd'] = crypt($request['admin_pwd'], ADMIN_HASH_KEY);
 
 // 遷移先へ
-$url = str_replace('auth.php', '', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']).$request['action'];
+$self_url = get_self_url();
+$url = str_replace('auth.php', '', $self_url).$request['action'];
 
 header('Location: '. $url);
 exit;