[Sangokushi-svn] [SVN_Comitted] [467] 鯖サイドソース修正版

OpenSangokushi commit ML sango****@lists*****
2010年 11月 10日 (水) 23:33:38 JST


Revision: 467
          http://sourceforge.jp/projects/sangokushi/svn/view?view=rev&revision=467
Author:   hryksbt
Date:     2010-11-10 23:33:38 +0900 (Wed, 10 Nov 2010)

Log Message:
-----------
鯖サイドソース修正版
(本番鯖からダウンロードしたもの)

Modified Paths:
--------------
    trunk/server_php/checkLib.php
    trunk/server_php/dbparam.inc
    trunk/server_php/dbutil.php
    trunk/server_php/entryNewUser.php
    trunk/server_php/getAICharParam.php
    trunk/server_php/getBattleResult.php
    trunk/server_php/getIniUserParam.php
    trunk/server_php/getMapInfo.php
    trunk/server_php/getRoomInfo.php
    trunk/server_php/getRoomStatus.php
    trunk/server_php/getRoomTurnCount.php
    trunk/server_php/getUserStatus.php
    trunk/server_php/getcountry.php
    trunk/server_php/main.php
    trunk/server_php/sessionException.php
    trunk/server_php/setBattleInfo.php
    trunk/server_php/setUserEntryRoom.php
    trunk/server_php/setUserExitRoom.php
    trunk/server_php/sysparam.inc

Modified: trunk/server_php/checkLib.php
===================================================================
--- trunk/server_php/checkLib.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/checkLib.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,55 +1,55 @@
-<?php
-
-	function userIDCheck($uid) {
-
-
-		if (strlen($uid) <> USERID_CNT) {
-			throw new Exception('00100', SYSTEM_ERROR);
-		}
-
-		if (substr($uid, 0, 1) <> USERID_PREFIX) {
-			throw new Exception('00101', SYSTEM_ERROR);
-		}
-		
-		return $uid;
-
-	}
-
-	function roomIDCheck($rid) {
-
-		if (! is_numeric($rid)) {
-			throw new Exception('00200', SYSTEM_ERROR);
-		}
-
-		return $rid;
-
-	}
-	
-	function sessionCheck($cmd, $uid, $sid) {
-		
-		require('sessionException.php');
-
-		switch($cmd) {
-		
-			case 'xxxxx':
-				$db = new DBConnection();
-				$session = new DBSession($db);
-				$db->AssignDBConnection($session);
-	
-				$uid = userIDCheck($uid);
-		
-				$sql = 'select userID from t_login where userID = :userID and sessionID = :sessionID';
-				$param = array(":userID" => "$uid",
-						":sessionID" => "$sid");
-		
-				$result = $session->query_select($sql, $param);
-		
-				if (empty($result)) {
-		
-					throw new sessionException('セッション違い', SESSION_ERROR);
-		
-				}
-		}
-	
-	}
-
+<?php
+
+	function userIDCheck($uid) {
+
+
+		if (strlen($uid) <> USERID_CNT) {
+			throw new Exception('00100', SYSTEM_ERROR);
+		}
+
+		if (substr($uid, 0, 1) <> USERID_PREFIX) {
+			throw new Exception('00101', SYSTEM_ERROR);
+		}
+		
+		return $uid;
+
+	}
+
+	function roomIDCheck($rid) {
+
+		if (! is_numeric($rid)) {
+			throw new Exception('00200', SYSTEM_ERROR);
+		}
+
+		return $rid;
+
+	}
+	
+	function sessionCheck($cmd, $uid, $sid) {
+		
+		require('sessionException.php');
+
+		switch($cmd) {
+		
+			case 'xxxxx':
+				$db = new DBConnection();
+				$session = new DBSession($db);
+				$db->AssignDBConnection($session);
+	
+				$uid = userIDCheck($uid);
+		
+				$sql = 'select userID from t_login where userID = :userID and sessionID = :sessionID';
+				$param = array(":userID" => "$uid",
+						":sessionID" => "$sid");
+		
+				$result = $session->query_select($sql, $param);
+		
+				if (empty($result)) {
+		
+					throw new sessionException('セッション違い', SESSION_ERROR);
+		
+				}
+		}
+	
+	}
+

Modified: trunk/server_php/dbparam.inc
===================================================================
--- trunk/server_php/dbparam.inc	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/dbparam.inc	2010-11-10 14:33:38 UTC (rev 467)
@@ -57,7 +57,7 @@
  * 
  * @var string 接続データベース接続ユーザパスワード
  */
