Resolved seconds after posting 😐
I was running the wrong query:
$query2 = "SELECT auth FROM users WHERE username = '$username'";
$result2 = mysql_query($query) or die(mysql_error());
Should of been:
$query2 = "SELECT auth FROM users WHERE username = '$username'";
$result2 = mysql_query($query2) or die(mysql_error());
This script doesn't seem to work right, your ment to only be able to delete the users when your rank is higher than the person you want to delete:
echo "Attempting to delete $username...<br />";
$youruser = $_COOKIE['iHomeLogin'];
$query = "SELECT auth FROM users WHERE username = '$youruser'";
$result = mysql_query($query) or die(mysql_error());
$query2 = "SELECT auth FROM users WHERE username = '$username'";
$result2 = mysql_query($query) or die(mysql_error());
$curuser = mysql_result($result, 0);
$otheruser = mysql_result($result2, 0);
echo "$curuser, $otheruser";
if($curuser > $otheruser) {
$query = "DELETE FROM users WHERE username = '$username'";
$result = mysql_query($query);
echo "$username has been deleted from the database, <a href=http://sam.exofire.net/admin/admincp.php?location=home>back</a>.";
}
else {
echo "You are not a high enough rank to delete this user.";
}
Any help? it seems that the query returns that the user trying to be deleted has the same rank as the user that is trying to delete it, even though its doesn't.