Jump to content
MakeWebGames

Hi/low


Newbie
 Share

Recommended Posts

One of my testers just made it clear to me that its easy to make money off hi_low so basicly the only thing i can think of to stop this is put a limit on it like luckyboxes

 

i added the table into users

i called it hi/low_opened

i added this to hi_low.php

 

if($ir['hi/low_opened'] >= 5)
{

print "Sorry, you have already played Hi or Low 5 times today. Come back tomorrow.";
$h->endpage(); 
exit;

}

 

also tryied to add this

 

$db->query("UPDATE users SET hi/low_opened=hi/low_opened+1,  WHERE userid=$userid");

 

i have tried to add it multiple places and no joy just comes up query error

i have tried it in the winning and the losing any still get error

 

<?php
require_once('globals.php');


print "
<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'> High/Low</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>";

	if($ir['hi/low_opened'] >= 5)
{

print "Sorry, you have already played Hi or Low 5 times today. Come back tomorrow.";
$h->endpage(); 
exit;

}
       // Below = The Monk's Code //

       $POST['bet'] = isset($_POST['bet']) && is_numeric($_POST['bet']) ? abs((int) $_POST['bet']) : false;
       $POST['oldnum'] = isset($_POST['oldnum']) && is_numeric($_POST['oldnum']) ? abs((int) $_POST['oldnum']) : false;
       $_POST['choice'] = mysql_real_escape_string(strip_tags($_POST['choice']));



   if ($_POST['bet'] && !$_POST['choice']) // Player entered bet but hasn't chosen high/low yet
   {

             if (!in_array($_POST['bet'], array('500', '1000', '5000', '10000')))
         {
        echo 'The bet you selected is not available';
      $h->endpage();
          }                  

       $bet =$_POST['bet'];


           if($bet > $ir['money'])
           {
           echo '<center>Not enough money!</center>';
           $h->endpage();
           exit;
           }


           $num = number_format(rand(1,10));
           echo '<center>The number is '.$num.'.

           Will the next number be higher or lower than '.$num.'?
           <table>
           <tr>
           <td>
           <form method="post">
           <input type="hidden" value="'.$num.'" name="oldnum">
           <input type="hidden" value="'.$bet.'" name="bet">
           <input type="hidden" value="high" name="choice">
           <input type="submit" value="Higher">
           </form>
           </td>
           <td>
           <form method="post">
           <input type="hidden" value="'.$num.'" name="oldnum">
           <input type="hidden" value="'.$bet.'" name="bet">
           <input type="hidden" value="low" name="choice">
           <input type="submit" value="Lower">
           </form>
           </td>
           </tr>
           </table>
           </center>';
           }


       else if ($_POST['choice'] && $_POST['oldnum'] && $_POST['bet']) // Player chose high/low
       {
       $newnum = number_format(rand(1,10));
       $oldnum = $_POST['oldnum'];
       $guess = $_POST['choice'];
       $bet = $_POST['bet'];


               if($newnum < $oldnum) { $lala = 'low'; }

                   else if($newnum > $oldnum) { $lala = 'high'; }

                       else if($newnum === $oldnum) { $lala = $guess; }

               if($lala !== $guess) { $result = 2; }

                   else if($lala === $guess) { $result = 1; }

               if(!$result) { die("Error!"); } // No result was generated


       $db->query("UPDATE `users` SET `money`=`money`-".$bet." WHERE (`userid`=".$userid.")"); // Take away bet



           if($result === 1) // Player won
           {
           $prize=$bet * 2; // Prize money for winning
           echo '<center>Congratulations! You won your bet of \$'.$bet.'

';

           $db->query("UPDATE `users` SET `money`=`money`+".$prize." WHERE (`userid`=".$userid.")");

           echo 'You guessed '.$guess.', the previous number was '.number_format($oldnum).' and the new
           number was '.number_format($newnum).'.

           Is the next number going to be higher or lower than '.number_format($newnum).'?


       <table>
       <tr>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="high" name="choice">
       <input type="submit" value="Higher">
       </form>
       </td>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="low" name="choice">
       <input type="submit" value="Lower">
       </form>
       </td>
       </tr>
       </table>
       </center>';
       }

           else if($result === 2) // Player lost
           {
           echo '<center>Sorry you lost your bet of \$'.number_format($bet).'



           You guessed '.$guess.', the previous number was '.number_format($oldnum).'
           and the new number was '.number_format($newnum).'.


           Is the next number going to be higher or lower than '.number_format($newnum).'?


       <table>
       <tr>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="high" name="choice">
       <input type="submit" value="Higher">
       </form>

       </td>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="low" name="choice">
       <input type="submit" value="Lower">
       </form>
       </td>
       </tr>
       </table>
       </center>';
   }
   }

           else
           {
           // Default display

           echo '<center>Welcome to the High/Low casino!

           <form action="high_low.php" method="post">
           Select your bet: <select type="dropdown" name="bet">
           <option value="500">$500</option>
           <option value="1000">$1000</option>
           <option value="5000">$5000</option>
           <option value="10000">$10000</option>
           </select>


           <input type="submit" value="Start Game!">
           </form>
           </center>';
           }
// End Of The Monk's Code //
$h->endpage();
?>
Edited by Newbie
Link to comment
Share on other sites

  • 2 weeks later...