-define('DB_CON_PASS', 'useroass');
+define('DB_CON_PASS', 'userpass');
 
 /**
  * 文字コードセット

Modified: trunk/server_php/dbutil.php
===================================================================
--- trunk/server_php/dbutil.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/dbutil.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,371 +1,371 @@
-<?php
-/**
- * データベースアクセスに関するパッケージです
- *
- * このパーッケージのデータベースへアクセスはPDOを使用します。
- * データベースの接続文字はこのパッケージ内に記述しています。
- * 例外が発生した時はこのクラスを呼び出し元で処理してください
- * 
- * @category   Database
- * @package    dbutil
- * @author     okotaneko
- * @version    1.0
- * @access     public
- */
-
-/**
- * inlcude DocBlock です。
- *
- * inlcude ファイルの説明など書きます。
- */
-
-require('dbparam.inc');
-
-
-/**
- * データベース接続クラス
- *
- * データベースへの接続と切断を管理します。
- * データベース接続のインスタンスをデータアクセスクラスに渡します。
- * 
- * @category   database
- * @package    dbutil
- * @author     okotaneko
- * @version    0.1
- * @access     public
- */
-class DBConnection {
-
-	/**
-	 * データベースインスタンス
-	 * @var object 接続時のインスタンスを保持する
-	 * @access public
-	 */
-	private $db = null;
-
-	/**
-	 * データベース接続状態の保持
-	 * 
-	 * @var Bool データベースの接続状態 接続中 = True 未接続 = False
-	 * @access public
-	 */
-	private $ConnectFlg = False;
-
-	/**
-	 * データベース接続文字列
-	 * 
-	 * @var string データベースの接続文字列
-	 * @access public
-	 */
-	private $DBparam = null;
-
-	/**
-	 * データベースユーザー名
-	 * 
-	 * @var string データベースのユーザー名
-	 * @access public
-	 */
-	private $DBUser = null;
-
-	/**
-	 * データベースユーザーパスワード
-	 * 
-	 * @var string データベースのユーザーパスワード
-	 * @access public
-	 */
-	private $DBPassWD = null;
-
-
-	/**
-	 * コンストラクタ
-	 * 
-	 * データベースの接続文字の設定は、データベースの種類($DBType)が設定されていない場合デフォルト値を使います。
-	 * 
-	 * @param string $DBType データベースの種類
-	 * @param string $Host データベース接続先ホスト名
-	 * @param string $Port データベース接続先ポート名
-	 * @param string $DBName データベース名
-	 * @param string $UserName データベースユーザ名
-	 * @param string $PassWD データベースパスワード
-	 * @return void
-	 * @access public
-	 */	
-	public function __construct($DBType = null, $Host = null, $Port = null, $DBName = null, $UserName = null, $PassWD = null) {
-
-		if (is_null($DBType)) {
-			$this->DBparam = DB_CON_TYPE . ':dbname=' . DB_CON_NAME . ';host=' . DB_CON_HOST . ' port=' . DB_CON_PORT;
-			$this->DBUser = DB_CON_USER;
-			$this->DBPassWD = DB_CON_PASS;
-		} else {
-			$this->Dbparam = $DBType . ':dbname=' . $DBName . ' host=' . $Host . ' port=' . $Port;
-			$this->DBUser = $UserName;
-			$this->DBPassWD = $PassWD;
-		}
-		
-		
-		$this->Connect();
-	}
-
-	/**
-	 * デストラクタ
-	 *
-	 * @return void
-	 * @access public
-	 */
-	public function __destruct() {
-		$db = null;
-	}
-
-	/**
-	 * データベースに接続します。。
-	 * データベース接続のインスタンスを作成します。
-	 *
-	 * @return void 
-	 * @access public
-	 */
-	public function Connect() {
-
-		if (! $this->ConnectFlg) {
-			$this->DisConnect();
-	}
-
-		$this->db = new PDO($this->DBparam, $this->DBUser, $this->DBPassWD);
-	    $this->db->query('CHAR_SET');
-		$this->ConnectFlg = True;
-	}
-	
-	/**
-	 * データベースの接続を切断します。。
-	 * データベース接続のインスタンスを解放します。
-	 *
-	 * @return void 
-	 * @access public
-	 */
-	public function DisConnect() {
-
-		$this->db = null;
-		$this->ConnectFlg = False;
-	}
-
-	/**
-	 * データベース接続状態を返す
-	 * 
-	 * @return Bool $ConnectFlg 接続中=True 未接続=False
-	 * @access public
-	 */
-	public function Connected() {
-
-		return $this->ConnectFlg;
-	}
-
-	/**
-	 * データベース接続インスタンスをセッションクラスに渡す
-	 *
-	 * @param object $DBsession セッションクラスのインスタンス
-	 * @return void 
-	 * @access public
-	 */
-	public function AssignDBConnection($DBsession){
-
-		$DBsession->SetDBConnection($this->db);
-	}
-
-	/**
-	 * クラスに存在しないプロパティへの書込みははエラーとする
-	 *
-	 * @param string $name アクセスするプロパティ名
-	 * @param string $value プロパティ値
-	 * @return void
-	 * @access public
-	 */
-	function __set($name, $value) {
-
-		throw new Exception('存在しないプロパティへのアクセス');
-	}
-
-	/**
-	 * クラスに存在しないプロパティの読込はエラーとする
-	 *
-	 * @param string $name アクセスするプロパティ名
-	 * @return oject
-	 * @access public
-	 */
-	function __get($name) {
-
-		throw new Exception('存在しないプロパティへのアクセス');
-	}
-
-	/**
-	 * クラスに存在しないメソッドの実行ははエラーとする
-	 *
-	 * @param string $name アクセスするメソッド名
-	 * @param array $arguments メソッドの引数(ハッシュ配列)
-	 * @return void
-	 * @access public
-	 */
-	function __call($name, $arguments) {
-
-		throw new Exception('存在しないメソッドへのアクセス');
-	}
-}
-
-/**
- * データベースアクセスクラス
- *
- * データベースへのセッションを保持します。。
- * データベース接続のインスタンスをコネクションクラスから取得しデータベースへアクセスします。
- * 例外が発生した時はこのクラスを呼び出し元で処理してください
- * 
- * @category   databese
- * @package    dbutil
- * @author     okotaneko
- * @version    0.1
- * @access     public
- */
-class DBSession {
-	
-	/**
-	 * データベースインスタンス
-	 * データベースインスタンスを接続クラスからもらいます。(参照)
-	 * @var object データベース接続インスタンス
-	 * @access public
-	 */	
-	private $Db = null;
-	
-	/**
-	 * コンストラクタ
-	 *
-	 * @param object $DBConnection データベース接続のインスタンス ない場合は渡さなくてもよい
-	 * @return void
-	 * @access public
-	 */
-	public function __construct($DBConnection = null) {
-		
-		if (! is_null($DBConnection)) {
-			$this->SetDBConnection($DBConnection);
-		}
-	}
-	
-	/**
-	 * デストラクタ
-	 *
-	 * @return void
-	 * @access public
-	 */
-	public function __destruct() {
-
-	}
-
-    /**
-     * データベースコネクションクラスをセットする
-     * データベース接続のインスタンスの参照をセットします。
-     *
-     * @param object $DBConnection データベース接続のインスタンス
-     * @return void 
-     * @access public
-     */
-	public function SetDBConnection($DBConnection) {
-
-		$this->Db = $DBConnection;
-	}
-
-	/**
-	 * select文を発行する
-	 *
-	 * @param array $s PDOStatementオブジェクト
-	 * @param array $param バインド変数の項目と値のハッシュ配列
-	 * @return void
-	 * @access private
-	 */
-	private function setBindParam(&$s, &$param) {
-
-		if (! empty($param)) {
-			foreach ($param as $key => $value) {
-				$s->bindParam("$key", $value);
-			}
-		}
-	}
-
-	/**
-	 * select文を発行する
-	 *
-	 * @param string $sql 実行するSQL文必ずバインド変数を使用すること
-	 * @param array $param バインド変数の項目と値のハッシュ配列
-	 * @return array string 結果セット
-	 * @return void
-	 * @access public
-	 */
-	public function query_select(&$sql, &$param) {
-
-		$s = $this->Db->prepare($sql);
-		$this->setBindParam($s, $param);
-
-		if (! $s->execute($param)) {
-			throw new Exception('0030001', SYSTEM_ERROR);
-		}
-
-		return $s->fetchAll();
-
-	}
-
-	/**
-	 * insert update delete文を発行する
-	 *
-	 * @param string $sql 実行するSQL文必ずバインド変数を使用すること
-	 * @param array $param バインド変数の項目と値のハッシュ配列
-	 * @return integer 更新した行数
-	 * @access public
-	 */
-	public function query_update(&$sql, &$param) {
-
-		$s = $this->Db->prepare($sql);
-		$this->setBindParam($s, $param);
-
-		if (! $s->execute($param)) {
-			throw new Exception('0030002', SYSTEM_ERROR);
-		}
-
-		return $s->rowCount();
-
-	}
-
-	/**
-	 * クラスに存在しないプロパティへの書込みははエラーとする
-	 *
-	 * @param string $name アクセスするプロパティ名
-	 * @param string $value プロパティ値
-	 * @return void
-	 * @access public
-	 */
-	function __set($name, $value) {
-
-		throw new Exception('存在しないプロパティへのアクセス');
-	}
-
-	/**
-	 * クラスに存在しないプロパティの読込はエラーとする
-	 *
-	 * @param string $name アクセスするプロパティ名
-	 * @return oject
-	 * @access public
-	 */
-	function __get($name) {
-
-		throw new Exception('存在しないプロパティへのアクセス');
-	}
-
-	/**
-	 * クラスに存在しないメソッドの実行ははエラーとする
-	 *
-	 * @param string $name アクセスするメソッド名
-	 * @param array $arguments メソッドの引数(ハッシュ配列)
-	 * @return void
-	 * @access public
-	 */
-	function __call($name, $arguments) {
-
-		throw new Exception('存在しないメソッドへのアクセス');
-	}
-	
-}
-
+<?php
+/**
+ * データベースアクセスに関するパッケージです
+ *
+ * このパーッケージのデータベースへアクセスはPDOを使用します。
+ * データベースの接続文字はこのパッケージ内に記述しています。
+ * 例外が発生した時はこのクラスを呼び出し元で処理してください
+ * 
+ * @category   Database
+ * @package    dbutil
+ * @author     okotaneko
+ * @version    1.0
+ * @access     public
+ */
+
+/**
+ * inlcude DocBlock です。
+ *
+ * inlcude ファイルの説明など書きます。
+ */
+
+require('dbparam.inc');
+
+
+/**
+ * データベース接続クラス
+ *
+ * データベースへの接続と切断を管理します。
+ * データベース接続のインスタンスをデータアクセスクラスに渡します。
+ * 
+ * @category   database
+ * @package    dbutil
+ * @author     okotaneko
+ * @version    0.1
+ * @access     public
+ */
+class DBConnection {
+
+	/**
+	 * データベースインスタンス
+	 * @var object 接続時のインスタンスを保持する
+	 * @access public
+	 */
+	private $db = null;
+
+	/**
+	 * データベース接続状態の保持
+	 * 
+	 * @var Bool データベースの接続状態 接続中 = True 未接続 = False
+	 * @access public
+	 */
+	private $ConnectFlg = False;
+
+	/**
+	 * データベース接続文字列
+	 * 
+	 * @var string データベースの接続文字列
+	 * @access public
+	 */
+	private $DBparam = null;
+
+	/**
+	 * データベースユーザー名
+	 * 
+	 * @var string データベースのユーザー名
+	 * @access public
+	 */
+	private $DBUser = null;
+
+	/**
+	 * データベースユーザーパスワード
+	 * 
+	 * @var string データベースのユーザーパスワード
+	 * @access public
+	 */
+	private $DBPassWD = null;
+
+
+	/**
+	 * コンストラクタ
+	 * 
+	 * データベースの接続文字の設定は、データベースの種類($DBType)が設定されていない場合デフォルト値を使います。
+	 * 
+	 * @param string $DBType データベースの種類
+	 * @param string $Host データベース接続先ホスト名
+	 * @param string $Port データベース接続先ポート名
+	 * @param string $DBName データベース名
+	 * @param string $UserName データベースユーザ名
+	 * @param string $PassWD データベースパスワード
+	 * @return void
+	 * @access public
+	 */	
+	public function __construct($DBType = null, $Host = null, $Port = null, $DBName = null, $UserName = null, $PassWD = null) {
+
+		if (is_null($DBType)) {
+			$this->DBparam = DB_CON_TYPE . ':dbname=' . DB_CON_NAME . ';host=' . DB_CON_HOST . ' port=' . DB_CON_PORT;
+			$this->DBUser = DB_CON_USER;
+			$this->DBPassWD = DB_CON_PASS;
+		} else {
+			$this->Dbparam = $DBType . ':dbname=' . $DBName . ' host=' . $Host . ' port=' . $Port;
+			$this->DBUser = $UserName;
+			$this->DBPassWD = $PassWD;
+		}
+		
+		
+		$this->Connect();
+	}
+
+	/**
+	 * デストラクタ
+	 *
+	 * @return void
+	 * @access public
+	 */
+	public function __destruct() {
+		$db = null;
+	}
+
+	/**
+	 * データベースに接続します。。
+	 * データベース接続のインスタンスを作成します。
+	 *
+	 * @return void 
+	 * @access public
+	 */
+	public function Connect() {
+
+		if (! $this->ConnectFlg) {
+			$this->DisConnect();
+	}
+
+		$this->db = new PDO($this->DBparam, $this->DBUser, $this->DBPassWD);
+	    $this->db->query('CHAR_SET');
+		$this->ConnectFlg = True;
+	}
+	
+	/**
+	 * データベースの接続を切断します。。
+	 * データベース接続のインスタンスを解放します。
+	 *
+	 * @return void 
+	 * @access public
+	 */
+	public function DisConnect() {
+
+		$this->db = null;
+		$this->ConnectFlg = False;
+	}
+
+	/**
+	 * データベース接続状態を返す
+	 * 
+	 * @return Bool $ConnectFlg 接続中=True 未接続=False
+	 * @access public
+	 */
+	public function Connected() {
+
+		return $this->ConnectFlg;
+	}
+
+	/**
+	 * データベース接続インスタンスをセッションクラスに渡す
+	 *
+	 * @param object $DBsession セッションクラスのインスタンス
+	 * @return void 
+	 * @access public
+	 */
+	public function AssignDBConnection($DBsession){
+
+		$DBsession->SetDBConnection($this->db);
+	}
+
+	/**
+	 * クラスに存在しないプロパティへの書込みははエラーとする
+	 *
+	 * @param string $name アクセスするプロパティ名
+	 * @param string $value プロパティ値
+	 * @return void
+	 * @access public
+	 */
+	function __set($name, $value) {
+
+		throw new Exception('存在しないプロパティへのアクセス');
+	}
+
+	/**
+	 * クラスに存在しないプロパティの読込はエラーとする
+	 *
+	 * @param string $name アクセスするプロパティ名
+	 * @return oject
+	 * @access public
+	 */
+	function __get($name) {
+
+		throw new Exception('存在しないプロパティへのアクセス');
+	}
+
+	/**
+	 * クラスに存在しないメソッドの実行ははエラーとする
+	 *
+	 * @param string $name アクセスするメソッド名
+	 * @param array $arguments メソッドの引数(ハッシュ配列)
+	 * @return void
+	 * @access public
+	 */
+	function __call($name, $arguments) {
+
+		throw new Exception('存在しないメソッドへのアクセス');
+	}
+}
+
+/**
+ * データベースアクセスクラス
+ *
+ * データベースへのセッションを保持します。。
+ * データベース接続のインスタンスをコネクションクラスから取得しデータベースへアクセスします。
+ * 例外が発生した時はこのクラスを呼び出し元で処理してください
+ * 
+ * @category   databese
+ * @package    dbutil
+ * @author     okotaneko
+ * @version    0.1
+ * @access     public
+ */
+class DBSession {
+	
+	/**
+	 * データベースインスタンス
+	 * データベースインスタンスを接続クラスからもらいます。(参照)
+	 * @var object データベース接続インスタンス
+	 * @access public
+	 */	
+	private $Db = null;
+	
+	/**
+	 * コンストラクタ
+	 *
+	 * @param object $DBConnection データベース接続のインスタンス ない場合は渡さなくてもよい
+	 * @return void
+	 * @access public
+	 */
+	public function __construct($DBConnection = null) {
+		
+		if (! is_null($DBConnection)) {
+			$this->SetDBConnection($DBConnection);
+		}
+	}
+	
+	/**
+	 * デストラクタ
+	 *
+	 * @return void
+	 * @access public
+	 */
+	public function __destruct() {
+
+	}
+
+    /**
+     * データベースコネクションクラスをセットする
+     * データベース接続のインスタンスの参照をセットします。
+     *
+     * @param object $DBConnection データベース接続のインスタンス
+     * @return void 
+     * @access public
+     */
+	public function SetDBConnection($DBConnection) {
+
+		$this->Db = $DBConnection;
+	}
+
+	/**
+	 * select文を発行する
+	 *
+	 * @param array $s PDOStatementオブジェクト
+	 * @param array $param バインド変数の項目と値のハッシュ配列
+	 * @return void
+	 * @access private
+	 */
+	private function setBindParam(&$s, &$param) {
+
+		if (! empty($param)) {
+			foreach ($param as $key => $value) {
+				$s->bindParam("$key", $value);
+			}
+		}
+	}
+
+	/**
+	 * select文を発行する
+	 *
+	 * @param string $sql 実行するSQL文必ずバインド変数を使用すること
+	 * @param array $param バインド変数の項目と値のハッシュ配列
+	 * @return array string 結果セット
+	 * @return void
+	 * @access public
+	 */
+	public function query_select(&$sql, &$param) {
+
+		$s = $this->Db->prepare($sql);
+		$this->setBindParam($s, $param);
+
+		if (! $s->execute($param)) {
+			throw new Exception('0030001', SYSTEM_ERROR);
+		}
+
+		return $s->fetchAll();
+
+	}
+
+	/**
+	 * insert update delete文を発行する
+	 *
+	 * @param string $sql 実行するSQL文必ずバインド変数を使用すること
+	 * @param array $param バインド変数の項目と値のハッシュ配列
+	 * @return integer 更新した行数
+	 * @access public
+	 */
+	public function query_update(&$sql, &$param) {
+
+		$s = $this->Db->prepare($sql);
+		$this->setBindParam($s, $param);
+
+		if (! $s->execute($param)) {
+			throw new Exception('0030002', SYSTEM_ERROR);
+		}
+
+		return $s->rowCount();
+
+	}
+
+	/**
+	 * クラスに存在しないプロパティへの書込みははエラーとする
+	 *
+	 * @param string $name アクセスするプロパティ名
+	 * @param string $value プロパティ値
+	 * @return void
+	 * @access public
+	 */
+	function __set($name, $value) {
+
+		throw new Exception('存在しないプロパティへのアクセス');
+	}
+
+	/**
+	 * クラスに存在しないプロパティの読込はエラーとする
+	 *
+	 * @param string $name アクセスするプロパティ名
+	 * @return oject
+	 * @access public
+	 */
+	function __get($name) {
+
+		throw new Exception('存在しないプロパティへのアクセス');
+	}
+
+	/**
+	 * クラスに存在しないメソッドの実行ははエラーとする
+	 *
+	 * @param string $name アクセスするメソッド名
+	 * @param array $arguments メソッドの引数(ハッシュ配列)
+	 * @return void
+	 * @access public
+	 */
+	function __call($name, $arguments) {
+
+		throw new Exception('存在しないメソッドへのアクセス');
+	}
+	
+}
+

