Jump to content
MakeWebGames

need a little help


CoRnNuB
 Share

Recommended Posts

if ( !defined($_CONFIG['define_code']) ) {
  echo 'This file cannot be accessed directly.';
  exit;
}

echo '<center>
       <h3>High/Low</h3>
       </center>';

       // 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';

          }                  

       $bet =$_POST['bet'];


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

           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="highlow.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 //

?>

 

 

heres a code i tried converting from v2 to redux and it dosnt seem to work ive been following the convertion guid but it aint working

 

and to finish it off i add this in to explore

echo '<a href="'.gen_url('highlow',true).'">High Low</a>';

 

any help would be much appritiated

Edited by Djkanna
Code Tags.
Link to comment
Share on other sites

Ok change

$ir['money'] to $ir['main']

Also change the form action from

<form action="highlow.php" method="post">

to

<form action="'.gen_url('highlow',true).'" method="post">

upload to Mods/

edit the main index file adding the mod to the list of allowed files.

'highlow' => 'Mods/highlow.php'

You was nearly there..just over looked a few things.

Link to comment
Share on other sites

High/Low
'; // 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'; } $bet =$_POST['bet']; if($bet > $ir['main']) { echo '
Not enough money!
'; exit; } $num = number_format(rand(1,10)); echo '
The number is '.$num.'. Will the next number be higher or lower than '.$num.'? 








'; } 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 '
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).'? 








'; } else if($result === 2) // Player lost { echo '
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).'? 








'; } } else { // Default display echo '
Welcome to the High/Low casino! 

 

i now get this after following the instructions any one able to help again

Link to comment
Share on other sites

hhey

ok thanks thats done now but now when i bet and click higher or lower it says

 

The website cannot display the page

 

HTTP 500

 

 

 

Most likely causes:

•The website is under maintenance.

•The website has a programming error.

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...