Jump to content

Can't get this code to work!


Recommended Posts

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:


    mysql_connect("localhost", "root", "<hidden>")or die("DB connection failed: " . mysql_error());
    mysql_select_db("bridge")or die("DB selection failed");




    $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){
     } else {
     echo("failiure<br />");


Here is the player_bans table as well:
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.