-1
Hello, next I made a system that works, but I am doubtful whether it is safe to use it to ensure that it has greater security or at least try to obtain it. I’m using a function that only reads numbers on mysql, but I’m still a beginner and would like a second opinion on.
Could someone please let me know if it’s safe or if there’s anything else to keep safe?
Code:
$id = $_COOKIE["id"]; //Nome do cookie
$novoId = "$cont[id]"; // Novo id, value exemplo "1,2,3,4" adiciona novo valor apos virgula
if (!preg_match("/\b{$novoId}\b/", $id)) {
setcookie("id", $id .= "{$novoId},");
}
$historico = explode(",", $id);
$histanime = array_filter($historico, function($value) {
/* Retorna apenas os números inteiros */
return is_numeric($value);
});
if(($quantidade = count($histanime)) > 30){
$histanime = array_slice($histanime, $quantidade - 30, 30);
}
$ids5 = implode(",", $histanime) ;
and the consultation on mysql and made with a while:
$cont = mysql_query("SELECT title,titulo2,url,imagen FROM `lista` WHERE aid IN($ids5)");
while (list($title, $titulo2, $url, $Imagen) = mysql_fetch_array($cont))
it can only query numbers, @Marcelo Rafael, users are saved in another table. how many numbers they represent only site id pages.
– Gabriel