<?php
ob_start();
include 'connection.php';
$user_id = $_POST ['user_id'];
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM Register WHERE username= '$username' AND Password = '$password' ";
$result = mysqli_query($connection, $query) or exit("Error in the query: $query. " . mysqli_error());
$row = mysqli_fetch_assoc($result);
if ($row ) {
$_SESSION['username'] = $username;
echo '' . $username . '';
&& ($row ) {
$_SESSION['user_id'] = 1;
header('Location: AdminPage.php');
}
else if ($row ) {
$_SESSION['username'] = $username;
echo '' . $username . '';
header('location:Login.php');
&& ($row ) {
$_SESSION['user_id'] = > 1;
header('Location: ProtectedPage.php');
}
?>
can you help me with what is wrong with this code im trying to make it detect what is a user and what is an admin then direct it to the correct page. please if you are here to just rant about how vulnerable my code is to sql injections i really couldn't care less as this is for a project and i do not require it to be protected