Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. <?php
  2. $dbhost="localhost";
  3. $dbuser="trench_twlm";
  4. $dbpassword="4nZ0Ki8Xop";
  5. $database="trench_TrenchWars";
  6.  
  7. $dbx1 = mysql_connect($dbhost, $dbuser, $dbpassword);
  8. mysql_select_db($database, $dbx1);
  9.  
  10. //Check if TWLM is locked
  11. $query = "SELECT * FROM `tblTWL__SiteVars` WHERE `fnID`=3";
  12. $result = mysql_query($query, $dbx1) or die(mysql_error());
  13. $row = mysql_fetch_array($result);
  14. $islocked = $row['fcVarData'];
  15. if($islocked=="False")
  16. {
  17.  
  18. }else
  19. {
  20. echo "<P STYLE='font-size: 12px; font-weight: bold; padding-bottom: 2px; color: rgb(255, 204, 0);'>TWLM is locked!</P>";
  21. die();
  22. }
  23.  
  24.  
  25.  
  26. $stake = $_POST['stake'];
  27. $userid = $_POST['userid'];
  28. $matchid = $_POST['matchid'];
  29. $odds = $_POST['odds'];
  30. $market = $_POST['market'];
  31. $backing = $_POST['backing'];
  32. //Display cash
  33. $query = "SELECT * FROM `tblTWL__TWLManagers` WHERE `fnUserId` = '$user'";
  34. $result = mysql_query($query, $dbx1) or die(mysql_error());
  35. $row = mysql_fetch_array($result);
  36. $cash = $row['fnCash'];
  37.  
  38. if($cash < $stake))
  39. {
  40. 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>";
  41. die();
  42. }
  43.  
  44. //Make bet.
  45. $qry = "INSERT INTO `trench_TrenchWars`.`tblTWL__Bet` (`fnBetID` ,`fnMatchID` ,`fnUserId` ,`fnMarket` ,`fnBacking` ,`fnOdds` ,`fnStake` ,`fnResult`) VALUES (NULL , '$matchid', '$userid', '$market', '$backing', '$odds', '$stake', '0')";
  46. $result = mysql_query($qry, $dbx1) or die(mysql_error());
  47.  
  48. //Update managers cash.
  49. $qry = "UPDATE tblTWL__TWLManagers SET fnCash = fnCash - $stake WHERE `fnUserId` = '$userid'";
  50. $result = mysql_query($qry, $dbx1) or die(mysql_error());
  51. mysql_close($dbx1);
  52. echo "<P STYLE='font-size: 12px; font-weight: bold; padding-bottom: 2px; color: rgb(255, 204, 0);'>Bet placed.</P>";
  53. die();
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement