anyone help me . this from jackpot game its works fine when ppl win but it dosnt deduct the plusses when they lose.
prob something simple am missing here
if($lucky_number==$random)
{
$var = $bet * 2;
$nplus = $uplus[0] + $var;
if(mysql_query("UPDATE dave_users SET plusses='".$nplus."' WHERE id='".$uid."'"))
echo "<small>You have recieved ".$var." plusses for winning</small>";
echo "<br/>";
echo "You now have ".$nplus." plusses left.";
echo "<br/>";
}
}else{
$nplus = $uplus[0] - $bet;
if($nplus<0)
{
$nplus = 0;
}
if(mysql_query("UPDATE dave_users SET plusses='".$nplus."' WHERE id='".$uid."'"))
{
echo "<small>You have lost ".$bet." plusses for losing</small>";
echo "<br/>";
echo "You now have ".$nplus." plusses left.";
echo "<br/>";
this is the old lava version, i havnt used it on a site yet to see if it error free but i doubt it as all i have done is changed the headers etc to the old versions and the functions
<?php
include("config.php");
include("core.php");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml');
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$bcon = connectdb();
if (!$bcon)
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<img src=\"../phpThumb/phpThumb.php?src=../images/notok.gif\" alt=\"!\"/><br/>";
echo "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
echo "This error happens usually when backing up the database, please be patient...";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
$brws = explode("/",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM dave_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$uid = getuid_sid($sid);
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM dave_users WHERE id='".$uid."'"));
cleardata();
if(($action != "") && ($action!="terms"))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<head>";
echo "<title>Error</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
}
///////////////////////////////////////////////////////////////////////////////////////
if($type==spin){
echo "<head>";
echo "<title>$nick@$sitename</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\"/>";
echo "</head>";
echo "<body>";
$value = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE uid='".getuid_sid($sid)."'"));
echo "<p align=".align()."><small>Your Points: <b>".$value[0]."</b></small><br/><br/>
<small>Your lucky number: <b>".$chosen_number."</b></small><br/>
<small>The winning number: <b>".$random."</b></small>";
if($chosen_number==$random){
$reward = $value[0] + $bet_value * 2;
mysql_query("UPDATE ibwf_users SET plusses='".$reward."' WHERE uid='".getuid_sid($sid)."'");
$win = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE uid='".getuid_sid($sid)."'"));
echo "<br/><small>You have recieved ".$winnings." plusses for winning<br/><br/>
You now have ".$win[0]." plusses left.</small><br/><a href=\"./jackpot.php?&sid=$sid\">Try Again</a>";
}else{
$loose = $value[0] - $bet_value;
mysql_query("UPDATE ibwf_users SET plusses='".$loose."' WHERE uid='".getuid_sid($sid)."'");
$lost = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE uid='".getuid_sid($sid)."'"));
echo "<br/><small>You have lost ".$winnings." plusses for loosing<br/><br/>
You now have ".$lost[0]." plusses left.</small><br/><a href=\"./jackpot.php?&sid=$sid\">Try Again</a>";
}
echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=funm&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/roll.gif\" alt=\"\"/>Fun Menu</a>";
echo "<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"*\"/>Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
if($type==play){
echo "<head>";
echo "<title>$nick@$sitename</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\"/>";
echo "</head>";
echo "<body>";
echo"<p align=\"center\">
<img src=\"../phpThumb/phpThumb.php?src=../images/jackpot.gif\" alt=\"!\"/><br/>
<br/><small>So you want to challenge our dealer and Win the jackpot!</small>
<br/><small>If you think you got what it takes, click below:</small></p>";
echo"<div class=\"center\">
<form action=\"jackpot.php?type=spin&sid=$sid\" method=\"post\">
<select name=\"bet_value\">
<option value=\"10\">10</option>
<option value=\"20\">20</option>
<option value=\"30\">30</option>
<option value=\"40\">40</option>
<option value=\"50\">50</option>
<option value=\"60\">60</option>
<option value=\"70\">70</option>
<option value=\"80\">80</option>
<option value=\"90\">90</option>
<option value=\"100\">100</option>
</select>
<br/>
<small>Choose your lucky number</small>
<br/>
<select name=\"chosen_number\">
<option value=\"1\">1</option>
<option value=\"2\">2</option>
<option value=\"3\">3</option>
<option value=\"4\">4</option>
<option value=\"5\">5</option>
<option value=\"6\">6</option>
<option value=\"7\">7</option>
<option value=\"8\">8</option>
<option value=\"9\">9</option>
<option value=\"10\">10</option>
</select><br/><br/>
<input type=\"Submit\" Value=\"Place Bet\"></form></div>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=funm&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/roll.gif\" alt=\"\"/>Fun Menu</a>";
echo "<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"*\"/>Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
echo "<head>";
echo "<title>$nick@$sitename</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\"/>";
echo "</head>";
echo "<body>";
echo "<p align=\"center\"><img src=\"../phpThumb/phpThumb.php?src=../images/jackpot.gif\" alt=\"!\"/><br/>";
echo "<br/><small>So you want to challenge our dealer and Win the jackpot!</small><br/>";
echo "<small>If you think you got what it takes, click below:</small><br/>";
echo "<small><a href=\"jackpot.php?type=play&sid=$sid\">Play Now</a></small></p>";
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=funm&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/roll.gif\" alt=\"\"/>*</a>";
echo "Fun Menu</a></small>";
echo "<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"*\"/>";
echo "Home</a></small>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
?>