<?
session_start();
$username = $_SESSION['username'];

mysql_connect("140.117.74.200", "db_09", "db_09") or die("<a href='index.php'>無法連結主機</a>");
mysql_select_db("db_09") or die("<a href='index.php'>無法連結資料庫</a>");
@mysql_query("SET CHARACTER SET UTF8");

$gId = $_GET['gameId'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>BTFM - 確認付款</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link rel="stylesheet" href="../style/btfm_beta.css" type="text/css" />
</head>

<body>

<div id="roll">
	<div id="header">
		<h1><a href="../index.php">BTFM&nbsp;</a></h1>
		<div class="desc">線上遊戲金幣購買系統</div>
		
		<ul class="topmenu">
		<li><a href="../index.php">首頁</a></li>
		<li><a href="../readme.php">使用說明</a></li>
		<li><a href="../order.php">線上購幣</a></li>
		<li><a href="../register/time.php">會員註冊</a></li>
		<? if(!$_SESSION['login']){	?>
		<li><a href="../login/test5.php">會員登入</a></li>
		<? }else{	?>
		<li><a href="../login/logout.php">會員登出</a></li>
		<? }	?>
		<li class="alt"><a href="../check/data.php">確認付款</a></li>
		<li class="admin"><a href="../index.php">有刺勿近</a></li>
		</ul>
		
	</div>
	<div id="chest">
		
		<div class="leftmenu">
			<ul>
<?
$sql = mysql_query("select * from `game` where 1");
while( list( $id, $gName ) = mysql_fetch_row( $sql ) ){
?>
			<li<? echo ($gId==$id)?" class=\"alt\"":"";?>><a href="../order.php?gameId=<? echo $id; ?>"><? echo $gName; ?></a></li>
<?
	if($gId==$id){
		$game = $gName;
	}
}
?>
			</ul>
		</div>
		
		<div class="content">
<? 
if(isset($_POST['check']))
{
	if(!isset($_POST['lastFth'])){
?>
		<h2>付款確認</h2>
		
		<p>
		<form name="lst5Form" method="post" action="confirm.php">
		請輸入您的轉帳帳號後五碼: <input name="lastFth" type="text" size="5" /><br />
<?		foreach( $_POST['check'] as $time ){ ?>
		<input name="check[]" type="hidden" value="<? echo $time; ?>">
<?		}	?>
		<input name="submit" type="submit" value="送出"><br />
		</form>
		</p>
<?
	}else if( $_POST['lastFth'] ){
	$lastFth = $_POST['lastFth'];

		foreach($_POST['check'] as $time)
		{
			$sql = "update transaction set isPaid = '1', lastFth = '$lastFth' where tTime = '$time'";
			$query = mysql_query($sql);
		}
?>
		<h2><? echo $username?> 您已完成付款確認!!</h2>
		<p>請耐心等候工作人員確認您的匯款。確認所需的時間大概為10分鐘到1小時。<br />
		如有任何問題，請聯絡我們的線上客服人員: nigel0828@hotmail.com (24小時MSN在線)</p>
		
		<p><a href="data.php">回上頁</a></p>
<?		
	}

}else{
?>
		<h2>錯誤</h2>
		
		<p>您沒有交易需要進行付款確認，或者您沒有勾選欲進行付款確認之交易。</p>
		<p><a href="data.php">回上頁</a></p>
<?
}
?>
		</div>
	
	</div>
	<div id="footer">
		<p>BTFM &copy; mis97 db_09 2006</p>
	</div>
	
</div>

</body>
</html>