I am making a website, kind of a browser based rpg, but i heard that people can like hack the php games or something. Anyways, i was wondering, how someone could cheat on a Php game such as like a simple slots game and how I can prevent it.

    Hi Joka, I am also making a browser-based RPG, and I have had to put a lot of thought into my game so that it runs efficiently and securely. Unfortunately, this is no easy task. There is no specific way that someone will be able to cheat at a game made in PHP. This is because as long as your server is secure and your code is perfect there will be no way to cheat (unless you intended for there to be a way to cheat). The problem is creating the perfect code. That's quite a task. Chances are you will make a mistake, or someone will find a way to take advantage of your code. Once someone discovers a way to use the code in your game for a way that isn't intended they will be able to cheat. An example of this is if you have $GET variables in the address bar. If your game relies on $GET variables and you don't have a way of verifying that they get to your code unaltered it is possible that people will be able to cheat. There are many other ways that people could take advantage of your code and cheat, and chances are you won't even think about it.

    To help make your game have less chances of security holes that will allow people to cheat, and to make security holes people do find easier to fix, I would recommend the following steps be taken:
    -Plan out your game before you start making it. A solid plan helps make coding a lot easier. You could also write out your functions, classes, actions, variables, ect with no content to give you a basic structure to your program.
    -Use lots of comments and white space. This will make your program easier to read, and give you an idea of what a block of code does.
    -Be constant in your coding. This makes it easier to remember things, and easier to read.
    -Keep the code as simple as possible. There are no advantages to using more complex code in places where simple code will do the trick. Often using simpler code can make your program more effective too.
    -If you are doing this as a hobby like I am, don't be afraid to redo parts or start over completely. I have restarted my game several times, and each time the code becomes better, more efficient, and more secure.

    After that the best thing to do is test. Try and cheat yourself, then get a friend of a group to try also. There is no sure way to stop cheating, but you can do steps like these to cut down the chances.

      Oddly enough, I had the thought of writing an RPG based game in PHP just yesterday, tho it'll have to wait in line behind another project. But I wanted to say thanks for the advice, Namadoor, I'll be keeping a copy of it for future reference.

      James

        Write a Reply...