Answer the question
In order to leave comments, you need to log in
Is it so bad to work directly to the server and the client?
A game where more than one player can be on the same stage.
Foreword
<?php
if(empty($_POST['Key1']) || empty($_POST['Key2']) || empty($_POST['ServerKey'])) exit();
$key1=$mysqli->real_escape_string(strval($_POST['Key1']));
$key2=$mysqli->real_escape_string(strval($_POST['Key2']));
if($mysqli->real_escape_string(strval($_POST['ServerKey']))!="oiervu3h498gh41hg[0h3b2%#[email protected]#134t3") exit();
$mysqli=new mysqli('localhost','root','.................','table');
if(!$mysqli) die('Error Connect: '.mysql_error());
$r=$mysqli->query("SELECT `id` FROM `users` WHERE `key1`='".$key1."' AND `key2`='".$key2."' LIMIT 1");
if(mysqli_num_rows($r)!=1){
mysqli_free_result($r);
$mysqli->close();
exit();
}
# Если ключи совпадают то вытягивать нужные данные и возвращать
$mysqli->close();
exit();
?>
Answer the question
In order to leave comments, you need to log in
Keeping realtime in the database, and even in sql, is bad.
It is extremely desirable to do realtime on sockets.
As for protection - if the request is not signed - then what prevents me from intercepting it and modifying it? All these keys, if it's just part of the request and does not depend in any way AT LEAST on the content of the request, then they are of no use.
I would take ready-made solutions FOR THE FIRST TIME, and not make a real-time bicycle. Shoot - rewrite.
Actually the question is - I read a lot where such appeals are directly harmfulWhat exactly is the harm? Very interesting.
Another question is whether there will be problems with the fact that it will be written in PHP, some write that it is with a large online (and some large online has 500+) will hang up the server, they say it’s better in C # ...See how to write.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question