Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost="localhost";
- $dbuser="trench_twlm";
- $dbpassword="4nZ0Ki8Xop";
- $database="trench_TrenchWars";
- $dbx1 = mysql_connect($dbhost, $dbuser, $dbpassword);
- mysql_select_db($database, $dbx1);
- //Check if TWLM is locked
- $query = "SELECT * FROM `tblTWL__SiteVars` WHERE `fnID`=3";
- $result = mysql_query($query, $dbx1) or die(mysql_error());
- $row = mysql_fetch_array($result);
- $islocked = $row['fcVarData'];
- if($islocked=="False")
- {
- }else
- {
- echo "<P STYLE='font-size: 12px; font-weight: bold; padding-bottom: 2px; color: rgb(255, 204, 0);'>TWLM is locked!</P>";
- die();
- }
- $stake = $_POST['stake'];
- $userid = $_POST['userid'];
- $matchid = $_POST['matchid'];
- $odds = $_POST['odds'];
- $market = $_POST['market'];
- $backing = $_POST['backing'];
- //Display cash
- $query = "SELECT * FROM `tblTWL__TWLManagers` WHERE `fnUserId` = '$user'";
- $result = mysql_query($query, $dbx1) or die(mysql_error());
- $row = mysql_fetch_array($result);
- $cash = $row['fnCash'];
- if($cash < $stake))
- {
- echo "<P STYLE='font-size: 12px; font-weight: bold; padding-bottom: 2px; color: rgb(255, 204, 0);'>You don't have the funds to place this bet!</P>";
- die();
- }
- //Make bet.
- $qry = "INSERT INTO `trench_TrenchWars`.`tblTWL__Bet` (`fnBetID` ,`fnMatchID` ,`fnUserId` ,`fnMarket` ,`fnBacking` ,`fnOdds` ,`fnStake` ,`fnResult`) VALUES (NULL , '$matchid', '$userid', '$market', '$backing', '$odds', '$stake', '0')";
- $result = mysql_query($qry, $dbx1) or die(mysql_error());
- //Update managers cash.
- $qry = "UPDATE tblTWL__TWLManagers SET fnCash = fnCash - $stake WHERE `fnUserId` = '$userid'";
- $result = mysql_query($qry, $dbx1) or die(mysql_error());
- mysql_close($dbx1);
- echo "<P STYLE='font-size: 12px; font-weight: bold; padding-bottom: 2px; color: rgb(255, 204, 0);'>Bet placed.</P>";
- die();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement