· 9 years ago · Nov 06, 2016, 05:14 PM
1<?php
2
3$instance = $_GET['i'];
4
5if(empty($instance)) $instance = 1;
6if(!is_numeric($instance)) $instance = 1;
7
8require 'config.php';
9
10$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
11
12
13if(isset($_POST['new_instance']))
14{
15 $sql = "SELECT id FROM settings";
16 $result = $conn->query($sql);
17 $instances = $result->num_rows;
18
19 $instance = $instances++;
20 $sql = "INSERT INTO settings () VALUES ()";
21 $result = $conn->query($sql);
22 if($conn->error) die($conn->error);
23
24 $sql = "CREATE TABLE IF NOT EXISTS bets" . $instances . " (
25 id int unsigned PRIMARY KEY AUTO_INCREMENT,
26 pd_id bigint unsigned not null,
27 win int(1) not null,
28 amount bigint not null,
29 target varchar(6) not null,
30 profit bigint not null,
31 `condition` varchar(1) not null,
32 roll varchar(6) not null,
33 client varchar(255) not null,
34 player varchar(255) not null,
35 `time` varchar(30) not null,
36 `round_bet_n` int unsigned not null
37 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
38 $conn->query($sql);
39 if($conn->error) die('Bet history table failed to create. Create it manually or delete this instance and try again :| .' . $conn->error);
40}
41
42$sql = "SELECT * FROM settings WHERE id='$instance' LIMIT 1";
43$result = $conn->query($sql);
44
45if($result->num_rows > 0)
46{
47 $row = $result->fetch_assoc();
48 $settings = $row;
49}
50
51// extract instances
52$sql = "SELECT id FROM settings";
53$result = $conn->query($sql);
54$instances = $result->num_rows;
55?>
56
57
58<!DOCTYPE html>
59<html>
60 <head>
61 <!-- jquery -->
62 <script src="https://code.jquery.com/jquery-3.1.1.min.js"
63 integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
64 crossorigin="anonymous"></script>
65
66 <!-- Latest compiled and minified CSS -->
67 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
68
69 <!-- Optional theme -->
70 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
71
72 <!-- Latest compiled and minified JavaScript -->
73 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
74
75 <link rel="stylesheet" href="/node_modules/toastr/build/toastr.min.css">
76 </head>
77
78 <body>
79 <div class="row main">
80
81 <div class="col-xs-1"></div>
82 <div class="col-xs-10">
83 <h1 class="text-center">MultiLoginBot (or something)</h1>
84 <hr/>
85 <div class="row">
86 <div class="col-xs-2"></div>
87 <div class="col-xs-8 well">
88 <h3>Instances</h3>
89 <p>
90 <?php for($i = 1; $i<=$instances; $i++){
91 if($instance == $i)
92 {
93 echo "<a href='?i=$i' style='font-size:30px; color:red'>$i</a> ";
94 }
95 else {
96 echo "<a href='?i=$i'>$i</a> ";
97 }
98 } ?>
99 </p>
100 <hr/>
101 <form method="post" class="form-instance">
102 <input type="submit" name="new_instance" value="Add new instance" class="btn btn-success btn-md">
103 </form>
104 </div>
105 </div>
106 <div class="row">
107 <div class="col-sm-1"></div>
108 <div class="col-sm-5">
109 <div class="col-sm-12 well">
110 <h3>Limiters</h3>
111 <form method="post" class="form-limits">
112 <div class="form-group">
113 <label>Maximum number of bets</label>
114 <input type="text" name="max" class="form-control" value=<?php echo $settings['max']; ?>>
115 </div>
116 <div class="form-group">
117 <label>Minimum balance</label>
118 <input type="text" class="form-control" name="min_balance" value=<?php echo number_format($settings['min_balance'] / 100000000, 8); ?>>
119 </div>
120 <div class="form-group">
121 <label>Maximum balance</label>
122 <input type="text" name="max_balance" class="form-control" value=<?php echo number_format($settings['max_balance'] / 100000000, 8); ?>>
123 </div>
124 <div class="form-group">
125 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
126 <input type="submit" name="limiters" class="btn btn-primary">
127 </div>
128 </form>
129 </div>
130 </div>
131
132 <div class="col-sm-5">
133 <div class="col-sm-12 well">
134 <h3>Taking profit</h3>
135 <form method="post" class="form-profit">
136 <div class="form-group">
137 <label>Starting balance</label>
138 <input type="text" name="start_balance" class="form-control" value=<?php echo number_format($settings['start_balance'] / 100000000, 8); ?>>
139 </div>
140 <div class="form-group">
141 <label>Withdrawal Threshold</label>
142 <input type="text" name="thresh" class="form-control" value=<?php echo number_format($settings['thresh'] / 100000000, 8); ?>>
143 </div>
144 <div class="form-group">
145 <label>Withdrawal address</label>
146 <input type="text" name="w_address" class="form-control" value=<?php echo $settings['address']; ?>>
147 </div>
148 <div class="form-group">
149 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
150 <input type="submit" class="btn btn-primary">
151 </div>
152 </form>
153 </div>
154 </div>
155 </div>
156
157 <div class="row">
158 <div class="col-sm-1"></div>
159 <div class="col-sm-5">
160 <div class="col-sm-12 well">
161 <h3>Bets</h3>
162 <form method="post" class="form-bet">
163 <div class="form-group">
164 <label>Initial Bet</label>
165 <input type="text" name="initial" class="form-control" value=<?php echo number_format($settings['initial'] / 100000000, 8); ?>>
166 </div>
167 <div class="form-group">
168 <label>Base Bet</label>
169 <input type="text" name="base" class="form-control" value=<?php echo number_format($settings['base'] / 100000000, 8); ?>>
170 </div>
171 <div class="form-group">
172 <label>Reset on win</label>
173 <input type="checkbox" name="resetwin" <?php echo $settings['resetwin'] ? 'checked': ''; ?>>
174 <label>Reset on loose</label>
175 <input type="checkbox" name="resetloose" <?php echo $settings['resetloose'] ? 'checked': ''; ?>>
176 <hr/>
177 <label>Stop ONLY at base bet</label>
178 <input type="checkbox" name="stopbase" <?php echo $settings['stopbase'] ? 'checked': ''; ?>>
179 </div>
180 <div class="form-group">
181 <label>Increase bet on win (%)</label>
182 <input type="text" name="increasewin" class="form-control" value=<?php echo $settings['increasewin'] * 100; ?>>
183 </div>
184 <div class="form-group">
185 <label>Increase bet on loose (%)</label>
186 <input type="text" name="increaseloose" class="form-control" value=<?php echo $settings['increaseloose'] * 100; ?>>
187 </div>
188 <div class="form-group">
189 <label>Max. Bet size</label>
190 <input type="text" name="maxsize" class="form-control" value=<?php echo number_format($settings['maxsize'] / 100000000, 8); ?>>
191 </div>
192 <div class="form-group">
193 <label>Bet target (the number, from 0.00 to 99.99)</label>
194 <input type="text" name="chances" class="form-control" value=<?php echo $settings['chances']; ?>>
195 </div>
196 <div class="form-group">
197 <label>Condition (> or <)</label>
198 <input type="text" class="form-control" name="condition" value=<?php echo $settings['condition']; ?>>
199 </div>
200 <div class="form-group">
201 <label>Return to base bet after x losses in a row (x)</label>
202 <input type="text" name="xlosses" class="form-control" value=<?php echo $settings['xlosses']; ?>>
203 </div>
204 <div class="form-group">
205 <label>Change seed every:</label><small>For primedice there should pass some time between changes</small>
206 <input type="text" class="form-control" name="seed" value=<?php echo $settings['change_seed']; ?>>
207 </div>
208 <div class="form-group">
209 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
210 <input type="submit" name="heeh" class="btn btn-primary">
211 </div>
212 </form>
213 </div>
214 </div>
215
216 <div class="col-sm-5">
217 <div class="col-sm-12 well">
218 <h3>Users (hehe)</h3>
219 <form method="post" class="form-users">
220 <div class="form-group">
221 <label>All accounts</label>
222 <small>Well, for primedice this should be apikeys :)</small>
223 <br/>
224 <small>Format is <i>apikey1;apikey2;apikey3;apikey4;...</i></small>
225 <textarea class="form-control" name="keys"><?php echo $settings['keys']; ?></textarea>
226 </div>
227 <hr/>
228 <div class="form-group">
229 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
230 <input type="submit" class="btn btn-primary">
231 </div>
232 </form>
233 <div class="form-group">
234 <label>Recently used</label>
235 <textarea class="form-control" style="height:200px"><?php echo $recentkeys; ?></textarea>
236 </div>
237 </div>
238 </div>
239 </div>
240 <hr/>
241 <div class="row">
242 <form method=post class="form-test">
243 <div class="form-group text-center">
244 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
245 <input type="submit" name="fave" class="btn btn-warning btn-lg" value="TEST" style="width:60%; height:100px">
246 </div>
247 </form>
248 </div>
249 <hr/>
250 <div class="row">
251 <form method="post" class="form-start">
252 <div class="form-group text-center">
253 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
254 <input type="submit" class="btn btn-danger btn-lg" value="RUN" style="width:60%; height:100px">
255 </div>
256 </form>
257 </div>
258 <hr/>
259 <div class="row">
260 <form method="post" class="form-stop">
261 <div class="form-group text-center">
262 <input type="hidden" name="instance" value="<?php echo $instance; ?>">
263 <input type="submit" class="btn btn-success btn-lg" value="STOP" style="width:60%; height:100px">
264 </div>
265 </form>
266 </div>
267 </div>
268 <div class="col-xs-1"></div>
269
270 <hr/>
271 <!--
272 <div class="row">
273 <div class="col-xs-1"></div>
274 <div class="col-xs-10">
275 <div class="highlight">
276 <pre>
277
278 </pre>
279 </div>
280 </div>
281 </div>
282 -->
283 <script src="/node_modules/toastr/toastr.js"></script>
284 <script>
285 $('.form-limits').submit(function() {
286 var serialize = $(this).serialize();
287 $.post('/ajax.php', "action=limits&" + serialize, function(data) {
288 data = $.parseJSON(data);
289 if (data.status == "success") {
290 alertSuccess('Success', 'Settings updated');
291 } else if (data.status == "redirect") {
292 window.location = data.redirect;
293 } else if (data.status == "error") {
294 alertError('Error encountered', data.error);
295 } else {
296 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
297 }
298 });
299 return false;
300 });
301
302 $('.form-users').submit(function() {
303 var serialize = $(this).serialize();
304 $.post('/ajax.php', "action=users&" + serialize, function(data) {
305 data = $.parseJSON(data);
306 if (data.status == "success") {
307 alertSuccess('Success', 'Settings updated');
308 } else if (data.status == "redirect") {
309 window.location = data.redirect;
310 } else if (data.status == "error") {
311 alertError('Error encountered', data.error);
312 } else {
313 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
314 }
315 });
316 return false;
317 });
318
319 $('.form-bet').submit(function() {
320 var serialize = $(this).serialize();
321 $.post('/ajax.php', "action=bet&" + serialize, function(data) {
322 data = $.parseJSON(data);
323 if (data.status == "success") {
324 alertSuccess('Success', 'Settings updated');
325 } else if (data.status == "redirect") {
326 window.location = data.redirect;
327 } else if (data.status == "error") {
328 alertError('Error encountered', data.error);
329 } else {
330 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
331 }
332 });
333 return false;
334 });
335
336 $('.form-profit').submit(function() {
337 var serialize = $(this).serialize();
338 $.post('/ajax.php', "action=profit&" + serialize, function(data) {
339 data = $.parseJSON(data);
340 if (data.status == "success") {
341 alertSuccess('Success', 'Settings updated');
342 } else if (data.status == "redirect") {
343 window.location = data.redirect;
344 } else if (data.status == "error") {
345 alertError('Error encountered', data.error);
346 } else {
347 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
348 }
349 });
350 return false;
351 });
352
353 $('.form-test').submit(function() {
354 var serialize = $(this).serialize();
355 $.post('/ajax.php', "action=test&" + serialize, function(data) {
356 data = $.parseJSON(data);
357 if (data.status == "success") {
358 alertSuccess('Success', 'It seems that it is all good :D RUN');
359 } else if (data.status == "redirect") {
360 window.location = data.redirect;
361 } else if (data.status == "error") {
362 alertError('Error encountered', data.error);
363 } else {
364 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
365 }
366 });
367 return false;
368 });
369
370 $('.form-start').submit(function() {
371 var serialize = $(this).serialize();
372 $.post('/ajax.php', "action=start&" + serialize, function(data) {
373 data = $.parseJSON(data);
374 if (data.status == "success") {
375 alertSuccess('Success', 'I am running hehe :D');
376 } else if (data.status == "redirect") {
377 window.location = data.redirect;
378 } else if (data.status == "error") {
379 alertError('Error encountered', data.error);
380 } else {
381 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
382 }
383 });
384 return false;
385 });
386
387 $('.form-stop').submit(function() {
388 var serialize = $(this).serialize();
389 $.post('/ajax.php', "action=stop&" + serialize, function(data) {
390 data = $.parseJSON(data);
391 if (data.status == "success") {
392 alertSuccess('Success', 'Bot stopped');
393 } else if (data.status == "redirect") {
394 window.location = data.redirect;
395 } else if (data.status == "error") {
396 alertError('Error encountered', data.error);
397 } else {
398 alertError('Unknown error', 'An unknown error occurred. Try refreshing the page.');
399 }
400 });
401 return false;
402 });
403
404 toastr.options = {
405 "closeButton": true,
406 "debug": false,
407 "newestOnTop": true,
408 "progressBar": true,
409 "positionClass": "toast-bottom-right",
410 "preventDuplicates": false,
411 "onclick": null,
412 "showDuration": "300",
413 "hideDuration": "1000",
414 "timeOut": "10000",
415 "extendedTimeOut": "1000",
416 "showEasing": "swing",
417 "hideEasing": "linear",
418 "showMethod": "fadeIn",
419 "hideMethod": "fadeOut"
420 }
421
422 function alertSuccess(title, message) {
423 toastr["success"](message, title);
424 }
425
426 function alertInfo(title, message) {
427 toastr["info"](message, title)
428 }
429
430 function alertWarning(title, message) {
431 toastr["warning"](message, title)
432 }
433
434 function alertError(title, message) {
435 toastr["error"](message, title)
436 }
437 </script>
438
439 </div>
440 </body>
441</html>