modernmafia Posted July 27, 2012 Posted July 27, 2012 i have a problem sometimes when i bet, it gives me a card but does not count it towards the actually game. for example, if i have a 5 a 6 and a king, the king wont count so I will have 11 not 21 can any one see below on my codes whats wrong or why it does this <?php session_start(); include "includes/db_connect.php"; include "includes/functions.php"; if ($info->last_script_check < time()){ include_once "probe.php"; } logincheck(); $playersusername = $_SESSION['username']; $username = $_SESSION['username']; $fetch= mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'")); $ding_dong1=mysql_fetch_object(mysql_query("SELECT * FROM bj WHERE location='$fetch->location'")); if($ding_dong1->bjowner == "0" || $ding_dong1->bjowner == ""){ ?></p> <link rel=stylesheet href=style.css type=text/css> <form name="form1" method="post" action=""> <table width="40%" border="0" align="center" cellpadding="0" cellspacing="0" class="table"> <tr><td height="30" align="center" class="header">BlackJack Unowned - <a href='?price' class="hover" title="<center>To Purchase This BlackJack It Will Cost You £5,000,000!">Price?</a></td></tr> <tr > <td align="center">The BlackJack Located In <b><?php echo "$fetch->location"; ?></b> Are Not Owned By Anyone!<br /> <br /> <input name="buyrps" id="buyrps" type="submit" class="button" value="Purchase" /> <br /> <br /> <br /> <?php if($_POST['buyrps']){ if($fetch->money < 5000000){ echo "You have not got £5,000,000 to pay for the BlackJack."; }elseif($fetch->money > 5000000 && $ding_dong1->bjowner == "0"){ $moneyless = $sitestats->factoryprice; mysql_query("UPDATE users SET money=money-5000000 WHERE username='$username'"); mysql_query("UPDATE bj SET bjowner='$username' WHERE location='$fetch->location'"); echo "You now own the BlackJack located in $fetch->location."; }} ?> </td> </tr> </table> </form> <?php }else{ ?> <?php $time = time(); echo "$style"; ?> <? if($info->bettingban=='1'){ die("<center><h3><font colour='FFFFFF'>You Have Been Banned From This Page</h3></center>"); } $fetch=mysql_fetch_object(mysql_query("SELECT username,location FROM users WHERE username='$username'")); echo " <link href=style.css rel=stylesheet type=text/css> "; $username = $_SESSION['username']; $self = "blackjack.php"; //***get info $result = mysql_query("SELECT money, location FROM users WHERE username='$username'"); while ($info = mysql_fetch_row($result)) { $pmoney = $info[0]; $currentmoney = $info[0]; $state = $info[1]; $location= $info[1]; $bj = $info[2]; } ///// $ding_dong=mysql_fetch_object(mysql_query("SELECT bjowner FROM bj WHERE location ='$fetch->location'")); $ding_dong1=mysql_fetch_object(mysql_query("SELECT * FROM bj WHERE location ='$fetch->location'")); $fat_****=mysql_fetch_object(mysql_query("SELECT username,status FROM users WHERE username='$ding_dong->bjowner'")); ///// if($fat_****->status == 'Dead' || $fat_****->status == 'Banned'){ mysql_query("UPDATE bj SET bjowner='0' WHERE location='$location'"); print "<font color=white>This table has no owner!"; exit(); } if(!$_SESSION['con']){ $_SESSION['con']=$state; }elseif($_SESSION['con']!=$state){ echo "<center><font color=red><b>You flew and lost your cards!<BR>"; unset($_SESSION['deck'],$_SESSION['card1'],$_SESSION['color1'],$_SESSION['card2'],$_SESSION['card3'],$_SESSION['color3'],$_SESSION['card4'],$_SESSION['color4'],$_SESSION['card5'],$_SESSION['color5'],$_SESSION['card6'],$_SESSION['color6'],$_SESSION['dcard1'],$_SESSION['dcard2'],$_SESSION['dcard3'],$_SESSION['dcard4'],$_SESSION['con']); } $result = mysql_query("SELECT bjmaxbet, bjminbet, bjowner , bjearnings FROM bj WHERE location='$fetch->location'"); while ($info = mysql_fetch_row($result)) { $bjowner = $info[2]; $max = $info[0]; $earn = $info[3]; $bjmaxbet = $info[0]; $bjminbid = $info[1]; $totalearnings = $info[3]; $bjowner = $info[2]; } $result = mysql_query("SELECT id, money FROM users WHERE username='$bjowner'"); while ($info = mysql_fetch_row($result)) { $oid = $info[0]; $omoney = $info[1]; $otmoney = $info[1]; } if($bjowner == "None"){ echo "<font color=white>No owner"; exit(); } $offer = $_POST['offer']; $ownerstuff = mysql_query("SELECT money, id, status FROM users WHERE username='$bjowner'"); while($ownerstats = mysql_fetch_row($ownerstuff)){ $ownerscurrentmoney = $ownerstats[0]; $otmoney = $ownerstats[0]; $ownerid = $ownerstats[1]; $abd = $ownerstats[2]; } if($offer != ""){ if($offer < 0){ echo "<font color=white>You can't go below 0!"; } elseif($offer > 2147483647){ echo "<font color=white>Your offer is to high!"; } elseif(ereg("[^[:digit:]]", $offer)) { echo "<font color=white>Bad amount!"; } elseif($username == $bjowner){ echo "<font color=white>You can't make an offer to yourself!"; } elseif($offer > $currentmoney){ echo "<font color=white>You dont have that much money!"; } else { echo "You have made an offer to take over that blackjack!"; mysql_query("INSERT INTO `offers` ( `id` , `username` , `owner` , `offer` , `casino`, `location` ) VALUES ('', '$username', '$bjowner', '$offer', 'Blackjack', '$location');"); } } if($_POST['adeal']){ $yid = $_POST['yes']; $nid = $_POST['no']; if($yid != ""){ $ow = mysql_query("SELECT * FROM offers WHERE id='$yid'"); while($o = mysql_fetch_row($ow)){ $offerer = $o[1]; $bjowner = $o[2]; $moffer = $o[3]; $location = $o[5]; $casino = $o[4]; } $cost = mysql_query("SELECT money FROM users WHERE username='$offerer'"); while($money = mysql_fetch_row($cost)){ $oumoney = $money[0]; } if($oumoney < $moffer){ echo "<font color=white>That user no longer has enough money!"; } elseif($offerer == $username){ echo "<font color=white>You cant accept your own offer!"; } elseif($bjowner != $username){ echo "<font color=white>Thats not your blackjack!"; } else { mysql_query("UPDATE bj SET bjowner='$offerer' WHERE location='$location'"); $newownmoney = $currentmoney + $moffer; $newusemoney = $oumoney - $moffer; $message = "<font color=white>Your offer was <b>accepted</b> by <b>$bjowner</b> for the $location $casino for the price of $$moffer"; mysql_query("INSERT INTO `inbox` (`id`, `to`, `from`, `date`, `text`) VALUES ('', '$offerer', 'BlackJack Ownership', NOW(), '$message');"); mysql_query("UPDATE users SET money='$newownmoney' WHERE username='$username'"); mysql_query("UPDATE users SET money='$newusemoney' WHERE username='$offerer'"); mysql_query("DELETE FROM offers WHERE location='$location', bjmaxbet='100' AND casino='$casino'"); echo "<font color=white>You have accepted that offer!"; exit(); } } else { $ow = mysql_query("SELECT * FROM offers WHERE id='$nid'"); while($o = mysql_fetch_row($ow)){ $offerer = $o[1]; $bjowner = $o[2]; $moffer = $o[3]; $location = $o[5]; $casino = $o[4]; } $message = "Your offer was <b>declined</b> by <b>$bjowner</b> for $location $casino for the price of $$moffer"; mysql_query("INSERT INTO `inbox` (`id`, `to`, `from`, `date`, `text`) VALUES ('', '$offerer', 'Location Ownership', NOW(), '$message');"); mysql_query("DELETE FROM offers WHERE id='$nid'"); echo "<font color=white>You declined that offer!"; } } //see if person owns table if ($bjowner == $playersusername){ if ($_POST['newmaxbet']){ $newmaxbet = $_POST['newmaxbet']; if ($newmaxbet < 5000000){ echo "<center><font color=red><b>Max must be atleast £5,000,000 or above!"; //in exit(); }elseif ($newmaxbet > 10000000000){ echo "<center><font color=red><b>Max must be less then £10,000,000,000!"; //in exit(); }elseif(ereg("[^[:digit:]]", $newmaxbet)){ echo "<center><font color=white><b>Max bet must only contain numbers!"; //in exit(); }else{ mysql_query("UPDATE bj SET bjmaxbet='$newmaxbet' WHERE bjowner='$username' AND location='$location'"); echo "<center><font color=green><b>Your maxbet has been updated to £$newmaxbet"; } } if ($_POST['newminbid']){ $newminbid = $_POST['newminbid']; if ($newminbid < 100){ echo "<center><font color=red><b>Minimum bet must be atleast £100 or above!"; //in exit(); } if(ereg("[^[:digit:]]", $newminbid)){ echo "<font color=white>Minimum bet must only contain numbers!"; //in exit(); }elseif(!ereg("[^[:digit:]]", $newminbid)){ mysql_query("UPDATE bj SET bjminbet='$newminbid' WHERE bjowner='$username' AND location='$location'"); } echo "<center><font color=green><b>Minimum bet has been updated to £$newminbid!"; } if ($_POST['givetouser']){ $givetouser = $_POST['givetouser']; $checkgiveto = mysql_query("SELECT username FROM users WHERE username='$givetouser'"); $checkifexist = mysql_num_rows($checkgiveto); if($checkifexist <= 0){ echo "<center><font color=white><b>That user does not exist!"; //in exit(); }else{ while($giver = mysql_fetch_row($checkgiveto)){ $givetouser = $giver[0]; } $date = gmdate('Y-m-d h:i:s'); mysql_query("INSERT INTO `propsend` ( `id` , `type` , `location` , `usernamefrom` , `usernameto` , `date` ) VALUES ('', 'Blackjack', '$location', '$username', '$givetouser', '$date')"); mysql_query("UPDATE bj SET bjmaxbet='2500' WHERE bjowner='$username' AND location='$location'"); mysql_query("UPDATE bj SET bjowner='$givetouser' WHERE bjowner='$username' AND location='$location'"); echo "<center><font color=white><b>You gave $givetouser the Blackjack!"; } } if (strip_tags($_POST['drop']) == "Yes"){ mysql_query("UPDATE bj SET bjmaxbet='2500' WHERE bjowner='$username' AND location='$location'"); mysql_query("UPDATE bj SET bjowner='0', bjearnings='0' WHERE bjowner='$username' AND location='$location'"); echo"Dropped!"; exit(); } echo "<form method=post action=$self> <table width=300 align=center border=0 cellpadding=0 cellspacing=0 class=table> <tr class=header> <td colspan=4> Blackjack CP</td> </tr> <tr> <td width=130>Total Earnings: </td> <td width=148 colspan=3>£"; echo number_format($totalearnings); echo "</td> </tr> <tr> <td>Max Bet: </td> <td width=148 colspan=3><input name=newmaxbet type=text id=maxbet class=textbox1></td> </tr> <tr> <td>Current Max: </td> <td colspan=3>£"; echo number_format($bjmaxbet); echo "</td> </tr> <tr> <td>Drop:</td> <td><select name=drop id=drop class=\"textbox1\" style=\"width: 60px;\"> <option value=\"No\">No</option> <option value=\"Yes\">Yes</option> </select></td> </tr> <tr> <td>Give to: </td> <td colspan=3><input name=givetouser type=text id=giveto class=textbox1></td> </tr> <tr> <td> </td> <td colspan=4 align=center><input type=submit name=Submit value=Update class=button></td> </tr> </table><br> </form> "; //in exit(); } $suc = 1; if (isset($_POST['bett'])){ $bettt = strip_tags($_POST['bett']); $now = $bj + 60; if(time() < $now){ echo "<font color=white>You started a blackjack game and never finished you must wait a minuite to start another!"; exit(); }elseif(ereg("[^[:digit:]]", $bettt)) { echo "<font color=white>Bet amount can only contain numbers!"; $suc = 2; unset($_SESSION['bet']); }elseif($bettt > $pmoney){ echo "<font color=white>You dont have enough money!"; $suc = 2; unset($_SESSION['bet']); }elseif($bettt > 1000000000){ echo "<font color=white>Maximum is 1 billion!"; exit(); }elseif($bettt > $max) { echo "<font color=white>The current max is £$max!"; $suc = 2; unset($_SESSION['bet']); }else{ $_SESSION['bet'] = $bettt; $money = $pmoney - $bettt; mysql_query("UPDATE users SET money='$money', bj='$time' WHERE username='$username'"); $_SESSION['show'] = "show me"; unset($_SESSION['deck'],$_SESSION['card1'],$_SESSION['color1'],$_SESSION['card2'],$_SESSION['card3'],$_SESSION['color3'],$_SESSION['card4'],$_SESSION['color4'],$_SESSION['card5'],$_SESSION['color5'],$_SESSION['card6'],$_SESSION['color6'],$_SESSION['dcard1'],$_SESSION['dcard2'],$_SESSION['dcard3'],$_SESSION['dcard4']); } } $bet = $_SESSION['bet']; //****check if they want to hit if ((isset($_POST['hit'])) && (!isset($_POST['stand'])) && (isset($_SESSION['bet']))){ $deckk = $_SESSION['deck']; if (isset($_SESSION['card6'])){ }else{ $ex = "6"; } if (isset($_SESSION['card5'])){ }else{ $ex = "5"; } if (isset($_SESSION['card4'])){ }else{ $ex = "4"; } if (isset($_SESSION['card3'])){ }else{ $ex = "3"; } if ($ex == 3){ $card3 = explode("-", $deckk[2]); $color3 = $card3[1]; $card3 = $card3[0]; if ($color3 == "h"){$color3 = 'heart';} if ($color3 == "d"){$color3 = 'diamond';} if ($color3 == "s"){$color3 = 'spade';} if ($color3 == "c"){$color3 = 'club';} $_SESSION['card3'] = $card3; $_SESSION['color3'] = $color3; } if ($ex == 4){ $card4 = explode("-", $deckk[3]); $color4 = $card4[1]; $card4 = $card4[0]; if ($color4 == "h"){$color4 = 'heart';} if ($color4 == "d"){$color4 = 'diamond';} if ($color4 == "c"){$color4 = 'club';} if ($color4 == "s"){$color4 = 'spade';} $_SESSION['card4'] = $card4; $_SESSION['color4'] = $color4; } if ($ex == 5){ $card5 = explode("-", $deckk[4]); $color5 = $card5[1]; $card5 = $card5[0]; if ($color5 == "h"){$color5 = 'heart';} if ($color5 == "d"){$color5 = 'diamond';} if ($color5 == "c"){$color5 = 'club';} if ($color5 == "s"){$color5 = 'spade';} $_SESSION['card5'] = $card5; $_SESSION['color5'] = $color5; } if ($ex == 6){ $card6 = explode("-", $deckk[5]); $color6 = $card6[1]; $card6 = $card6[0]; if ($color6 == "h"){$color6 = 'heart';} if ($color6 == "d"){$color6 = 'diamond';} if ($color6 == "c"){$color6 = 'club';} if ($color6 == "s"){$color6 = 'spade';} $_SESSION['card6'] = $card6; $_SESSION['color6'] = $color6; } } //*****see if they stand if ((isset($_POST['stand'])) && (!isset($_POST['hit'])) && (isset($_SESSION['bet']))){ $bet = $_SESSION['bet']; $dcardd1 = $_SESSION['dcard1']; $dcardd2 = $_SESSION['dcard2']; if (($dcardd1 == 13) || ($dcardd1 == 12) || ($dcardd1 == 11)){ $dcardd1 = 10; } if ($dcardd1 == 14){ $dcardd1 = 11; } if (($dcardd2 == 13) || ($dcardd2 == 12) || ($dcardd2 == 11)){ $dcardd2 = 10; } if ($dcardd2 == 14){ $dcardd2 = 11; } $dtotal = $dcardd1 + $dcardd2; if (($dtotal > 21) && ($dcardd1 == 11)){ $dcardd1 = 1; $dtotal = $dtotal - 11; $dtotal = $dtotal + $dcardd1; } if (($dtotal > 21) && ($dcardd2 == 11)){ $dcardd2 = 1; $dtotal = $dtotal - 11; $dtotal = $dtotal + $dcardd2; } $dtotal = $dcardd1 + $dcardd2; if ($dtotal <= 16){ $deckk = $_SESSION['deck']; $dcard3 = explode("-", $deckk[49]); $dcolor3 = $dcard3[1]; $dcard3 = $dcard3[0]; if ($dcolor3 == "h"){$dcolor3 = 'heart';} if ($dcolor3 == "d"){$dcolor3 = 'diamond';} if ($dcolor3 == "c"){$dcolor3 = 'club';} if ($dcolor3 == "s"){$dcolor3 = 'spade';} $_SESSION['dcard3'] = $dcard3; $_SESSION['dcolor3'] = $dcolor3; $dcardd3 = $dcard3; if (($dcardd3 == 13) OR ($dcardd3 == 12) OR ($dcardd3 == 11)){ $dcardd3 = 10; } if ($dcardd3 == 14){ $dcardd3 = 11; } $dtotal = $dtotal + $dcardd3; if (($dtotal > 21) && ($dcardd3 == 11)){ $dcardd3 = 1; $dtotal = $dtotal - 11; $dtotal = $dtotal + $dcardd3; } } if (($dtotal <= 16) && (isset($_SESSION['dcard3']))){ $deckk = $_SESSION['deck']; $dcard4 = explode("-", $deckk[48]); $dcolor4 = $dcard4[1]; $dcard4 = $dcard4[0]; if ($dcolor4 == "h"){$dcolor4 = 'heart';} if ($dcolor4 == "d"){$dcolor4 = 'diamond';} if ($dcolor4 == "c"){$dcolor4 = 'club';} if ($dcolor4 == "s"){$dcolor4 = 'spade';} $_SESSION['dcard4'] = $dcard4; $_SESSION['dcolor4'] = $dcolor4; $dcardd4 = $dcard4; if (($dcardd4 == 13) OR ($dcardd4 == 12) OR ($dcardd4 == 11)){ $dcardd4 = 10; } if ($dcardd4 == 14){ $dcardd4 = 11; } $dtotal = $dtotal + $dcardd4; if (($dtotal > 21) && ($cardd4 == 11)){ $dcardd4 = 1; $dtotal = $dtotal - 11; $dtotal = $dtotal + $dcardd4; } } $cardd1 = $_SESSION['card1']; $cardd2 = $_SESSION['card2']; $cardd3 = $_SESSION['card3']; $cardd4 = $_SESSION['card4']; $cardd5 = $_SESSION['card5']; $cardd6 = $_SESSION['card6']; if (($cardd1 == 13) || ($cardd1 == 12) || ($cardd1 == 11)){ $cardd1 = 10; } if ($cardd1 == 14){ $cardd1 = 11; } if (($cardd2 == 13) || ($cardd2 == 12) || ($cardd2 == 11)){ $cardd2 = 10; } if ($cardd2 == 14){ $cardd2 = 11; } if (isset($_SESSION['card3'])){ if (($cardd3 == 13) || ($cardd3 == 12) || ($cardd3 == 11)){ $cardd3 = 10; } if ($cardd3 == 14){ $cardd3 = 11; } } if (isset($_SESSION['card4'])){ if (($cardd4 == 13) || ($cardd4 == 12) || ($cardd4 == 11)){ $cardd4 = 10; } if ($cardd4 == 14){ $cardd4 = 11; } } if (isset($_SESSION['card5'])){ if (($cardd5 == 13) || ($cardd5 == 12) || ($cardd5 == 11)){ $cardd5 = 10; } if ($cardd5 == 14){ $cardd5 = 11; } } if (isset($_SESSION['card6'])){ if (($cardd6 == 13) || ($cardd6 == 12) || ($cardd6 == 11)){ $cardd6 = 10; } if ($cardd6 == 14){ $cardd6 = 11; } } $total = $cardd1 + $cardd2; if (isset($_SESSION['card3'])){ $total = $total + $cardd3; } if (isset($_SESSION['card4'])){ $total = $total + $cardd4; } if (isset($_SESSION['card5'])){ $total = $total + $cardd5; } if (isset($_SESSION['card6'])){ $total = $total + $cardd6; } if (($total > 21) && ($cardd1 == 11)){ $cardd1 = 1; $total = $total - 11; $total = $total + $cardd1; } if (($total > 21) && ($cardd2 == 11)){ $cardd2 = 1; $total = $total - 11; $total = $total + $cardd2; } if (($total > 21) && ($cardd3 == 11)){ $cardd3 = 1; $total = $total - 11; $total = $total + $cardd3; } if (($total > 21) && ($cardd4 == 11)){ $cardd4 = 1; $total = $total - 11; $total = $total + $cardd4; } if (($total > 21) && ($cardd5 == 11)){ $cardd5 = 1; $total = $total - 11; $total = $total + $cardd5; } if (($total > 21) && ($cardd6 == 11)){ $cardd6 = 1; $total = $total - 11; $total = $total + $cardd6; } if (($dtotal > 21) && (isset($_SESSION['bet']))){ $hahahaha1=$bet; echo "<center><font color=green><b>The dealer has bust. You won £$hahahaha1."; $won = $bet; $newmoney = $omoney - $won; $ws = "win"; if($newmoney <= 0){ $bet = $bet; mysql_query("UPDATE bj SET bjowner='$username', bjearnings='0', bjmaxbet='2000' WHERE bjowner='$bjowner' AND location='$location'"); mysql_query("UPDATE users SET money='$otmoney' WHERE username='$bjowner'"); mysql_query("UPDATE bj SET bjowner='$username', bjearnings='0', bjmaxbet='2000' WHERE bjowner='$bjowner' AND location='$location'"); echo "<font color=white>You tookover the table"; die(); }else{ $money = $won + $pmoney; mysql_query("UPDATE users SET money='$money' WHERE username='$username'"); mysql_query("UPDATE users SET bjwins=bjwins+1 WHERE username='$username'"); $total = $earn - $won; mysql_query("INSERT INTO `betlogs` (`id`, `username`, `money`, `end`, `owner`, `type`, `moneyuse`) VALUES ('', '$username', '$currentmoney', '$end', '$bjowner', 'bj', '$bettt');"); mysql_query("UPDATE bj SET bjearnings='$total' WHERE bjowner='$bjowner'"); $newmoney = $omoney - $won; mysql_query("UPDATE users SET money='$newmoney' WHERE username='$bjowner'"); mysql_query("UPDATE users SET bj='0' WHERE username='$username'"); unset($_SESSION['deck'],$_SESSION['bet']); } $_SESSION['show'] = "show them"; } $phow = 21 - $total; $dhow = 21 - $dtotal; if (($phow > $dhow) && (isset($_SESSION['bet']))){ echo "<center><font color=red><b>You had $total and the dealer had $dtotal you lost £$bet!"; $total = $earn + $bet; $ws = "lost"; mysql_query("UPDATE bj SET bjearnings='$total' WHERE bjowner='$bjowner'"); $newmoney = $omoney + $bet; mysql_query("UPDATE users SET money='$newmoney' WHERE username='$bjowner'"); $start = $pmoney; $end = $pmoney-$bet; mysql_query("UPDATE users SET money='$end' WHERE username='$username'"); unset($_SESSION['deck'],$_SESSION['bet']); $_SESSION['show'] = "show them"; } if (($phow < $dhow) && (isset($_SESSION['bet']))){ $eatshit=$bet; echo "<center><font color=green><b>You had $total and the dealer had $dtotal you won £$eatshit!"; $won = $bet; $newmoney = $omoney - $won; $ws = "win"; if($newmoney <= 0){ $bet = $bet; mysql_query("UPDATE bj SET bjowner='$username',bjearnings='0',bjmaxbet='2000' WHERE bjowner='$bjowner' AND location='$location'"); mysql_query("UPDATE users SET money='$otmoney' WHERE username='$bjowner'"); mysql_query("UPDATE users SET money=money+bet WHERE username='$username'"); echo "<center><font color=green><b>The owner has no money left so you tookover the table!"; }else{ $money = ($won) + $pmoney; mysql_query("UPDATE users SET money='$money' WHERE username='$username'"); mysql_query("UPDATE users SET bjwins=bjwins+1 WHERE username='$username'"); $total = $earn - $won; mysql_query("UPDATE bj SET bjearnings='$total' WHERE bjowner='$bjowner'"); $newmoney = $omoney - $won; mysql_query("UPDATE users SET money='$newmoney' WHERE username='$bjowner'"); mysql_query("UPDATE users SET bj='0' WHERE username='$username'"); unset($_SESSION['deck'],$_SESSION['bet']); } $_SESSION['show'] = "show them"; } if (($phow == $dhow) && ($bet)){ $bet = $bet; echo "<center><font color=white><b>It was a push both you and dealer had same amount!"; mysql_query("UPDATE users SET money=money+$bet, bj='0' WHERE username='$username'"); unset($_SESSION['deck'],$_SESSION['bet']); $_SESSION['show'] = "show them"; } } if ((!isset($_SESSION['card1'])) && (isset($_SESSION['bet']))){ $bet = $_SESSION['bet']; //*********get cards //make a deck $cards = array("14-h", "14-c", "14-d", "14-s", "2-h", "2-c", "2-d", "2-s", "3-h", "3-c", "3-d", "3-s", "4-h", "4-c", "4-d", "4-s", "5-h", "5-c", "5-d", "5-s", "6-h", "6-c", "6-d", "6-s", "7-h", "7-c", "7-d", "7-s", "8-h", "8-c", "8-d", "8-s", "9-h", "9-c", "9-d", "9-s", "10-h", "10-c", "10-d", "10-s", "11-h", "11-c", "11-d", "11-s", "12-h", "12-c", "12-d", "12-s", "13-h", "13-c", "13-d", "13-s"); //shuffle for($i = 0; $i < 52; $i++){ $count = count($cards); $random = (rand()%$count); if($cards[$random] == "") { $i--; } else{ $deck[] = $cards[$random]; $cards[$random] = ""; } } $_SESSION['deck'] = $deck; $carrd1 = explode("-", $deck[0]); $card1 = $carrd1[0]; $color1 = $carrd1[1]; $carrd2 = explode("-", $deck[1]); $card2 = $carrd2[0]; $color2 = $carrd2[1]; if ($color1 == "h"){$color1 = 'heart';} if ($color1 == "d"){$color1 = 'diamond';} if ($color1 == "c"){$color1 = 'club';} if ($color1 == "s"){$color1 = 'spade';} $_SESSION['card1'] = $card1; $_SESSION['color1'] = $color1; //second card if ($color2 == "h"){$color2 = 'heart';} if ($color2 == "d"){$color2 = 'diamond';} if ($color2 == "c"){$color2 = 'club';} if ($color2 == "s"){$color2 = 'spade';} $_SESSION['card2'] = $card2; $_SESSION['color2'] = $color2; //get dealer cards $dcarrd1 = explode("-", $deck[50]); $dcard1 = $dcarrd1[0]; $dcolor1 = $dcarrd1[1]; $dcarrd2 = explode("-", $deck[51]); $dcard2 = $dcarrd2[0]; $dcolor2 = $dcarrd2[1]; if ($dcolor1 == "h"){$dcolor1 = 'heart';} if ($dcolor1 == "d"){$dcolor1 = 'diamond';} if ($dcolor1 == "c"){$dcolor1 = 'club';} if ($dcolor1 == "s"){$dcolor1 = 'spade';} $_SESSION['dcard1'] = $dcard1; $_SESSION['dcolor1'] = $dcolor1; //second card if ($dcolor2 == "h"){$dcolor2 = 'heart';} if ($dcolor2 == "d"){$dcolor2 = 'diamond';} if ($dcolor2 == "c"){$dcolor2 = 'club';} if ($dcolor2 == "s"){$dcolor2 = 'spade';} $_SESSION['dcard2'] = $dcard2; $_SESSION['dcolor2'] = $dcolor2; } //calcualte cards total to see if they have Blackjack or have bust if (isset($_SESSION['card1'])){ $cardd1 = $_SESSION['card1']; $cardd2 = $_SESSION['card2']; $cardd3 = $_SESSION['card3']; $cardd4 = $_SESSION['card4']; $cardd5 = $_SESSION['card5']; $cardd6 = $_SESSION['card6']; if (($cardd1 == 13) || ($cardd1 == 12) || ($cardd1 == 11)){ $cardd1 = 10; } if ($cardd1 == 14){ $cardd1 = 11; } if (($cardd2 == 13) OR ($cardd2 == 12) OR ($cardd2 == 11)){ $cardd2 = 10; } if ($cardd2 == 14){ $cardd2 = 11; } if (isset($_SESSION['card3'])){ if (($cardd3 == 13) OR ($cardd3 == 12) OR ($cardd3 == 11)){ $cardd3 = 10; } if ($cardd3 == 14){ $cardd3 = 11; } } if (isset($_SESSION['card4'])){ if (($cardd4 == 13) OR ($cardd4 == 12) OR ($cardd4 == 11)){ $cardd4 = 10; } if ($cardd4 == 14){ $cardd4 = 11; } } if (isset($_SESSION['card5'])){ if (($cardd5 == 13) OR ($cardd5 == 12) OR ($cardd5 == 11)){ $cardd5 = 10; } if ($cardd5 == 14){ $cardd5 = 11; } } if (isset($_SESSION['card6'])){ if (($cardd6 == 13) OR ($cardd6 == 12) OR ($cardd6 == 11)){ $cardd6 = 10; } if ($cardd6 == 14){ $cardd6 = 11; } } $total = $cardd1 + $cardd2; if (isset($_SESSION['card3'])){ $total = $total + $cardd3; } if (isset($_SESSION['card4'])){ $total = $total + $cardd4; } if (isset($_SESSION['card5'])){ $total = $total + $cardd5; } if (isset($_SESSION['card6'])){ $total = $total + $cardd6; } if (($total > 21) && ($cardd1 == 11)){ $cardd1 = 1; $total = $total - 11; $total = $total + $cardd1; } if (($total > 21) && ($cardd2 == 11)){ $cardd2 = 1; $total = $total - 11; $total = $total + $cardd2; } if (($total > 21) && ($cardd3 == 11)){ $cardd3 = 1; $total = $total - 11; $total = $total + $cardd3; } if (($total > 21) && ($cardd4 == 11)){ $cardd4 = 1; $total = $total - 11; $total = $total + $cardd4; } if (($total > 21) && ($cardd5 == 11)){ $cardd5 = 1; $total = $total - 11; $total = $total + $cardd5; } if (($total > 21) && ($cardd6 == 11)){ $cardd6 = 1; $total = $total - 11; $total = $total + $cardd6; } if (($total == "21") && (!isset($_SESSION['card3'])) && (isset($_SESSION['bet']))){ $bj = ($bet)/2; $won=$bet+$bj; $newmoney = $omoney - $won; $ws = "bj"; if($newmoney <= 0){ $bet = $bet; mysql_query("UPDATE bj SET bjowner='$username',bjearnings='0',bjmaxbet='2000' WHERE bjowner='$bjowner' AND location='$location'"); mysql_query("UPDATE users SET money='$otmoney' WHERE username='$bjowner'"); mysql_query("UPDATE users SET money=money+$bet WHERE username='$username'"); echo "<font color=white>You tookover the table"; }else{ echo "<center><font color=green><b>You got 21 and won £$won "; $money = ($won) + $pmoney; mysql_query("UPDATE users SET money='$money' WHERE username='$username'"); mysql_query("UPDATE users SET bjwins=bjwins+1 WHERE username='$username'"); $total = $earn - $won; mysql_query("UPDATE bj SET bjearnings='$total' WHERE bjowner='$bjowner'"); $newmoney = $omoney - $won; mysql_query("UPDATE users SET money='$newmoney' WHERE username='$bjowner'"); mysql_query("UPDATE users SET bj='0' WHERE username='$username'"); $_SESSION['show'] = "show them"; unset($_SESSION['deck'],$_SESSION['bet']); } $_SESSION['show'] = "show them"; } if (($total > "21" ) && (isset($_SESSION['bet']))){ $lost = $bet; $ws = "lost"; echo "<center><font color=red><b>You had $total. You bust and lost £$lost. "; $total = $earn + $lost; mysql_query("UPDATE bj SET bjearnings='$total' WHERE bjowner='$bjowner'"); $newmoney = $omoney + $lost; mysql_query("UPDATE users SET money='$newmoney' WHERE username='$bjowner'"); $start = $pmoney; $end = $pmoney-$bet; mysql_query("UPDATE users SET money='$end' WHERE username='$username'"); $_SESSION['show'] = "show them"; unset($_SESSION['deck'],$_SESSION['bet']); $_SESSION['show'] = "show them"; } } if($ws == "lost"){ $start = $pmoney; $end = $pmoney-$bet; mysql_query("INSERT INTO `betlogs` (`id`, `username`, `money`, `end`, `owner`, `type`) VALUES ('', '$username', '$start', '$end', '$bjowner', 'bj');"); }elseif($ws == "win"){ $start = $pmoney; $end = $pmoney+($bet); mysql_query("INSERT INTO `betlogs` (`id`, `username`, `money`, `end`, `owner`, `type`) VALUES ('', '$username', '$start', '$end', '$bjowner', 'bj');"); }elseif($ws == "bj"){ $start = $pmoney; $end = $pmoney+($bet)+($bet/2); mysql_query("INSERT INTO `betlogs` (`id`, `username`, `money`, `end`, `owner`, `type`) VALUES ('', '$username', '$start', '$end', '$bjowner', 'bj');"); } if (!isset($_SESSION['bet'])){ echo " <center> <form name=form3 method=post action=$self> <br> <table width=270 align=center cellspacing=0 cellpadding=0 class=table> <tr><td class=header colspan=4>Blackjack</td></tr> <tr> <td colspan=3 align=center>Place Your Bet:</td> <td><input type=text name=bett class=textbox1></td> </tr> <tr> <td colspan=3 align=left> </td> <td align=left><input type=submit class=button name=Submit value=Bet></td> </tr> </table></form><br> <table width=25% align=center border=0 cellspacing=0 cellpadding=0 class=table> <tr> <td align=center class='header' colspan=4>Blackjack Stats</td></tr> <tr><td align=center>"; if ($bjowner == "0"){ echo "This Blackjack table is not owned by anyone<br>The max bet is set at £".makecomma($bjmaxbet).""; }else{ echo "This Blackjack table is owned by <a href='profile.php?viewuser=$bjowner'><b>$bjowner</b></a><br>The max bet is set at £".makecomma($bjmaxbet).""; } echo"</td></tr></table>"; include_once"footer_bottom.php"; die(); } else { echo " "; } if ((isset($_SESSION['dcard1'])) && (isset($_SESSION['show']))){ ?> <br> <table width=600 align=center cellspacing=0 cellpadding=0 class=table> <tr><td class=header colspan=11>Blackjack</td></tr> <tr width=600> <td width="50%" valign=top> <center> <b>Dealers Cards</b><br><br> <img src="images/cards/<?php if ((isset($_SESSION['dcard1'])) && (isset($_SESSION['show']))){ echo $_SESSION['dcolor1']; }else{ echo "cardback";} echo "/"; if ((isset($_SESSION['dcard1'])) && (isset($_SESSION['show']))) { echo $_SESSION['dcard1']; }else{ echo "cardback";}?>.gif" width="93" height="120"> <img src=images/cards/<?php if ((isset($_SESSION['dcard2'])) && (isset($_POST['stand'])) && (isset($_SESSION['show']))) { echo $_SESSION['dcolor2']; }else{ echo "cardback"; } echo "/"; if ((isset($_SESSION['dcard2'])) && (isset($_POST['stand'])) && (isset($_SESSION['show']))) { echo $_SESSION['dcard2']; }else{ echo "cardback";} ?>.gif width="93" height="120"> <?php if ((isset($_SESSION['dcard3'])) && (isset($_POST['stand'])) && (isset($_SESSION['show']))) { echo "<img src=images/cards/"; echo $_SESSION['dcolor3']; echo "/"; echo $_SESSION['dcard3']; echo ".gif width=71 height=96>"; echo " "; } if ((isset($_SESSION['dcard4'])) && (isset($_POST['stand'])) && (isset($_SESSION['show']))) { echo "<img src=images/cards/"; echo $_SESSION['dcolor4']; echo "/"; echo $_SESSION['dcard4']; echo ".gif width=71 height=96>"; echo " "; }?></span> </div> </td> <td colspan=10 valign=top> <center> <b>Your Cards <? if ($_SESSION['bet']){ echo "- You have $total"; } ?></b><br> <br> <img src="images/cards/<?php if ((isset($_SESSION['card1'])) && (isset($_SESSION['show']))) { echo $_SESSION['color1']; }else{ echo "cardback";} echo "/"; if ((isset($_SESSION['card1'])) && (isset($_SESSION['show']))) { echo $_SESSION['card1']; }else{ echo "cardback";}?>.gif" width="93" height="120"> <img src="images/cards/<?php if ((isset($_SESSION['card2'])) && (isset($_SESSION['show']))) { echo $_SESSION['color2']; }else{ echo "cardback";} ?>/<?php if ((isset($_SESSION['card2'])) && (isset($_SESSION['show']))){ echo $_SESSION['card2']; }else{ echo "cardback"; }?>.gif" width="93" height="120"> <?php if ((isset($_SESSION['card3'])) && (isset($_SESSION['show']))) { echo "<img src=images/cards/"; echo $_SESSION['color3']; echo "/"; echo $_SESSION['card3']; echo ".gif width=93 height=120>"; echo " "; } if (isset($_SESSION['card4'])) { echo "<img src=images/cards/"; echo $_SESSION['color4']; echo "/"; echo $_SESSION['card4']; echo ".gif width=93 height=120>"; echo " "; } if (isset($_SESSION['card5'])) { echo "<img src=images/cards/"; echo $_SESSION['color5']; echo "/"; echo $_SESSION['card5']; echo ".gif width=93 height=120>"; echo " "; } if (isset($_SESSION['card6'])) { echo "<img src=images/cards/"; echo $_SESSION['color6']; echo "/"; echo $_SESSION['card6']; echo ".gif width=93 height=120></div></td>"; echo " "; }?> </div><br></td> </tr> <tr class=text> <td width=50% align=center> <form name="form2" method="post" action="<?php $_SERVER['PHP_SELF'] ?>"> <div align="right"> <br> <input type="submit" class="button" name="submit" value=" Hit "> <input name="hit" type="hidden" value="you hit"> </div> </form></td><td width=50% colspan=10> <form name="form4" method="post" action="<?php $_SERVER['PHP_SELF'] ?>"> <br><input type="submit" class="button" name="submit2" value="Stand" /> <input name="stand" type="hidden" value="you stand" /> </form> <?php } if (!isset($_SESSION['bet'])){ echo" <SCRIPT LANGUAGE=JavaScript> document.form2.submit.disabled=true; document.form4.submit2.disabled=true; </script>"; }?> </td> </tr> </table> </table> <br> <table width="25%" align="center" border="0" cellpadding="0" cellspacing="0" class="table"> <tr class="thinline"> <td class='header'>Blackjack Stats</td> </tr><tr><td align=center> <?php if ($bjowner == "0"){ echo "This Blackjack table is not owned by anyone<br>The max bet is set at £".makecomma($bjmaxbet).""; }else{ echo "This Blackjack table is owned by <a href='profile.php?viewuser=$bjowner'><b>$bjowner</b></a><br>The max bet is set at £".makecomma($bjmaxbet).""; } ?></td></tr></table> <? include_once"footer_bottom.php"; ?> </body> </html> <? } ?> Quote
Primed Posted July 28, 2012 Posted July 28, 2012 I'm on the sharp end of a sugar rush, following a bottle of BPM, coffee with 4 sugars and half a bottle of Lucozade. Had a skim through the source and my mind is just completely blown. However, have a look at $total = $cardd1 + $cardd2; if (isset($_SESSION['card3'])){ $total = $total + $cardd3; } if (isset($_SESSION['card4'])){ $total = $total + $cardd4; } if (isset($_SESSION['card5'])){ $total = $total + $cardd5; } if (isset($_SESSION['card6'])){ $total = $total + $cardd6; } It could be perfectly fine, and I may be spouting nonsense, but it looks dodgy to me Quote
modernmafia Posted July 28, 2012 Author Posted July 28, 2012 I'm on the sharp end of a sugar rush, following a bottle of BPM, coffee with 4 sugars and half a bottle of Lucozade. Had a skim through the source and my mind is just completely blown. However, have a look at $total = $cardd1 + $cardd2; if (isset($_SESSION['card3'])){ $total = $total + $cardd3; } if (isset($_SESSION['card4'])){ $total = $total + $cardd4; } if (isset($_SESSION['card5'])){ $total = $total + $cardd5; } if (isset($_SESSION['card6'])){ $total = $total + $cardd6; } It could be perfectly fine, and I may be spouting nonsense, but it looks dodgy to me still having problems any one else knowwhat the hells up with it Quote
modernmafia Posted July 28, 2012 Author Posted July 28, 2012 inless im missiing if (isset($_SESSION['card1'])){ $total = $total + $cardd1; } if (isset($_SESSION['card2'])){ $total = $total + $cardd2; } Quote
Curt Posted July 28, 2012 Posted July 28, 2012 inless im missiing if (isset($_SESSION['card1'])){ $total = $total + $cardd1; } if (isset($_SESSION['card2'])){ $total = $total + $cardd2; } Thats not the issue because you start out with two cards which is added together here: $total = $cardd1 + $cardd2; It may be an issue in one of the included scripts. Quote
D3Tek Posted July 28, 2012 Posted July 28, 2012 I expected to see something a little more...explicit when I opened this thread. Lol. Quote
modernmafia Posted July 28, 2012 Author Posted July 28, 2012 I expected to see something a little more...explicit when I opened this thread. Lol. haha dirty minded :) Quote
modernmafia Posted July 28, 2012 Author Posted July 28, 2012 Thats not the issue because you start out with two cards which is added together here: $total = $cardd1 + $cardd2; It may be an issue in one of the included scripts. what my functions file Quote
Primed Posted July 28, 2012 Posted July 28, 2012 If you do find out what's wrong with this, I'd actually be very interested to know, I've read all 2000 lines about 4 times and can't spot any obvious mistakes lol Quote
modernmafia Posted July 28, 2012 Author Posted July 28, 2012 If you do find out what's wrong with this, I'd actually be very interested to know, I've read all 2000 lines about 4 times and can't spot any obvious mistakes lol will do lol its seriously seems a bit wired seen ive looked through it loads its definetly in this files some where thats throwing it out Quote
Spudinski Posted August 3, 2012 Posted August 3, 2012 still need help Well dude, better get a decent girl. These STDs are everywhere nowadays... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.