Modified: trunk/server_php/entryNewUser.php
===================================================================
--- trunk/server_php/entryNewUser.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/entryNewUser.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,199 +1,199 @@
-<?php
-
-	function commandExecute(&$sid) {
-
-		try {
-		
-			/*
-			$username = $_GET['un'];
-			$latitude = $_GET['lat'];
-			$longitude = $_GET['lan'];
-			*/
-			
-			$username = $_POST['un'];
-			$latitude = $_POST['lat'];
-			$longitude = $_POST['lan'];
-			
-			if (strlen($username) == 0 || strlen($username) > USERNAME_CNT) {
-				// メッセージは仮
-				throw new Exception('01000', SYSTEM_ERROR);
-			}
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-			
-			// ユーザ名の重複チェック
-			$sql_name_search = 'select userName from t_user where userName = :userName';
-			$param_name_search = array(":userName" => "$username");
-			
-			$result_name_search = $session->query_select($sql_name_search, $param_name_search);
-			
-			if (!empty($result_name_search)){
-				// メッセージは仮
-				throw new Exception('02000', SYSTEM_ERROR);
-			}
-			
-			// 初期パラメータ取得
-			$sql_default_param = 'select paramID from t_defaultParam where paramType=1';
-			$result_default_param = $session->query_select($sql_default_param, $pa);
-			
-			if (empty($result_default_param)) {
-				// メッセージは仮
-				throw new Exception('07000', SYSTEM_ERROR);
-			
-			}
-			
-			$default_param = $result_default_param[0][0];
-			
-			// 人口が一番少ない国を取得
-			$sql_country_count = 'select a.country, b.countryName, count(*) from t_user a, t_country b where a.country = b.countryID group by 1 order by 3';
-			$result_country_count = $session->query_select($sql_country_count, $pa);
-			
-			if (empty($result_country_count)){
-			
-				$defaultCountry = 1;
-				
-			} else {
-			
-				$defaultCountry = $row_country_count[0][0];
-				$defaultCountryName = $row_country_count[0][1];
-			
-			}
-			
-			// 国データ取得
-			$sql_country = 'select countryID, countryName from t_country order by countryID';
-			$result_country = $session->query_select($sql_country, $pa);
-			
-			// GPS以外の場合
-			if ($latitude == 0 || $longitude == 0) {
-			
-				$num = rand(1, 9);
-				
-				if ($num <= 3) {
-				
-					$countryid = $result_country[0][0];
-					$countryname = $result_country[0][1];
-					
-				} elseif ($num <= 6) {
-				
-					$countryid = $result_country[1][0];
-					$countryname = $result_country[1][1];
-				
-				} else {
-				
-					$countryid = $result_country[2][0];
-					$countryname = $result_country[2][1];
-				
-				}
-			
-			} else {
-			
-				// GPSの場合
-				$lati_mod = $latitude % 2;
-				$longi_mod = $longitude % 2;
-				
-				if ($lati_mod == 1 && $longi_mod == 1) {
-				
-					$countryid = $result_country[0][0];
-					$countryname = $result_country[0][1];
-				
-				} elseif ($lati_mod == 0 && $longi_mod == 1) {
-				
-					$countryid = $result_country[1][0];
-					$countryname = $result_country[1][1];
-				
-				} elseif ($lati_mod == 0 && $longi_mod == 0) {
-				
-					$countryid = $result_country[2][0];
-					$countryname = $result_country[2][1];
-				
-				} else {
-				
-					$countryid = $defaultCountry;
-					$countryname = $defaultCountryName;
-				}
-			
-			}			
-			
-			// ユーザ登録
-			$sql_id_search = 'select userID from t_user where userID = :userID';
-			$sql_insert_user = 'insert into t_user (userID, userName, paramID, country, lastUpdateDate) values (:userID, :userName, :paramID, :country, now())';
-			
-			$entry_flg = false;
-						
-			for($i=0; $i<3; $i++) {
-				$userid = USERID_PREFIX . substr(md5(uniqid()),-9);
-				
-				$param_id_search = array(":userID" => "$userid");
-				
-				$result_id_search = $session->query_select($sql_id_search, $param_id_search);
-				
-				if(empty($result_id_search)) {
-				
-					$param_insert_user = array(":userID" => "$userid",
-												":userName" => "$username",
-												":paramID" => "$default_param",
-												":country" => "$countryid");
-						
-					$result_insert_uesr = $session->query_update($sql_insert_user, $param_insert_user);
-					
-					if ($result_insert_uesr != 1) {
-						// メッセージは仮
-						throw new Exception('03000', SYSTEM_ERROR);
-					}
-					
-					$entry_flg = true;
-					
-					break;
-				
-				}
-			}
-			
-			if ($entry_flg ==false) {
-				// メッセージは仮
-				throw new Exception('04000', SYSTEM_ERROR);
-			}
-			
-			$sql_insert_user = 'insert into t_userStatus values (:userID, :win, :lost, now())';
-
-			$param_insert_user = array(":userID" => "$userid", ":win" => "0", ":lost" => "0");
-			$result_insert_uesr = $session->query_update($sql_insert_user, $param_insert_user);
-
-			if ($result_insert_uesr != 1) {
- 				// メッセージは仮
- 				throw new Exception('03000', SYSTEM_ERROR);
- 			}
-			
-			// ログイン情報登録
-			// セッションID?は仮
-			$sessionid = md5(uniqid(rand(),1));
-			
-			$sql_insert_login = 'insert into t_login (userID, sessionID, lastLoginDate, lastUpdateDate) values (:userID, :sessionID, now(), now())';
-			$param_insert_login = array(":userID" => "$userid",
-										":sessionID" => "$sessionid");
-			
-			$result_insert_login = $session->query_update($sql_insert_login, $param_insert_login);
-			
-			if ($result_insert_login != 1) {
-				// メッセージは仮
-				throw new Exception('05000', SYSTEM_ERROR);
-			}			
-			
-			$sid = $sessionid;
-			$data = $userid . SP. $countryid . SP . $countryname;
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			if ($e->getCode() == SYSTEM_ERROR) {
-				throw $e;
-			} else {
-				// メッセージは仮
-				throw new Exception('06000', SYSTEM_ERROR);
-			}
-		}
-	}
-
+<?php
+
+	function commandExecute(&$sid) {
+
+		try {
+		
+			/*
+			$username = $_GET['un'];
+			$latitude = $_GET['lat'];
+			$longitude = $_GET['lan'];
+			*/
+			
+			$username = $_POST['un'];
+			$latitude = $_POST['lat'];
+			$longitude = $_POST['lan'];
+			
+			if (strlen($username) == 0 || strlen($username) > USERNAME_CNT) {
+				// メッセージは仮
+				throw new Exception('01000', SYSTEM_ERROR);
+			}
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+			
+			// ユーザ名の重複チェック
+			$sql_name_search = 'select userName from t_user where userName = :userName';
+			$param_name_search = array(":userName" => "$username");
+			
+			$result_name_search = $session->query_select($sql_name_search, $param_name_search);
+			
+			if (!empty($result_name_search)){
+				// メッセージは仮
+				throw new Exception('02000', SYSTEM_ERROR);
+			}
+			
+			// 初期パラメータ取得
+			$sql_default_param = 'select paramID from t_defaultParam where paramType=1';
+			$result_default_param = $session->query_select($sql_default_param, $pa);
+			
+			if (empty($result_default_param)) {
+				// メッセージは仮
+				throw new Exception('07000', SYSTEM_ERROR);
+			
+			}
+			
+			$default_param = $result_default_param[0][0];
+			
+			// 人口が一番少ない国を取得
+			$sql_country_count = 'select a.country, b.countryName, count(*) from t_user a, t_country b where a.country = b.countryID group by 1 order by 3';
+			$result_country_count = $session->query_select($sql_country_count, $pa);
+			
+			if (empty($result_country_count)){
+			
+				$defaultCountry = 1;
+				
+			} else {
+			
+				$defaultCountry = $row_country_count[0][0];
+				$defaultCountryName = $row_country_count[0][1];
+			
+			}
+			
+			// 国データ取得
+			$sql_country = 'select countryID, countryName from t_country order by countryID';
+			$result_country = $session->query_select($sql_country, $pa);
+			
+			// GPS以外の場合
+			if ($latitude == 0 || $longitude == 0) {
+			
+				$num = rand(1, 9);
+				
+				if ($num <= 3) {
+				
+					$countryid = $result_country[0][0];
+					$countryname = $result_country[0][1];
+					
+				} elseif ($num <= 6) {
+				
+					$countryid = $result_country[1][0];
+					$countryname = $result_country[1][1];
+				
+				} else {
+				
+					$countryid = $result_country[2][0];
+					$countryname = $result_country[2][1];
+				
+				}
+			
+			} else {
+			
+				// GPSの場合
+				$lati_mod = $latitude % 2;
+				$longi_mod = $longitude % 2;
+				
+				if ($lati_mod == 1 && $longi_mod == 1) {
+				
+					$countryid = $result_country[0][0];
+					$countryname = $result_country[0][1];
+				
+				} elseif ($lati_mod == 0 && $longi_mod == 1) {
+				
+					$countryid = $result_country[1][0];
+					$countryname = $result_country[1][1];
+				
+				} elseif ($lati_mod == 0 && $longi_mod == 0) {
+				
+					$countryid = $result_country[2][0];
+					$countryname = $result_country[2][1];
+				
+				} else {
+				
+					$countryid = $defaultCountry;
+					$countryname = $defaultCountryName;
+				}
+			
+			}			
+			
+			// ユーザ登録
+			$sql_id_search = 'select userID from t_user where userID = :userID';
+			$sql_insert_user = 'insert into t_user (userID, userName, paramID, country, lastUpdateDate) values (:userID, :userName, :paramID, :country, now())';
+			
+			$entry_flg = false;
+						
+			for($i=0; $i<3; $i++) {
+				$userid = USERID_PREFIX . substr(md5(uniqid()),-9);
+				
+				$param_id_search = array(":userID" => "$userid");
+				
+				$result_id_search = $session->query_select($sql_id_search, $param_id_search);
+				
+				if(empty($result_id_search)) {
+				
+					$param_insert_user = array(":userID" => "$userid",
+												":userName" => "$username",
+												":paramID" => "$default_param",
+												":country" => "$countryid");
+						
+					$result_insert_uesr = $session->query_update($sql_insert_user, $param_insert_user);
+					
+					if ($result_insert_uesr != 1) {
+						// メッセージは仮
+						throw new Exception('03000', SYSTEM_ERROR);
+					}
+					
+					$entry_flg = true;
+					
+					break;
+				
+				}
+			}
+			
+			if ($entry_flg ==false) {
+				// メッセージは仮
+				throw new Exception('04000', SYSTEM_ERROR);
+			}
+			
+			$sql_insert_user = 'insert into t_userStatus values (:userID, :win, :lost, now())';
+
+			$param_insert_user = array(":userID" => "$userid", ":win" => "0", ":lost" => "0");
+			$result_insert_uesr = $session->query_update($sql_insert_user, $param_insert_user);
+
+			if ($result_insert_uesr != 1) {
+ 				// メッセージは仮
+ 				throw new Exception('03000', SYSTEM_ERROR);
+ 			}
+			
+			// ログイン情報登録
+			// セッションID?は仮
+			$sessionid = md5(uniqid(rand(),1));
+			
+			$sql_insert_login = 'insert into t_login (userID, sessionID, lastLoginDate, lastUpdateDate) values (:userID, :sessionID, now(), now())';
+			$param_insert_login = array(":userID" => "$userid",
+										":sessionID" => "$sessionid");
+			
+			$result_insert_login = $session->query_update($sql_insert_login, $param_insert_login);
+			
+			if ($result_insert_login != 1) {
+				// メッセージは仮
+				throw new Exception('05000', SYSTEM_ERROR);
+			}			
+			
+			$sid = $sessionid;
+			$data = $userid . SP. $countryid . SP . $countryname;
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			if ($e->getCode() == SYSTEM_ERROR) {
+				throw $e;
+			} else {
+				// メッセージは仮
+				throw new Exception('06000', SYSTEM_ERROR);
+			}
+		}
+	}
+

Modified: trunk/server_php/getAICharParam.php
===================================================================
--- trunk/server_php/getAICharParam.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getAICharParam.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,27 +1,27 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select a.charName, c.countryName, d.power, d.mobility from t_country c, t_defaultParam d, t_AICharacter a where a.countryID = c.countryID and a.paramID = d.paramID';
-			$result = $session->query_select($sql, $pa);
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select a.charName, c.countryName, d.power, d.mobility from t_country c, t_defaultParam d, t_AICharacter a where a.countryID = c.countryID and a.paramID = d.paramID';
+			$result = $session->query_select($sql, $pa);
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getBattleResult.php
===================================================================
--- trunk/server_php/getBattleResult.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getBattleResult.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,38 +1,38 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$rid = roomIDCheck($_POST['roomid']);
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select timerStatus from t_turnTimer where timerStatus != 2';
-			$result = $session->query_select($sql, $pa);
-
-			if(empty($result)) {
-				$data = '@';
-			} else {
-				$sql = 'select charKbn, userName, countryID, mapChipNo, power from t_battle where :roomID = :roomID';
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$rid = roomIDCheck($_POST['roomid']);
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select timerStatus from t_turnTimer where timerStatus != 2';
+			$result = $session->query_select($sql, $pa);
+
+			if(empty($result)) {
+				$data = '@';
+			} else {
+				$sql = 'select charKbn, userName, countryID, mapChipNo, power from t_battle where roomID = :roomID';
 				$pa = array(":roomID" => "$rid");
-
-				$result = $session->query_select($sql, $pa);
-
-				foreach($result as $row) {
-					$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . SP . $row[4] . RLF;
-				}
-				$data = rtrim($data, RLF);
-			}
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+
+				$result = $session->query_select($sql, $pa);
+
+				foreach($result as $row) {
+					$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . SP . $row[4] . RLF;
+				}
+				$data = rtrim($data, RLF);
+			}
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getIniUserParam.php
===================================================================
--- trunk/server_php/getIniUserParam.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getIniUserParam.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,27 +1,27 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select power, mobility from t_defaultParam where paramType = 1';
-			$result = $session->query_select($sql, $pa);
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select power, mobility from t_defaultParam where paramType = 1';
+			$result = $session->query_select($sql, $pa);
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getMapInfo.php
===================================================================
--- trunk/server_php/getMapInfo.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getMapInfo.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,27 +1,27 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select mapID, mapName, mapExplanation, mapComponent from t_map';
-			$result = $session->query_select($sql, $pa);
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select mapID, mapName, mapExplanation, mapComponent from t_map';
+			$result = $session->query_select($sql, $pa);
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getRoomInfo.php
===================================================================
--- trunk/server_php/getRoomInfo.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getRoomInfo.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,27 +1,27 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select roomID, roomName, roomStatus, offenseCountry, defenseCountry, mapID, maxTurnCount, turnCount from t_room where roomStatus in (0, 2)';
-			$result = $session->query_select($sql, $pa);
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . SP . $row[4] . SP . $row[5] . SP . $row[6] . SP . $row[7] . RLF ;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select roomID, roomName, roomStatus, offenseCountry, defenseCountry, mapID, maxTurnCount, turnCount from t_room where roomStatus in (0, 2)';
+			$result = $session->query_select($sql, $pa);
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . SP . $row[3] . SP . $row[4] . SP . $row[5] . SP . $row[6] . SP . $row[7] . RLF ;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getRoomStatus.php
===================================================================
--- trunk/server_php/getRoomStatus.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getRoomStatus.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,27 +1,27 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select roomID, battleRoomID, turnCount from t_roomStatus;
-			$result = $session->query_select($sql, $pa);
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select roomID, battleRoomID, turnCount from t_roomStatus;
+			$result = $session->query_select($sql, $pa);
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . SP . $row[2] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getRoomTurnCount.php
===================================================================
--- trunk/server_php/getRoomTurnCount.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getRoomTurnCount.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,34 +1,34 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$rid = roomIDCheck($_POST['roomid']);
-			
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select maxTurnCount, turnCount from t_room where roomID=:roomID';
-			$pa = array(":roomID" => "$rid");
-			$result = $session->query_select($sql, $pa);
-			
-			if (empty($result)){
-				throw new Exception('00200', SYSTEM_ERROR);
-			}
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$rid = roomIDCheck($_POST['roomid']);
+			
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select maxTurnCount, turnCount from t_room where roomID=:roomID';
+			$pa = array(":roomID" => "$rid");
+			$result = $session->query_select($sql, $pa);
+			
+			if (empty($result)){
+				throw new Exception('00200', SYSTEM_ERROR);
+			}
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/getUserStatus.php
===================================================================
--- trunk/server_php/getUserStatus.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getUserStatus.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,39 +1,39 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-		
-			$userid = userIDCheck($_POST['userid']);
-			// $userid = userIDCheck($_GET['userid']);
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select win, lost from t_userStatus where userID = :userID';
-			$pa = array(":userID" => "$userid");
-			$result = $session->query_select($sql, $pa);
-			
-			if (empty($result)) {
-				throw new Exception('00200', SYSTEM_ERROR);
-			}
-			
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			if ($e->getCode() == SYSTEM_ERROR) {
-				throw $e;
-			} else {
-				throw new Exception('00002', SYSTEM_ERROR);
-			}
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+		
+			$userid = userIDCheck($_POST['userid']);
+			// $userid = userIDCheck($_GET['userid']);
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select win, lost from t_userStatus where userID = :userID';
+			$pa = array(":userID" => "$userid");
+			$result = $session->query_select($sql, $pa);
+			
+			if (empty($result)) {
+				throw new Exception('00200', SYSTEM_ERROR);
+			}
+			
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			if ($e->getCode() == SYSTEM_ERROR) {
+				throw $e;
+			} else {
+				throw new Exception('00002', SYSTEM_ERROR);
+			}
+		}
+	}
+

Modified: trunk/server_php/getcountry.php
===================================================================
--- trunk/server_php/getcountry.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/getcountry.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,27 +1,27 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select countryID, countryName from t_country';
-			$result = $session->query_select($sql, $pa);
-
-			foreach($result as $row) {
-				$data = $data . $row[0] . SP . $row[1] . RLF;
-			}
-			$data = rtrim($data, RLF);
-
-			return $data;
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			throw new Exception('00002', SYSTEM_ERROR);
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select countryID, countryName from t_country';
+			$result = $session->query_select($sql, $pa);
+
+			foreach($result as $row) {
+				$data = $data . $row[0] . SP . $row[1] . RLF;
+			}
+			$data = rtrim($data, RLF);
+
+			return $data;
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			throw new Exception('00002', SYSTEM_ERROR);
+		}
+	}
+

Modified: trunk/server_php/main.php
===================================================================
--- trunk/server_php/main.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/main.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,146 +1,146 @@
-<?php
-
-	require('checkLib.php');
-	require('sysparam.inc');
-	require('dbutil.php');	
-	
-	try {
-
-		$comNo = substr($_POST['data'], 0, 6);
-//		$comNo = substr($_GET['data'], 0, 6);
-
-		$userID = $_POST['userid'];
-		$sessionID = $_POST['sessionid'];
-
-		switch ($comNo) {
-		
-			// 新規ユーザ登録
-			case 'U01001':
-				require('entryNewUser.php');
-				$result = commandExecute($sessionID);
-				break;
-				
-			// 既存ユーザログイン
-			case 'U01002':
-				require('login.php');
-				$result = commandExecute($sessionID);
-				break;
-			
-			// 所属国設定要求
-			case 'C01001':
-				require('');
-				break;
-
-			// 所属国の一覧要求
-			case 'C01002':
-				sessionCheck($comNo, $userID, $sessionID);
-				
-				require('getcountry.php');
-				$result = commandExecute();
-				break;
-
-			// ユーザの初期パラメータ要求
-			case 'U01003':
-				sessionCheck($comNo,$userID, $sessionID);
-			
-				require('getIniUserParam.php');
-				$result = commandExecute();
-				break;
-
-			// ユーザの初期MAP位置設定要求
-			case 'U01004':
-				require('');
-				break;
-
-			// ユーザステータス要求
-			case 'U01005':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('getUserStatus.php');
-				$result = commandExecute();
-				break;
-
-			// AI武将パラメータ要求
-			case 'A01001':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('getAICharParam.php');
-				$result = commandExecute();
-				break;
-
-			// ルーム情報要求
-			case 'R01001':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('getRoomInfo.php');
-				$result = commandExecute();
-				break;
-
-			// ルーム入室要求
-			case 'R01003':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('setUserEntryRoom.php');
-				commandExecute();
-				break;
-
-			// ルーム退室要求
-			case 'R01004':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('setUserExitRoom.php');
-				commandExecute();
-				break;
-
-			// ルームターンカウント要求
-			case 'R01005':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('getRoomTurnCount.php');
-				$result = commandExecute();
-				break;
-
-			// マップ情報要求
-			case 'M01001':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('getMapInfo.php');
-				$result = commandExecute();
-				break;
-
-			// 戦闘情報送信
-			case 'B01001':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('setBattleInfo.php');
-				commandExecute();
-				break;
-
-			// 戦闘結果要求
-			case 'B01002':
-				sessionCheck($comNo, $userID, $sessionID);
-			
-				require('getBattleResult.php');
-				$result = commandExecute();
-				break;
-
-			// コマンドエラー(対応コマンドがない)
-			default:
-				throw new Exception('0000001', SYSTEM_ERROR);
-
-		}
-
-		echo $comNo . SP . CMD_OK . SP . $sessionID .($result ? RLF . $result : "");
-		
-	} catch (sessionException $e) {
-		echo $comNo . SP . CMD_ERR . RLF . SESSION_ERROR;
-	} catch (Exception $e) {
-		if ($e->getCode() == SYSTEM_ERROR) {
-			echo $comNo . SP . CMD_ERR . RLF . $e->getMessage();
-		} else {
-			// 不明なエラー扱い
-			echo $comNo . SP . CMD_ERR . RLF . UNKNOWN_ERROR;
-		}
-	}
-
-?>
+<?php
+
+	require('checkLib.php');
+	require('sysparam.inc');
+	require('dbutil.php');	
+	
+	try {
+
+		$comNo = substr($_POST['data'], 0, 6);
+//		$comNo = substr($_GET['data'], 0, 6);
+
+		$userID = $_POST['userid'];
+		$sessionID = $_POST['sessionid'];
+
+		switch ($comNo) {
+		
+			// 新規ユーザ登録
+			case 'U01001':
+				require('entryNewUser.php');
+				$result = commandExecute($sessionID);
+				break;
+				
+			// 既存ユーザログイン
+			case 'U01002':
+				require('login.php');
+				$result = commandExecute($sessionID);
+				break;
+			
+			// 所属国設定要求
+			case 'C01001':
+				require('');
+				break;
+
+			// 所属国の一覧要求
+			case 'C01002':
+				sessionCheck($comNo, $userID, $sessionID);
+				
+				require('getcountry.php');
+				$result = commandExecute();
+				break;
+
+			// ユーザの初期パラメータ要求
+			case 'U01003':
+				sessionCheck($comNo,$userID, $sessionID);
+			
+				require('getIniUserParam.php');
+				$result = commandExecute();
+				break;
+
+			// ユーザの初期MAP位置設定要求
+			case 'U01004':
+				require('');
+				break;
+
+			// ユーザステータス要求
+			case 'U01005':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('getUserStatus.php');
+				$result = commandExecute();
+				break;
+
+			// AI武将パラメータ要求
+			case 'A01001':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('getAICharParam.php');
+				$result = commandExecute();
+				break;
+
+			// ルーム情報要求
+			case 'R01001':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('getRoomInfo.php');
+				$result = commandExecute();
+				break;
+
+			// ルーム入室要求
+			case 'R01003':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('setUserEntryRoom.php');
+				commandExecute();
+				break;
+
+			// ルーム退室要求
+			case 'R01004':
+//				sessionCheck($comNo, $userID, $sessionID);
+			
+//				require('setUserExitRoom.php');
+//				commandExecute();
+				break;
+
+			// ルームターンカウント要求
+			case 'R01005':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('getRoomTurnCount.php');
+				$result = commandExecute();
+				break;
+
+			// マップ情報要求
+			case 'M01001':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('getMapInfo.php');
+				$result = commandExecute();
+				break;
+
+			// 戦闘情報送信
+			case 'B01001':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('setBattleInfo.php');
+				commandExecute();
+				break;
+
+			// 戦闘結果要求
+			case 'B01002':
+				sessionCheck($comNo, $userID, $sessionID);
+			
+				require('getBattleResult.php');
+				$result = commandExecute();
+				break;
+
+			// コマンドエラー(対応コマンドがない)
+			default:
+				throw new Exception('0000001', SYSTEM_ERROR);
+
+		}
+
+		echo $comNo . SP . CMD_OK . SP . $sessionID .($result ? RLF . $result : "");
+		
+	} catch (sessionException $e) {
+		echo $comNo . SP . CMD_ERR . RLF . SESSION_ERROR;
+	} catch (Exception $e) {
+		if ($e->getCode() == SYSTEM_ERROR) {
+			echo $comNo . SP . CMD_ERR . RLF . $e->getMessage();
+		} else {
+			// 不明なエラー扱い
+			echo $comNo . SP . CMD_ERR . RLF . UNKNOWN_ERROR;
+		}
+	}
+
+?>

