Drakken_ Posted March 23, 2013 Share Posted March 23, 2013 So I have this code that checks if a user if banned on the website or not (Through a MySQL database) However, this code that DID IN FACT work, is not working anymore. Whenever I try to check if a player is banned, that I know for sure are banned, they show up as not banned. I have no clue what happened to change the way it works, but all I know is that is doesn't work anymore. Here is what I have: config.inc.php: <?php session_start(); error_reporting(1); mysql_connect("localhost", "root", "<hidden>")or die("DB connection failed: " . mysql_error()); mysql_select_db("bridge")or die("DB selection failed"); ?> index.php: <?php require_once("config.inc.php"); error_reporting(0); $action = $_GET["a"]; if ($action=="checkban"){ $player = $_GET["p"]; $username = mysql_real_escape_string($_GET["p"]); $result = mysql_query("SELECT * FROM player_bans WHERE UPPER(player_bans) = UPPER('$username') LIMIT 1"); $row = mysql_fetch_array($result); if ($row["banned"] == 1){ echo("success"); //send(array($row)); } else { echo("failiure<br />"); echo($row["banned"]); } } ?> Here is the player_bans table as well: Link to comment https://forums.phpfreaks.com/topic/276038-cant-get-this-code-to-work/ Share on other sites More sharing options...
Barand Posted March 23, 2013 Share Posted March 23, 2013 error_reporting(1) is a bit weak, try -1 instead. Why have you turned it off in index.php? Where is $username defined. Did you have register_globals ON and now it is OFF? Link to comment https://forums.phpfreaks.com/topic/276038-cant-get-this-code-to-work/#findComment-1420418 Share on other sites More sharing options...
Drakken_ Posted March 23, 2013 Author Share Posted March 23, 2013 <removed> Link to comment https://forums.phpfreaks.com/topic/276038-cant-get-this-code-to-work/#findComment-1420419 Share on other sites More sharing options...
Drakken_ Posted March 23, 2013 Author Share Posted March 23, 2013 error_reporting(1) is a bit weak, try -1 instead. Why have you turned it off in index.php? Where is $username defined. Did you have register_globals ON and now it is OFF? Fixed the error reporting, although doesn't fix the problem. What did I turn off in index.php? Username is defined on the 8th line of index.php $username = mysql_real_escape_string($_GET["p"]); What is register_globals? That isn't present in the code.. Link to comment https://forums.phpfreaks.com/topic/276038-cant-get-this-code-to-work/#findComment-1420420 Share on other sites More sharing options...
PaulRyan Posted March 23, 2013 Share Posted March 23, 2013 Shouldn't "UPPER(player_bans)" in fact be "UPPER(name)"? Link to comment https://forums.phpfreaks.com/topic/276038-cant-get-this-code-to-work/#findComment-1420478 Share on other sites More sharing options...
Barand Posted March 23, 2013 Share Posted March 23, 2013 What did I turn off in index.php? You turned off error reporting with error_reporting(0); http://php.net/manual/en/security.globals.php Link to comment https://forums.phpfreaks.com/topic/276038-cant-get-this-code-to-work/#findComment-1420479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.