forked from jd5688/online-sports-betting
-
Notifications
You must be signed in to change notification settings - Fork 1
/
addbet.php
46 lines (36 loc) · 1.25 KB
/
addbet.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
<?php
session_start();
if (!$_SESSION['user_id']) { exit; }
require_once("../include/config.php");
require_once($basedir . "/include/functions.php");
$private_key = $config['private_key'];
$hash = (isset($_POST['hash'])) ? $_POST['hash'] : 0;
$public_key = (isset($_POST['public'])) ? $_POST['public'] : 0;
$time = (isset($_POST['t'])) ? $_POST['t'] : 0;
$myhash = md5($public_key . $private_key . $time);
if ($hash != $myhash) {
echo json_encode(array('error' => '1', 'status' => $lang[215]));
exit;
}
$bool = false;
$bet_item = (isset($_POST['item'])) ? $_POST['item'] : '';
$bet_amount = (isset($_POST['bet'])) ? $_POST['bet'] : '';
//$bet_notify = (isset($_POST['notify'])) ? $_POST['notify'] : '';
$bet_notify = 0; // for historical purposes. this is no longer being used
$is_trial = (isset($_POST['istrial'])) ? $_POST['istrial'] : 0;
$game_id = (isset($_POST['game_id'])) ? $_POST['game_id'] : '';
// make sure these have value
if (!$bet_item OR !$bet_amount OR !$game_id) {
if (!$bet_amount AND $is_trial) {
// do nothing
} else {
exit;
}
}
if (!is_numeric($bet_amount)) { exit; }
$bool = addBet($_SESSION['user_id'], $game_id, $bet_item, $bet_amount, $bet_notify);
if ($bool) {
echo json_encode(array('error' => '0', 'status' => 'success'));
exit;
}
?>