Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Can't get this code to work!

$
0
0
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:
 
4Dw3i6e.png

Viewing all articles
Browse latest Browse all 13200

Trending Articles