infosec/Introduccion-hacking-hack4u/tema_6_owasp/01_sqli/searchUsers2.php

21 lines
449 B
PHP
Raw Normal View History

2024-02-12 22:18:28 +01:00
<?php
$server = "localhost";
$username = "s4vitar";
$password = "s4vitar123";
$database = "Hack4u";
// Establecer conexión
$conn = new mysqli($server, $username, $password, $database);
$id = mysqli_real_escape_string($conn, $_GET['id']);
$data = mysqli_query($conn, "select username from users where id = $id");
$response = mysqli_fetch_array($data);
if(!isset($response['username'])){
http_response_code(404);
}
?>