So i was trying to execute this simple query:
SELECT *
FROM users
WHERE Username = 'xyz'
AND OS = 'Windows 10/Server 2016'
AND HWID = 'FFrWkNSa1l3TURjek1FWXdNUT09'
AND MACAddress = '33D255CCFDAD'
This is what i tried alongside many others:
$q1 = "SELECT * FROM users WHERE Username = '".urldecode($_GET['userName'])."' AND OS = '".urldecode($_GET['OS'])."' AND HWID = '".$HWID."' AND MACAddress = '".$mac."'";
$systemMatches = $mysqli->query($q1);
if($systemMatches->num_rows == 1)
{
echo"Valid System";
}else{
echo"Invalid System";
}
ALL Variables are beeing grabbed from the url-parameter and 100% CORRECT (I have triple checked.)
Maybe something is wrong with the variable OS...? This is the raw version of OS: Windows%2010/Server%202016.
As you can see, it includes 2x spaces. I handled the spaces by using urldecode(). I even checked via echo and it decoded the spaces perfectly: Windows 10/Server 2016. But still something not working, would appreciate any kind of help as i am pretty new to mysql, thanks!
PS: That query is working fine when executing in phpmyadmin with the same given variables.
UPDATED CODE - STILL PRINTING: INVALID SYSTEM :(
$userName = $mysqli->real_escape_string($_GET['userName']);
$OS = $mysqli->real_escape_string($_GET['OS']);
$HWID = $mysqli->real_escape_string($_GET['HWID']);
$mac = $mysqli->real_escape_string($_GET['mac']);
$q1 = "SELECT * FROM users WHERE Username = '".$userName."' AND OS = '".$OS."' AND HWID = '".$HWID."' AND MACAddress = '".$mac."'";
$systemMatches = $mysqli->query($q1);
if($userExists->num_rows == 1)
{
if($systemMatches->num_rows == 1)
{
echo"Valid System";
}else{
echo"Invalid System";
}