One of my testers just made it clear to me that its easy to make money off hi_low so basicly the only thing i can think of to stop this is put a limit on it like luckyboxes

 

i added the table into users

i called it hi/low_opened

i added this to hi_low.php

 

if($ir['hi/low_opened'] >= 5)
{

print "Sorry, you have already played Hi or Low 5 times today. Come back tomorrow.";
$h->endpage(); 
exit;

}

 

also tryied to add this

 

$db->query("UPDATE users SET hi/low_opened=hi/low_opened+1,  WHERE userid=$userid");

 

i have tried to add it multiple places and no joy just comes up query error

i have tried it in the winning and the losing any still get error

 

<?php
require_once('globals.php');


print "
<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'> High/Low</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>";

    if($ir['hi/low_opened'] >= 5)
{

print "Sorry, you have already played Hi or Low 5 times today. Come back tomorrow.";
$h->endpage(); 
exit;

}
       // Below = The Monk's Code //

       $POST['bet'] = isset($_POST['bet']) && is_numeric($_POST['bet']) ? abs((int) $_POST['bet']) : false;
       $POST['oldnum'] = isset($_POST['oldnum']) && is_numeric($_POST['oldnum']) ? abs((int) $_POST['oldnum']) : false;
       $_POST['choice'] = mysql_real_escape_string(strip_tags($_POST['choice']));



   if ($_POST['bet'] && !$_POST['choice']) // Player entered bet but hasn't chosen high/low yet
   {

             if (!in_array($_POST['bet'], array('500', '1000', '5000', '10000')))
         {
        echo 'The bet you selected is not available';
      $h->endpage();
          }                  

       $bet =$_POST['bet'];


           if($bet > $ir['money'])
           {
           echo '<center>Not enough money!</center>';
           $h->endpage();
           exit;
           }


           $num = number_format(rand(1,10));
           echo '<center>The number is '.$num.'.

           Will the next number be higher or lower than '.$num.'?
           <table>
           <tr>
           <td>
           <form method="post">
           <input type="hidden" value="'.$num.'" name="oldnum">
           <input type="hidden" value="'.$bet.'" name="bet">
           <input type="hidden" value="high" name="choice">
           <input type="submit" value="Higher">
           </form>
           </td>
           <td>
           <form method="post">
           <input type="hidden" value="'.$num.'" name="oldnum">
           <input type="hidden" value="'.$bet.'" name="bet">
           <input type="hidden" value="low" name="choice">
           <input type="submit" value="Lower">
           </form>
           </td>
           </tr>
           </table>
           </center>';
           }


       else if ($_POST['choice'] && $_POST['oldnum'] && $_POST['bet']) // Player chose high/low
       {
       $newnum = number_format(rand(1,10));
       $oldnum = $_POST['oldnum'];
       $guess = $_POST['choice'];
       $bet = $_POST['bet'];


               if($newnum < $oldnum) { $lala = 'low'; }

                   else if($newnum > $oldnum) { $lala = 'high'; }

                       else if($newnum === $oldnum) { $lala = $guess; }

               if($lala !== $guess) { $result = 2; }

                   else if($lala === $guess) { $result = 1; }

               if(!$result) { die("Error!"); } // No result was generated


       $db->query("UPDATE `users` SET `money`=`money`-".$bet." WHERE (`userid`=".$userid.")"); // Take away bet



           if($result === 1) // Player won
           {
           $prize=$bet * 2; // Prize money for winning
           echo '<center>Congratulations! You won your bet of \$'.$bet.'

';

           $db->query("UPDATE `users` SET `money`=`money`+".$prize." WHERE (`userid`=".$userid.")");

           echo 'You guessed '.$guess.', the previous number was '.number_format($oldnum).' and the new
           number was '.number_format($newnum).'.

           Is the next number going to be higher or lower than '.number_format($newnum).'?


       <table>
       <tr>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="high" name="choice">
       <input type="submit" value="Higher">
       </form>
       </td>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="low" name="choice">
       <input type="submit" value="Lower">
       </form>
       </td>
       </tr>
       </table>
       </center>';
       }

           else if($result === 2) // Player lost
           {
           echo '<center>Sorry you lost your bet of \$'.number_format($bet).'



           You guessed '.$guess.', the previous number was '.number_format($oldnum).'
           and the new number was '.number_format($newnum).'.


           Is the next number going to be higher or lower than '.number_format($newnum).'?


       <table>
       <tr>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="high" name="choice">
       <input type="submit" value="Higher">
       </form>

       </td>
       <td>
       <form method="post">
       <input type="hidden" value="'.$newnum.'" name="oldnum">
       <input type="hidden" value="'.$bet.'" name="bet">
       <input type="hidden" value="low" name="choice">
       <input type="submit" value="Lower">
       </form>
       </td>
       </tr>
       </table>
       </center>';
   }
   }

           else
           {
           // Default display

           echo '<center>Welcome to the High/Low casino!

           <form action="high_low.php" method="post">
           Select your bet: <select type="dropdown" name="bet">
           <option value="500">$500</option>
           <option value="1000">$1000</option>
           <option value="5000">$5000</option>
           <option value="10000">$10000</option>
           </select>


           <input type="submit" value="Start Game!">
           </form>
           </center>';
           }
// End Of The Monk's Code //
$h->endpage();
?>

Get rid off the comma in the query

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...