Jump to content
MakeWebGames

Simple hi/low game


Razor42

Recommended Posts

Hi there,

Decided to do some coding for the community. It’s the first thing I have coded in quite a while so it’s pretty simple and if there are any issues then please let me know but their shouldn't be as I have tested and it all seems to work fine.

What it does?

It’s a simple hi low game, you get a number and then decided if the next number you’ll get is higher or lower. If you guess wrong then you lose and your pot is empty, if you guess correct then your right and you get $1000 added to your pot. You can also decide to collect your pot at any time.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Please post any bugs and I hope you all enjoy :).

Link to comment
Share on other sites

Sadly, You still haven't bother to message me your way is very time wasting as I needed it done with in the day after I assign you to the task.

Here's a head up for you in the future let whomever hires you know what you are working on and how long it would take before taking the new task.

Luckily I never depend on 1 unprofessional developer; the task is done don't bother to reply back to the message.

Instead of derailing the topic post in this section http://makewebgames.io/forumdisplay.php/345-Collaboration-experiences

Link to comment
Share on other sites

I've a few issues to raise.

  • No need for session_start();
  • No need to error_reporting on, on a live version (this should be covered with testing)
  • Possibly adopt heredoc
  • Few spelling errors
  • Why global variables that are not being used?
  • You're doubling memory with assigning global variables to local variables (see below);

    You're unable to view this code.

    Viewing code within this forum requires registration, you can register here for free.


  • It's exploitable, if you know how to alter session data.
  • Your format is horrible, no offense.
  • Perhaps check the contents of each $_SESSION, before bringing it into play in the script.
  • Use mccode pre-defined functions (money_formatter) to echo out the winnings, etc.
  • No idea what you were trying to achieve here.

    You're unable to view this code.

    Viewing code within this forum requires registration, you can register here for free.


  • This will suffice for line 81;

    You're unable to view this code.

    Viewing code within this forum requires registration, you can register here for free.


 

Sometimes PHP novices attempt to make their code "cleaner" by copying predefined variables to variables with shorter names before working with them. What this actually results in is doubled memory consumption (when the variable is altered), and therefore, slow scripts. In the following example, if a user had inserted 512KB worth of characters into a textarea field. This implementation would result in nearly 1MB of memory being used.

https://developers.google.com/speed/articles/optimizing-php

Edited by sniko
Link to comment
Share on other sites

1) how come I don't need session start? As stated before $_SESSION is pretty new to me.

2) As stated once again I was going to remove that when I got on a computer which I haven't yet.

3) Herdoc ? What's that?

4) These have been fixed on my live version just not had chance to update the posted code yet.

5) Just a habit I have obtained. Will sort this.

6) $guess = $_GET['Guess']; was my original way of doing it but it no longer needs that so ill clean the code up when I get time.

7) Would be nice of you showed the exploits and how they can be fixed.

8) Format is horrible how?

Just a few questions to your post to help me learn more from your feedback :)

Link to comment
Share on other sites

1) how come I don't need session start? As stated before $_SESSION is pretty new to me.

2) As stated once again I was going to remove that when I got on a computer which I haven't yet.

3) Herdoc ? What's that?

4) These have been fixed on my live version just not had chance to update the posted code yet.

5) Just a habit I have obtained. Will sort this.

6) $guess = $_GET['Guess']; was my original way of doing it but it no longer needs that so ill clean the code up when I get time.

7) Would be nice of you showed the exploits and how they can be fixed.

8) Format is horrible how?

Just a few questions to your post to help me learn more from your feedback :)

 

  • session_start is in globals.php
  • Okay
  • heredoc
  • Okay
  • Bad habit
  • Okay
  • My original point was to try and use the database (it would allow multiple uses of the hi-low script, without session timeout)
  • If you load the script into Netbeans (for example), go to Source > Format, you will see.
Link to comment
Share on other sites

All you have to do is start your game, then refresh the page until you get a safe number to bet high or low on, so if you know how to use it you will virtually never lose..

Maybe what you can do is provide a unique session as a hidden input field in the index and have it check to make sure that is what it actually is to stop refreshers

Link to comment
Share on other sites

just an alteration not a bad mod just a lot of altering

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

this is just long cut to the chase and add this instead

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

making the action=play skips straight the the necessary point

Edited by Dominion
Fixed php tags
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.

×
×
  • Create New...