forked from Dragonius/www_game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuy.php
51 lines (47 loc) · 1.99 KB
/
buy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
include('session.php');
echo "fetch2 " . $fetch2['session'] . "<br>";
echo "session2 " . $session2 . "<br>" ;
echo "session3 " . $session3 . "<br>" ;
$diff=$session3-$fetch2['session'];
echo "Diffrence " . $diff . "<br>" ;
echo "query2 " . $query2 . "<br>";
?>
<html>
<head>
<title>Welcome to Buy Ships</title>
</head>
<body>
<h1>Welcome <?php echo $login_session; ?></h1>
<?php
$resources = "SELECT metal, fuel, money , diamond FROM Base, Account
WHERE Account.name='$user_check' and Account.base=Base.base";
$resources2=$con->query($resources);
while($resources3 = $resources2->fetch_assoc()) {
echo "Your Current resources: Metal <B>" . $resources3["metal"] . "</B> Fuel <B>" . $resources3["fuel"] .
"</B> Diamond <B>" . $resources3["diamond"] . "</B> Money <B>" . $resources3["money"] . "</B><br>" ;
}
$resources2->close();
?>
<h2>Ships that you can buy</h2>
<?php
$buy_avaible = "Select name_id, firepower, shield, hull, prize_metal, prize_fuel, prize_diamond,
prize_cash from Ship, Base, Account
where Account.base=Base.base and Base.money>=Ship.prize_cash and Account.name='$user_check'";
$buy_avaible2=$con->query($buy_avaible);
echo "<table border=1><tr><td>Avaible Ships: </td><td>Firepower</td><td>Shield</td><td>Hull</td>
<td>Metal</td><td>Fuel</td><td>Diamond</td><td>Cash</td>\t";
while($buy_avaible3 = $buy_avaible2->fetch_row()) {
echo "<tr><td>"
. $buy_avaible3[0] . "</td><td>" . $buy_avaible3[1] . "</td><td>" . $buy_avaible3[2] . "</td><td>"
. $buy_avaible3[3] . "</td><td>" . $buy_avaible3[4] . "</td><td>" . $buy_avaible3[5] . "</td><td>"
. $buy_avaible3[6] . "</td><td>" . $buy_avaible3[7] . "</td><td>buy</td></tr>" ;
}
echo "</tr></table>";
$buy_avaible2->close();
?>
<h2><a href="welcome.php">Welcome link</a></h2>
<h2><a href="build.php">Build link</a></h2>
<h2><a href="logout.php">Sign Out</a></h2>
</body>
</html>