Modified: trunk/server_php/sessionException.php
===================================================================
--- trunk/server_php/sessionException.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/sessionException.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,12 +1,12 @@
-<?php
-
-class sessionException extends Exception {
-
-	public function __construct($message =NULL, $code = 0) {
-
-		parent::__construct($message, $code);
-		
-	}
-	
-}
-
+<?php
+
+class sessionException extends Exception {
+
+	public function __construct($message =NULL, $code = 0) {
+
+		parent::__construct($message, $code);
+		
+	}
+	
+}
+

Modified: trunk/server_php/setBattleInfo.php
===================================================================
--- trunk/server_php/setBattleInfo.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/setBattleInfo.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,60 +1,60 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-			
-			$userid = userIDCheck($_POST['userid']);
-			$roomid = roomIDCheck($_POST['roomid']);
-			$movemapchipno = $_POST['movemapchipno'];
-			$battlecommandid = $_POST['battlecommandid'];
-			$battlemapchipno = $_POST['battlemapchipno'];
-			
-			/*
-			$userid = userIDCheck($_GET['userid']);
-			$roomid = roomIDCheck($_GET['roomid']);
-			$movemapchipno = $_GET['movemapchipno'];
-			$battlecommandid = $_GET['battlecommandid'];
-			$battlemapchipno = $_GET['battlemapchipno'];
-			*/
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-			
-			$sql_user_search = 'select userID, roomID from t_userAction where userID = :userID and roomID = :roomID';
-			$param_user_search = array(":userID" => "$userid",
-										":roomID" => "$roomid");
-			
-			$result_user_search = $session->query_select($sql_user_search, $param_user_search);
-			
-			if (!empty($result_user_search)){
-				// メッセージは仮
-				throw new Exception('02000', SYSTEM_ERROR);
-			}
-			
-			$sql_action_insert = 'insert into t_userAction (userID, roomID, moveMapChipNo, battleCommandID, battleMapChipNo, lastUpdateDate) values (:userid, :roomid, :movemapchipno, :battlecommandid, :battlemapchipno, now())';
-			$param_action_insert = array(":userid" => $userid,
-										 ":roomid" => $roomid,
-										 ":movemapchipno" => $movemapchipno,
-										 ":battlecommandid" => $battlecommandid,
-										 ":battlemapchipno" => $battlemapchipno);
-										 
-			$result_action_insert = $session->query_update($sql_action_insert, $param_action_insert);
-			
-			if ($result_action_insert != 1) {
-				// メッセージは仮
-				throw new Exception('03000', SYSTEM_ERROR);
-			}
-			
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			if ($e->getCode() == SYSTEM_ERROR) {
-				throw $e;
-			} else {
-				throw new Exception('00002', SYSTEM_ERROR);
-			}
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+			
+			$userid = userIDCheck($_POST['userid']);
+			$roomid = roomIDCheck($_POST['roomid']);
+			$movemapchipno = $_POST['movemapchipno'];
+			$battlecommandid = $_POST['battlecommandid'];
+			$battlemapchipno = $_POST['battlemapchipno'];
+			
+			
+//			$userid = userIDCheck($_GET['userid']);
+//			$roomid = roomIDCheck($_GET['roomid']);
+//			$movemapchipno = $_GET['movemapchipno'];
+//			$battlecommandid = $_GET['battlecommandid'];
+//			$battlemapchipno = $_GET['battlemapchipno'];
+			
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+			
+			$sql_user_search = 'select userID, roomID from t_userAction where userID = :userID and roomID = :roomID';
+			$param_user_search = array(":userID" => "$userid",
+										":roomID" => "$roomid");
+			
+			$result_user_search = $session->query_select($sql_user_search, $param_user_search);
+			
+			if (!empty($result_user_search)){
+				// メッセージは仮
+				throw new Exception('02000', SYSTEM_ERROR);
+			}
+			
+			$sql_action_insert = 'insert into t_userAction (userID, roomID, moveMapChipNo, battleCommandID, battleMapChipNo, lastUpdateDate) values (:userid, :roomid, :movemapchipno, :battlecommandid, :battlemapchipno, now())';
+			$param_action_insert = array(":userid" => $userid,
+										 ":roomid" => $roomid,
+										 ":movemapchipno" => $movemapchipno,
+										 ":battlecommandid" => $battlecommandid,
+										 ":battlemapchipno" => $battlemapchipno);
+										 
+			$result_action_insert = $session->query_update($sql_action_insert, $param_action_insert);
+			
+			if ($result_action_insert != 1) {
+				// メッセージは仮
+				throw new Exception('03000', SYSTEM_ERROR);
+			}
+			
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			if ($e->getCode() == SYSTEM_ERROR) {
+				throw $e;
+			} else {
+				throw new Exception('00002', SYSTEM_ERROR);
+			}
+		}
+	}
+

