· 10 years ago · Sep 05, 2016, 04:48 PM
1<?php
2/**
3 *
4 * @ This file is created by DeZend.Org
5 * @ DeZend (PHP5 Decoder for ionCube Encoder)
6 *
7 * @ Version : 1.1.7.0
8 * @ Author : TuhanTS
9 * @ Release on : 25.02.2013
10 * @ Official site : http://DeZend.Org
11 *
12 */
13
14if (!defined( 'EvolutionScript' )) {
15 exit( 'Hacking attempt...' );
16}
17
18$chkadmin = new VData( );
19
20$localkey = $db->fetchOne( 'SELECT localkey FROM localkey WHERE id=1' );
21
22$chkadmin->getinfo( $localkey );
23
24if ($chkadmin->info['headtail'] != 'enable') {
25 $chkadmin->details( $ptcevolution->config['Misc']['license'] );
26 $chkadmin->getinfo( $chkadmin->masterkey );
27 $chkadmin->masterkey;
28
29 if ($chkadmin->info['headtail'] == 'enable') {
30 $data = array( 'localkey' => $chkadmin->masterkey );
31 $db->update( 'localkey', $data, 'id=1' );
32 echo '<script>location.href="./?view=addon_modules&module=head_tail";</script>';
33 return 1;
34 }
35
36 echo 'You need to purchase this addon before use it.';
37 return 1;
38}
39
40$verifyaddon = $db->fetchOne( 'SELECT COUNT(*) AS NUM FROM addon WHERE name=\'head_tail\'' );
41
42
43if ($verifyaddon == 0) {
44 if ($_GET['install'] == 'do') {
45 $install = array( 'name' => 'head_tail' );
46 $db->insert( 'addon', $install );
47 $db->query( 'INSERT INTO settings (field ,value)VALUES (\'ht_profit\', \'200\')' );
48 $db->query( 'INSERT INTO settings (field ,value)VALUES (\'ht_cost\', \'0.05,0.10,0.20,0.40,1.00,2.00,4.00,8.00,16.00,32.00,200\')' );
49 $db->query( 'INSERT INTO settings (field ,value)VALUES (\'ht_statistics\', \'yes\')' );
50 $db->query( 'INSERT INTO settings (field ,value)VALUES (\'ht_lastwinners\', \'10\')' );
51 $db->query( 'INSERT INTO settings (field ,value)VALUES (\'ht_showlastwinners\', \'yes\')' );
52 $db->query( 'INSERT INTO settings (field ,value)VALUES (\'ht_win\', \'50\')' );
53 $db->query( 'CREATE TABLE IF NOT EXISTS ht_history (id int(11) NOT NULL auto_increment,user_id int(11) NOT NULL,date int(11) NOT NULL,bet varchar(10) NOT NULL,amount decimal(11,3) NOT NULL,win decimal(11,3) NOT NULL default \'0.000\',coin int(2) NOT NULL default \'0\',PRIMARY KEY (id)) ENGINE=MyISAM DEFAULT CHARSET=latin1;' );
54 echo '<script>location.href="./?view=addon_modules&module=head_tail";</script>';
55 exit( );
56 }
57
58 echo 'Welcome to Head Tail Game for PTCEvolution v4.x.<br>To start the installation, click in the following button.<br><br>';
59 echo '<input type="button" class="buttonblue" value="Install" onclick="location.href=\'?view=addon_modules&module=head_tail&install=do\';">';
60 return 1;
61}
62
63
64if ($_GET['uninstall'] == 'do') {
65 $db->delete( 'addon', 'name=\'head_tail\'' );
66 $db->delete( 'settings', 'field=\'ht_profit\'' );
67 $db->delete( 'settings', 'field=\'ht_cost\'' );
68 $db->delete( 'settings', 'field=\'ht_statistics\'' );
69 $db->delete( 'settings', 'field=\'ht_lastwinners\'' );
70 $db->delete( 'settings', 'field=\'ht_showlastwinner\'' );
71 $db->delete( 'settings', 'field=\'ht_win\'' );
72 $db->query( 'DROP TABLE ht_history' );
73 echo '<script>location.href="./?view=addon_modules&module=head_tail";</script>';
74 exit( );
75}
76
77$htplayed = $db->fetchOne( 'SELECT COUNT(*) AS NUM FROM ht_history' );
78
79$htheadwin = $db->fetchOne( 'SELECT COUNT(*) AS NUM FROM ht_history WHERE bet=\'Head\' AND win!=0' );
80
81$htheadwin2 = $db->fetchOne( 'SELECT COUNT(*) AS NUM FROM ht_history WHERE bet=\'Tail\' AND win=0' );
82
83$htheadwin = $htheadwin + $htheadwin2;
84$httailwin = $db->fetchOne( 'SELECT COUNT(*) AS NUM FROM ht_history WHERE bet=\'Tail\' AND win!=0' );
85
86$httailwin2 = $db->fetchOne( 'SELECT COUNT(*) AS NUM FROM ht_history WHERE bet=\'Head\' AND win=0' );
87
88$httailwin = $httailwin + $httailwin2;
89
90if ($htplayed != 0) {
91 $htheadpercent = round( $htheadwin * 100 / $htplayed, 2 );
92
93 $httailpercent = round( $httailwin * 100 / $htplayed, 2 );
94
95}
96else {
97 $htheadpercent = 480;
98 $httailpercent = 480;
99}
100
101$htpaid = $db->fetchOne( 'SELECT SUM(win) FROM ht_history' );
102
103
104if ($htpaid == '') {
105 $htpaid = '0.00';
106}
107
108$htamount = $db->fetchOne( 'SELECT SUM(amount) FROM ht_history' );
109
110echo ' <div class="info_box">
111 <strong>Head or Tail Game</strong> is installed in your website, if you do not want continue using this addon, you can uninstall it <a href="./?view=addon_modules&module=head_tail&uninstall=do">clicking here</a>.</div>
112
113<script type="text/javascript">
114function addonfrm(id){
115 $(\'#\'+id).l2block();
116 httplocal = \'/admin/modules/head_tail.php\';
117 var jqxhr = $.post(httplocal,$("#"+id).serialize(), function(data) {
118 if(data.status == 0){
119 $("#"+id).l2error(data.msg);
120 $("#"+id).l2unblock();
121 }else if(data.status == 1){
122 $("#"+id).l2success(data.msg);
123 $("#"+id).l2unblock();
124 }
125 }, "json");
126 return false;
127}
128</script>
129 <div>
130
131 <table width="100%" id="tbl">
132 <tr>
133 <td valign="top" width="50%">
134 <table cellpadding="5" width="100%" class="widget-tbl">
135 <tr class="titles">
136 <td colspan="2">Statistics</td>
137 </tr>
138 <tr>
139 <td align="right" width="150">Total:</td>
140 <td><strong>';
141echo $htplayed;
142echo '</strong></td>
143 </tr>
144 <tr>
145 <td align="right">HEAD:</td>
146 <td><strong>';
147echo $htheadwin;
148echo ' (';
149echo $htheadpercent;
150echo ')%</strong></td>
151 </tr>
152 <tr>
153 <td align="right">TAIL:</td>
154 <td><strong>';
155echo $httailwin;
156echo ' (';
157echo $httailpercent;
158echo ')%</strong></td>
159 </tr>
160 <tr>
161 <td align="right">Paid:</td>
162 <td><strong style="color:red">';
163echo $htpaid;
164echo '$</strong></td>
165 </tr>
166 <tr>
167 <td align="right">Admin profit:</td>
168 <td><strong style="color:green">';
169echo $htamount - $htpaid;
170echo '$</strong></td>
171 </tr>
172 </table>
173
174 <form method="post" id="botsettings" onsubmit="return addonfrm(this.id);">
175 <input type="hidden" name="do" value="save_settings" />
176 <table cellpadding="5" width="100%" class="widget-tbl">
177 <tr class="titles">
178 <td colspan="2">Settings</td>
179 </tr>
180 <tr>
181 <td align="right">Show Statistics:</td>
182 <td>
183 <input type="radio" name="ht_statistics" value="yes" ';
184
185if ($settings['ht_statistics'] == 'yes') {
186 echo 'checked';
187}
188
189echo ' /> Yes
190 <input type="radio" name="ht_statistics" value="no" ';
191
192if ($settings['ht_statistics'] != 'yes') {
193 echo 'checked';
194}
195
196echo ' /> No
197 </td>
198 </tr>
199 <tr>
200 <td align="right">Show Last Winners:</td>
201 <td>
202 <input type="radio" name="ht_showlastwinners" value="yes" ';
203
204if ($settings['ht_showlastwinners'] == 'yes') {
205 echo 'checked';
206}
207
208echo ' /> Yes
209 <input type="radio" name="ht_showlastwinners" value="no" ';
210
211if ($settings['ht_showlastwinners'] != 'yes') {
212 echo 'checked';
213}
214
215echo ' /> No
216 </td>
217 </tr>
218 <tr>
219 <td align="right">Show only:</td>
220 <td><input type="text" name="ht_lastwinners" value="';
221echo $settings[ht_lastwinners];
222echo '" size="3" /> last winners</td>
223 </tr>
224 <tr>
225 <td align="right">Win profit:</td>
226 <td><input type="text" name="ht_profit" value="';
227echo $settings[ht_profit];
228echo '" size="3" />%</td>
229 </tr>
230 <tr>
231 <td align="right">Probability that player win:</td>
232 <td><input type="text" name="ht_win" value="';
233echo $settings[ht_win];
234echo '" size="3" />%</td>
235 </tr>
236 <tr>
237 <td align="right">Bets cost:</td>
238 <td><input type="text" name="ht_cost" value="';
239echo $settings['ht_cost'];
240echo '" /><br />
241 Ex: 0.01,0.05,0.10
242</td>
243 </tr>
244
245 <tr>
246 <td></td>
247 <td>
248 <input type="submit" name="btn" value="Save" class="buttonorange" />
249 </td>
250 </tr>
251 </table>
252 </form>
253 </td>
254 <td valign="top">
255
256
257 <table cellpadding="5" width="100%" class="widget-tbl">
258 <tr class="titles">
259 <td colspan="4">Last 30 Games</td>
260 </tr>
261 <tr class="titles">
262 <td>Date</td>
263 <td>Member</td>
264 <td>Bet</td>
265 <td>Win</td>
266 </tr>
267 ';
268$botmembership = $db->query( 'SELECT * FROM ht_history ORDER BY date DESC LIMIT 30' );
269
270
271
272if ($row = $db->fetch_array( $botmembership )) {
273 $usr = $db->fetchOne('SELECT username FROM members WHERE id=' . $row['user_id'] );
274
275 echo ' <tr>
276 <td>';
277 echo date( 'd-m-Y', $row['date'] );
278 echo '</td>
279 <td>';
280 echo $usr;
281 echo '</td>
282 <td>
283 ';
284
285 if ($row['win'] == 0) {
286 echo '<strong style="color:green"> $';
287 echo $row['amount'];
288 echo '</strong>';
289 }
290 else {
291 echo '$' . $row['amount'];
292 }
293
294 echo '
295 </td>
296 <td>
297 ';
298
299 if ($row['win'] != 0) {
300 echo '<strong style="color:red"> $';
301 echo $row['win'];
302 echo '</strong>';
303 }
304 else {
305 echo '$' . $row['win'];
306 }
307
308 echo ' </td>
309 </tr>
310 ';
311}
312
313echo '
314 </table>
315
316
317
318 </td>
319 </tr>
320 </table>
321
322
323
324
325 ';
326?>