<?
require("login_session.php");

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 class="alt"><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><a href="check/data.php">確認付款</a></li>
		<li class="admin"><a href="vAdmin/">有刺勿近</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>
<?
/*$lastFth = $_POST['lastFth'];*/
$gNickname = $_POST['gNickname'];
$sId = $_POST['sId'];
$amount = $_POST['amount'];
$sql = "select * from virtualclerk where sId = '$sId' limit 1";
$query = mysql_query($sql);
$row = mysql_fetch_object($query);
$vId = $row->id;

/*
$sql3 = "select * from server where sId = '$sId' limit 1";
$query3 = mysql_query($sql3);
$row3 = mysql_fetch_object($query3);
$gId = $row3->gId;

$sql4 = "select * from game where id = '$gId' limit 1";
$query4 = mysql_query($sql4);
$row4 = mysql_fetch_object($query4);
$gName = $row4->gName;
*/

$tTime = date("y-m-d H:i:s");
$sql2 = "insert into transaction ( tTime, cashAmount, mId, vId, sId, gNickname) values ('$tTime','$amount','$username','$vId','$sId', '$gNickname')";
$query2 = mysql_query($sql2);
?>		
		<div class="content">
		<h2>您的交易資料已經送處理</h2>
		<p>請在三個工作天內匯款至XXXXX帳號<br>
		   <h3>應收金額:<? echo $amount;?></h3><br>
		   *一律先匯款後領幣。請在匯完款之後，點選「<a href="check/data.php">確認付款</a>」作確認<br>
		   <? /*並與<h3><? echo $row->vname?></h3>在
		<h3><? echo $row->sName?></h3>領取錢幣*/ ?>
		</p>
		</div>
	
	</div>
	<div id="footer">
		<p>BTFM &copy; mis97 db_09 2006</p>
	</div>
	
</div>

</body>
</html>