Bonsoir, je cherche de l'aide auprès de vous car je m'y connais très peu en php et donc j'ai une erreur comme ceci Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\manuallogin.php:12 Stack trace: #0 C:\xampp\htdocs\manuallogin.php(12): mysqli_num_rows(false) #1 {main} thrown in C:\xampp\htdocs\manuallogin.php on line 12
voici mon fichier
voici mon fichier
Code:
<?php
session_start();
$allowed = false;
if(isset($_POST["username"]) && isset($_POST["password"])) {
include_once("game_conf.php");
$a3 = db_a3pl();
$user = htmlspecialchars($_POST["username"]);
$pass = sha1(md5($_POST["password"]));
//echo $pass;
$q = mysqli_query($a3,"SELECT steamid FROM `wl_admins_server` WHERE `nickname` = '{$user}' AND password = '{$pass}'");
if(mysqli_num_rows($q) > 0) {
while($r=mysqli_fetch_array($q)) {
$_SESSION['steamid'] = $r[0];
$_SESSION['logged_admin'] = true;
$_SESSION['logged'] = true;
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['activity'] = time();
$allowed = true;
}
}
}
if($allowed) {
header("Location: panel.php");
} else {
header("Location: index.php");
}
?>