Modified: trunk/server_php/setUserEntryRoom.php
===================================================================
--- trunk/server_php/setUserEntryRoom.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/setUserEntryRoom.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,129 +1,135 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$uid = userIDCheck($_POST['userid']);
-			$rid = roomIDCheck($_POST['roomid']);
-
-//			$uid = userIDCheck($_GET['userid']);
-//			$rid = roomIDCheck($_GET['roomid']);
-
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'select exclusionKbn from t_battle where userID = :userID and roomID = :roomID';
-			$pa = array(":userID" => "$uid", ":roomID" => "$rid");
-			$result = $session->query_select($sql, $pa);
-
-			if (! empty($result)) {
-				throw new Exception('0080001', SYSTEM_ERROR);
-			}
-
-			//ユーザ情報を取ってくる
-
-			$sql = 'select u.userName, u.country, d.power, d.mobility from t_defaultParam d, t_user u where u.userID = :userID and u.paramID = d.paramID';
-			$pa = array(":userID" => "$uid");
-			$result = $session->query_select($sql, $pa);
-
-			if (empty($result)) {
-				throw new Exception('0080002', SYSTEM_ERROR);
-			} else {
-				foreach($result as $row) {
-					$userName =  $row['userName'];
-					$countryID =  $row['country'];
-					$power = $row['power'];
-					$mobility =  $row['mobility'];
-				}
-			}
- 
-			$umapNo = getUserMapNo(getUserType($session, $rid, $countryID));
-
- 			// 乱数なので同じ値にならないことを前提→後で直す
-			$bid = makeBattleID();
-
-			$sql = "insert into t_battle values (:bid, :rid, :uid, :userName, :countryID, :userKbn, :umapNo, :power, :mobility, :exclusionKbn, now())";
-			$pa = array(
-						":bid" => "$bid", 
-						":rid" => "$rid", 
-						":uid" => "$uid", 
-						":userName" => "$userName", 
-						":countryID" => "$countryID", 
-						":userKbn" => USER_KBN, 
-						":umapNo" => "$umapNo", 
-						":power" => "$power", 
-						":mobility" => "$mobility", 
-						":exclusionKbn" => "0");
-
-			$result = $session->query_update($sql, $pa);
-
-			if ($result == 0) {
-				throw new Exception('0080003', SYSTEM_ERROR);
-			}
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			if ($e->getCode() == SYSTEM_ERROR) {
-				throw $e;
-			} else {
-				throw new Exception('00002', SYSTEM_ERROR);
-			}
-		}
-	}
-
-
-	function makeBattleID() {
-
-		$bid = 0;
-
-		for ($i = 0 ; $i < 8 ; $i++){
-			$bid = $bid . mt_rand(0, 9);
-		}
-
-		return $bid;
-	
-	}
-
-
-	function getUserType($s, $roomID, $countryID) {
-	
-		$sql = 'select offenseCountry, defenseCountry from t_room where roomID = :roomID';
-		$pa = array(":roomID" => "$roomID");
-		$result = $s->query_select($sql, $pa);
-
-		if (empty($result)) {
-			throw new Exception('0080004', SYSTEM_ERROR);
-		} else {
-			foreach($result as $row) {
-				$offense =  $row['offenseCountry'];
-				$defense =  $row['defenseCountry'];
-			}
-		}
-		
-		switch ($countryID) {
-			case $offense:
-				$utype = OFF_TYPE;
-				break;
-			case $defense:
-				$utype = DEF_TYPE;
-				break;
-			default :
-				throw new Exception('0080005', SYSTEM_ERROR);
-		}
-		
-		return $utype;
-		
-	}
-
-
-	function getUserMapNo($utype) {
-
-		$initMap = ($utype == OFF_TYPE) ? unserialize(OFF_INIT) : unserialize(DEF_INIT);
-		return $initMap[mt_rand(0, count($initMap))];
-
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$uid = userIDCheck($_POST['userid']);
+			$rid = roomIDCheck($_POST['roomid']);
+
+//			$uid = userIDCheck($_GET['userid']);
+//			$rid = roomIDCheck($_GET['roomid']);
+
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'select exclusionKbn from t_battle where userID = :userID and roomID = :roomID';
+			$pa = array(":userID" => "$uid", ":roomID" => "$rid");
+			$result = $session->query_select($sql, $pa);
+
+			if (! empty($result)) {
+
+				$sql = 'delete from t_battle where userID = :userID and roomID = :roomID';
+				$pa = array(":userID" => "$uid", ":roomID" => "$rid");
+				$result = $session->query_select($sql, $pa);
+
+
+//				throw new Exception('0080001', SYSTEM_ERROR);
+			}
+
+			//ユーザ情報を取ってくる
+
+			$sql = 'select u.userName, u.country, d.power, d.mobility from t_defaultParam d, t_user u where u.userID = :userID and u.paramID = d.paramID';
+			$pa = array(":userID" => "$uid");
+			$result = $session->query_select($sql, $pa);
+
+			if (empty($result)) {
+				throw new Exception('0080002', SYSTEM_ERROR);
+			} else {
+				foreach($result as $row) {
+					$userName =  $row['userName'];
+					$countryID =  $row['country'];
+					$power = $row['power'];
+					$mobility =  $row['mobility'];
+				}
+			}
+ 
+			$umapNo = getUserMapNo(getUserType($session, $rid, $countryID));
+
+ 			// 乱数なので同じ値にならないことを前提→後で直す
+			$bid = makeBattleID();
+
+			$sql = "insert into t_battle values (:bid, :rid, :uid, :userName, :countryID, :userKbn, :umapNo, :power, :mobility, :exclusionKbn, now())";
+			$pa = array(
+						":bid" => "$bid", 
+						":rid" => "$rid", 
+						":uid" => "$uid", 
+						":userName" => "$userName", 
+						":countryID" => "$countryID", 
+						":userKbn" => USER_KBN, 
+						":umapNo" => "$umapNo", 
+						":power" => "$power", 
+						":mobility" => "$mobility", 
+						":exclusionKbn" => "0");
+
+			$result = $session->query_update($sql, $pa);
+
+			if ($result == 0) {
+				throw new Exception('0080003', SYSTEM_ERROR);
+			}
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			if ($e->getCode() == SYSTEM_ERROR) {
+				throw $e;
+			} else {
+				throw new Exception('00002', SYSTEM_ERROR);
+			}
+		}
+	}
+
+
+	function makeBattleID() {
+
+		$bid = 0;
+
+		for ($i = 0 ; $i < 8 ; $i++){
+			$bid = $bid . mt_rand(0, 9);
+		}
+
+		return $bid;
+	
+	}
+
+
+	function getUserType($s, $roomID, $countryID) {
+	
+		$sql = 'select offenseCountry, defenseCountry from t_room where roomID = :roomID';
+		$pa = array(":roomID" => "$roomID");
+		$result = $s->query_select($sql, $pa);
+
+		if (empty($result)) {
+			throw new Exception('0080004', SYSTEM_ERROR);
+		} else {
+			foreach($result as $row) {
+				$offense =  $row['offenseCountry'];
+				$defense =  $row['defenseCountry'];
+			}
+		}
+		
+		switch ($countryID) {
+			case $offense:
+				$utype = OFF_TYPE;
+				break;
+			case $defense:
+				$utype = DEF_TYPE;
+				break;
+			default :
+				throw new Exception('0080005', SYSTEM_ERROR);
+		}
+		
+		return $utype;
+		
+	}
+
+
+	function getUserMapNo($utype) {
+
+		$initMap = ($utype == OFF_TYPE) ? unserialize(OFF_INIT) : unserialize(DEF_INIT);
+		return $initMap[mt_rand(0, count($initMap))];
+
+	}
+

