This repository was archived by the owner on Apr 14, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5050.php
More file actions
167 lines (149 loc) · 6.12 KB
/
Copy path5050.php
File metadata and controls
167 lines (149 loc) · 6.12 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
require "header.php";
if (isset($_GET['action']) && $_GET['action'] == 'ban') {
$db->query("UPDATE `grpgusers` SET `ffban` = 1 WHERE `id` = ?");
$db->execute([$user_class->id]);
echo Message('You have banned yourself from 5050 for 1 day');
require "footer.php";
exit;
}
$db->query("SELECT * FROM fiftyfifty");
$all = $db->fetch_row();
$cash = [];
$points = [];
$credits = [];
foreach ($all as $bet) {
if ($bet['currency'] == 'cash') {
$cash[] = $bet;
} elseif ($bet['currency'] == 'points') {
$points[] = $bet;
} elseif ($bet['currency'] == 'credits') {
$credits[] = $bet;
}
}
?>
<script type="text/javascript" src="js/5050.js?v=<?php echo time(); ?>"></script>
<h1>50/50</h1>
<p>Click <a href="?action=ban">Here</a> to ban yourself from 5050 for 1 day</a>
<div class="container">
<table>
<tbody>
<div class="container">
<div class="row">
<div class="col-md-4 col-12">
<h1>Place Cash Bet</h1>
<input type="number" id="betAmount" placeholder="Enter bet amount">
<button id="betCashButton">Place Bet</button>
</div>
<div class="col-md-4 col-12">
<h1>Place Points Bet</h1>
<input type="number" id="betPAmount" placeholder="Enter bet amount">
<button id="betPointsButton">Place Bet</button>
</div>
<div class="col-md-4 col-12">
<h1>Place Credit Bet</h1>
<input type="number" id="betCAmount" placeholder="Enter bet amount">
<button id="betCreditsButton">Place Bet</button>
</div>
</div>
</div>
</tbody>
</table>
<div class="col-12 alert alert-info" style="display:none;"></div>
<div class="row">
<div class="col-md-6 col-12 style=" padding-bottom:10px;">
<h1>Cash Bets</h1>
<table id='cashbettable'>
<thead>
<th>Name</th>
<th>Amount</th>
<th>Action</th>
</thead>
<tbody>
<?php foreach ($cash as $cas): ?>
<tr>
<td><?= formatName($cas['userid']) ?></td>
<td><?= prettynum($cas['amnt'], 1) ?></td>
<?php if ($user_class->id == $cas['userid']): ?>
<td><button class="removeCashButton" value="<?= $cas['id']; ?>">Remove</button></td>
<?php else: ?>
<td><button class="takeCashButton" value="<?= $cas['id']; ?>">Take</button></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="col-md-6 col-12" style="padding-bottom:10px;">
<h1>Point Bets</h1>
<table id="pointbettable">
<thead>
<th>Name</th>
<th>Amount</th>
<th>Action</th>
</thead>
<tbody>
<?php foreach ($points as $poin): ?>
<tr>
<td><?= formatName($poin['userid']) ?></td>
<td><?= prettynum($poin['amnt']) ?> points</td>
<?php if ($user_class->id == $poin['userid']): ?>
<td><button class="removeCashButton" value="<?= $poin['id']; ?>">Remove</button></td>
<?php else: ?>
<td><button class="takePointsButton" value="<?= $poin['id']; ?>">Take</button></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="col-md-3 col-none"></div>
<div class="col-md-6 col-12">
<h1>Credit Bets</h1>
<table id="creditbettable">
<thead>
<th>Name</th>
<th>Amount</th>
<th>Action</th>
</thead>
<tbody>
<?php foreach ($credits as $cre): ?>
<tr>
<td><?= formatName($cre['userid']) ?></td>
<td><?= prettynum($cre['amnt']) ?></td>
<?php if ($user_class->id == $cre['userid']): ?>
<td><button class="removeCashButton" value="<?= $cre['id']; ?>">Remove</button></td>
<?php else: ?>
<td><button class="takeCreditButton" value="<?= $cre['id']; ?>">Take</button></td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<h1>Last 10 bets</h1>
<div class='container lastbets'>
</div>
<div>
<h1>Stats</h1>
<?php
$db->query("SELECT
(SELECT COUNT(*) FROM `5050log` WHERE `better` = ? OR `userid` = ?) AS total_games,
(SELECT COUNT(*) FROM `5050log` WHERE `winner` = ?) AS games_won");
$res = $db->fetch_row(false, [$user_class->id, $user_class->id, $user_class->id]);
$totalGames = $res['total_games'] ?? 0;
$gamesWon = $res['games_won'] ?? 0;
if ($totalGames > 0) {
$winningPercentage = ($gamesWon / $totalGames) * 100;
} else {
$winningPercentage = 0;
}
echo "Your winning percentage is: " . number_format($winningPercentage, 2) . "%";
echo "<br>";
echo "You have played a total of " . number_format($totalGames) . " games";
?>
<?php
require_once __DIR__ . '/footer.php';
?>