I am concerned about the security of my games as they can be easily hacked through right-click inspect. What measures can

As a newcomer to game development, I am creating web games using JS, HTML, and CSS. However, I have encountered an issue with preventing right-click inspect hacking, which has led to people hacking my games through this method.

I am wondering, how can I secure my games against this type of hacking...

You can play my game here.

And view the score page here, which as you can see is vulnerable to hacking...

Apologies for using Turkish language in my game, I will switch to English soon.

Another question I have is, how can I enhance my game development skills? I have heard good things about Phaser engine, so I am researching tutorials to improve. Any advice from experts like you would be greatly appreciated...

I know these are basic questions, but I am eager to learn and develop my skills in web and game development. Thank you so much!

Note: The games I create are based on knowledge gained from the Stack Overflow community, so a big thank you to them as well.

Answer №1

When it comes to client-side code (HTML, CSS, JavaScript), the reason it is called "client-side" is because it gets downloaded onto the user's device and runs there. Unfortunately, there is no foolproof way to prevent users from viewing and modifying this code. Even if you try storing your JavaScript in an external file and linking to it or obfuscating it, it doesn't entirely solve the problem.

The best practice is to keep all sensitive code on a secure server and have it executed using a "server-side" architecture like .aspx, .PHP, .jsp, etc.

Answer №2

After playing the game, I managed to find a way to manipulate it. The issue lies in how you rely on forms and hidden inputs to send game results to the server. Firstly, when a player completes the game, you record the time it took them to finish. Then, on the next page, their final score is sent through a hidden input. Unfortunately, both of these can be easily altered by users before submission.

A possible solution could involve creating a checksum for the hidden values that should not be tampered with. Once these values are sent to the server, you can recalculate the checksum using PHP. If the calculated checksum does not match what was submitted by the browser, then you can reject the data.

While this method won't completely prevent hacking attempts, it will definitely increase the difficulty. Determined users could still find ways to manipulate their score by investigating the client-side javascript used to generate the checksum and creating a new one based on their desired values.

Regarding the final score display, consider storing it in a session instead of including it in a form as a hidden input in your skor.php file. By storing the score in a session property and retrieving it in skorislendi.php, you can prevent users from altering it.

Answer №3

Preventing clients, like players, from hacking client-side materials such as scripts and HTML is incredibly difficult. Any actions taken by your scripts on the client side can easily be falsified. One way to try to combat this is by obfuscating your JavaScript code and post data, which may make it harder for hackers but won't completely protect you.

The ultimate question to ask yourself is: Is security a priority for my game? If it is, then it is worth worrying about. Otherwise, focus on building what you can and add security measures when absolutely necessary from an agile perspective.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What's the best way to navigate across by simply pressing a button located nearby?

Hey there! I'm new to JavaScript and I'm working on a shopping list page for practice. In my code, I can add new items to the list, but what I really want is to be able to cross out an item when I click the "Done" button next to it, and then uncr ...

Use Node.js with Selenium and WebdriverIO to simulate the ENTER keypress action on

I have put in a lot of effort trying to find the solution before resorting to asking this question, but unfortunately I have not been successful. All I need to know is how to send special characters (such as the enter key and backspace) with Node.js using ...

The built-in functions of Wordpress are not able to be identified in the ajax PHP file

As a newcomer to Wordpress development, I am facing challenges with implementing ajax on my WordPress site. I am currently working on a plugin that requires the use of ajax. However, my php file (xxxecommerce.ajax.php) is not recognizing the built-in Word ...

What is the best way to program a function that can extract random lines from a text file and save them in a variable?

Can someone enlighten me on how to create a function that reads from a txt file and saves random lines into a variable? This function needs to be executed multiple times within a foreach loop, and the language used is PHP. I'm still new to coding, so ...

`I'm having issues trying to use ajax and load simultaneously``

Can anyone help me figure out why my AJAX call to sessions.php is not correctly loading and returning true or false each time a user accesses the page? var section = $("#header a"); section.on('click', function() { $.ajax({ type: "PO ...

Using the dot operator to load an image

Is it possible to using the dot operator to load an image? Let's talk about this as a sample image URL <img src={{GET_PROFILE_DATA.googleProfileData.fullName}} alt="profile" class="home-screen-profile-image"> Take note of the unusual looking ...

Number Stepper Reverse

Could the HTML5 number stepper be reversed so that pushing down increases the number and vice versa? In Response to any 'Why?' inquiries: Consider batting order in sports like cricket or baseball. As you move down the order, your batting positio ...

How to Properly Adjust the Material UI CircularProgress Size

Is there a way to display the Material UI CircularProgress component at a size that nearly fills the parent div, which has an unknown size? Ideally, I want the size to be around 0.8 * min(parent_height, parent_width). I've experimented with adjusting ...

Pictures displaying various shapes in contact with each other

I have a unique challenge involving an image that has been physically cut into puzzle-shaped pieces. Is there a way to align these individual puzzle pieces using only HTML and CSS to create the illusion of a single cohesive image once assembled? It' ...

Enhancing jQuery Rating Plugin

Currently, I am working on customizing the jQuery Bar Rating System Plugin. You can view an example of the plugin by visiting this link: . The rating system on my end will resemble Example D. Rather than having the plugin based on user input, my goal is to ...

Unable to retrieve real-time data from Firestore using getStaticPaths in Next.js

While fetching data from Firebase Firestore using getStaticProps is successful, I encounter a 404 page when attempting to implement the logic for retrieving details of individual items with getStaticPaths. The current state of my [id].js code appears as fo ...

What is the best way to create vertical separators between CSS grid elements?

I currently have a grid with 3 columns and would like to add two vertical lines to separate the elements. To achieve this, I have placed two span elements between the grid elements using css styling. .vertical_line { position: absolute; height: 100%; ...

The navigation bar on the website highlights vibrant green arrows next to the

I'm having trouble implementing a bootstrap menu on my website using the code provided by Bootstrap. The menu is not displaying correctly and instead showing small green UL arrows. I have JavaScript and Bootstrap scripts in my project. Is there a way ...

Is there a way to replicate the Vista Command Link in HTML?

This particular dialog mimics the design of a Windows Vista Command Link: View image here: http://i.msdn.microsoft.com/Aa511455.commandlinks01(en-us,MSDN.10).png I'm curious if anyone has created HTML code that replicates the appearance and function ...

Eliminating padding or margin for figures in Bootstrap on smaller screens

I've been struggling to create a fullscreen image on small devices without any margin or padding. Unfortunately, the solutions suggested in this thread didn't work for me. Below is the code I'm currently using (tested on https://jsfiddle.n ...

Issue with PHP form submission not functioning within a table when utilizing jQuery

I've created a function that retrieves user data. function returnChild(){ global $pdo; $stmt = $pdo->prepare("SELECT * FROM children INNER JOIN districts ON children.ch_district = districts.dst_id ...

Try repeating the Ajax request until it is successful

Is there a way to continuously repeat an Ajax request until it returns 1, and stop if it returns 0? while(1){ $.ajax({ type: "POST", url: '/admin/importdata/', data: $info, dataType: "json", success: function($result) { ...

When implementing jQuery $.ajax with Angular, the DOM fails to update

Based on the value retrieved from an XHR call to the server, I am looking to display different content: <div class="container"> <div class="header" ng-controller="MyController"> <div ng-switch on="myScopeVar"> <d ...

Resolving issues with setting up d3.js in the 'Creating a Custom Map' guide

Starting Mike Bostock's tutorial on creating a map, but facing some installation issues at the beginning. I am using Windows 8.1 for this. This is the specific part that's causing trouble: "To get started, you'll need the reference implemen ...

retrieve PHP function calls as an array using Ajax

While working in PHP, I have encountered a situation where I needed to call a PHP function using AJAX: <button onclick="loop()">Do It</button> function loop() { $.get("ajax.php", { action: "true" }, function(result) { $("in ...