Modified: trunk/server_php/setUserExitRoom.php
===================================================================
--- trunk/server_php/setUserExitRoom.php	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/setUserExitRoom.php	2010-11-10 14:33:38 UTC (rev 467)
@@ -1,36 +1,36 @@
-<?php
-
-	function commandExecute() {
-
-		try {
-
-			$uid = userIDCheck($_POST['userid']);
-			$rid = roomIDCheck($_POST['roomid']);
-
-//			$uid = userIDCheck($_GET['userid']);
-//			$rid = roomIDCheck($_GET['roomid']);
-
-			$db = new DBConnection();
-			$session = new DBSession($db);
-			$db->AssignDBConnection($session);
-
-			$sql = 'update t_battle set exclusionKbn = 1 where userID = :userID and roomID = :roomID';
-			$pa = array(":userID" => "$uid", ":roomID" => "$rid");
-
-			$result = $session->query_update($sql, $pa);
-
-			if ($result == 0) {
-				throw new Exception('0080001', SYSTEM_ERROR);
-			}
-
-		} catch(PDOException $e){
-			throw new Exception('50000', SYSTEM_ERROR);
-		} catch (Exception $e){ 
-			if ($e->getCode() == SYSTEM_ERROR) {
-				throw $e;
-			} else {
-				throw new Exception('00002', SYSTEM_ERROR);
-			}
-		}
-	}
-
+<?php
+
+	function commandExecute() {
+
+		try {
+
+			$uid = userIDCheck($_POST['userid']);
+			$rid = roomIDCheck($_POST['roomid']);
+
+//			$uid = userIDCheck($_GET['userid']);
+//			$rid = roomIDCheck($_GET['roomid']);
+
+			$db = new DBConnection();
+			$session = new DBSession($db);
+			$db->AssignDBConnection($session);
+
+			$sql = 'update t_battle set exclusionKbn = 1 where userID = :userID and roomID = :roomID';
+			$pa = array(":userID" => "$uid", ":roomID" => "$rid");
+
+			$result = $session->query_update($sql, $pa);
+
+			if ($result == 0) {
+				throw new Exception('0080001', SYSTEM_ERROR);
+			}
+
+		} catch(PDOException $e){
+			throw new Exception('50000', SYSTEM_ERROR);
+		} catch (Exception $e){ 
+			if ($e->getCode() == SYSTEM_ERROR) {
+				throw $e;
+			} else {
+				throw new Exception('00002', SYSTEM_ERROR);
+			}
+		}
+	}
+

Modified: trunk/server_php/sysparam.inc
===================================================================
--- trunk/server_php/sysparam.inc	2010-11-10 14:18:45 UTC (rev 466)
+++ trunk/server_php/sysparam.inc	2010-11-10 14:33:38 UTC (rev 467)
@@ -131,14 +131,14 @@
  * 
  * @var integer 攻撃側初期配備位置
  */
-define('OFF_INIT', serialize(array(3356,3357,3358,3359,3360,3416,3417,3418,3419,3420,3476,3477,3478,3479,3480,3536,3537,3538,3539,3540,3596,3597,3598,3599,3600)));
+define('OFF_INIT', serialize(array(2516,2517,2518,2519,2520,2561,2562,2563,2564,2565,2606,2607,2608,2609,2610,2651,2652,2653,2654,2655,2696,2697,2698,2699,2700)));
 
 /**
  * 守備側初期位置配列
  * 
  * @var integer 守備側初期配備位置
  */
-define('DEF_INIT', serialize(array(1,2,3,4,5,61,62,63,64,65,121,122,123,124,125,181,182,183,184,185,241,242,243,244,245,3301,3302,3303,3304,3305,3361,3362,3363,3364,3365,3421,3422,3423,3424,3425,3481,3482,3483,3484,3485,3541,3542,3543,3544,3545)));
+define('DEF_INIT', serialize(array(1,2,3,4,5,46,47,48,49,50,91,92,93,94,95,136,137,138,139,140,181,182,183,184,185,41,42,43,44,45,86,87,88,89,90,131,132,133,134,135,176,177,178,179,180,221,222,223,224,225,2476,2477,2478,2479,2480,2521,2522,2523,2524,2525,2566,2567,2568,2569,2570,2611,2612,2613,2614,2615,2656,2657,2658,2659,2660)));
 
 /**
  * 攻撃減算地




Sangokushi-svn メーリングリストの案内