forked from charu25/beer-factory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
101 lines (85 loc) · 2.49 KB
/
main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
$id=$_POST['name'];
session_start();
$_SESSION["id"]=$id;
echo $id;
/*if(isset($_POST['s'])){
echo "hey";
if($_SESSION["id"]=='11'){
echo "hi";
}
}*/
?>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<center>
<h1>BEER Factory</h1>
</center>
<center>
<h2>DISTRIBUTOR</h2>
</center>
<div id="orderdiv" style="position:absolute; margin-left:450px; margin-top:50px">
<p>Order:</p>
<input type="number" id="order" name="order" min="1">
<input type="button" id="orderbutton" onclick="order()" value="ok">
</div>
<div id="supplydiv" style="position:absolute; margin-left:700px; margin-top:50px">
<p>Supply:</p>
<input type="number" id="supply" name="supply" min="1">
<input type="button" id="supplybutton" class="supplybutton" onclick="supply()" value="ok">
</div>
<div>
<p>Round No:</p>
<p id="Round">1</p><br>
<p id="yo">Welcome</p>
<p>Icost:</p>
<p id="Icost">200</p>
<p>Bcost:</p>
<p id="Bcost">300</p>
<p>pending-order:</p>
<p id="Porder">20</p>
<p>Inventory:</p>
<p id="Inv">30</p>
</div>
<br>
PLAYER TABLE
<div id="result" style="position:absolute; margin-top=2500px">
</div>
</body>
<script src="jquery.js"></script>
<script type="text/javascript">
var flag=0;
function supply(){
flag=1;
alert(sup);
$.ajax({
type:"post",
url:"player.php",
data: {supply:$('#supply').val(),
order:0,
round:$('#Round').text(),
f:flag},
success:function(data){
//$("#result").html(data);
},
});
}
function order(){
flag=2;
$.ajax({
type:"post",
url:"player.php",
data: {order:$('#order').val(),
supply:'0',
round:$('#Round').text(),
f:flag},
success:function(data){
//alert("order has been placed");
}
});
}
</script>
</html>