Jump to content

*SOLVED* $r = my_query("select hold from users where hold='y'");


StirCrazy

Recommended Posts

Wonder if someone can help me:

I already have a login script fully working and have decided to add a banning function.

I want to add to the login code... something along these lines:

$r = my_query("select hold from users where hold='y'");

[b]if user is hold='y' then Location: banned.php[/b]


Sorry, find it hard to explain ~ Can anyone help with the proper syntax?

Kind Regards,
S.C>


[b]Table name: Users | Column: hold | enum ('y','n')[/b]
Do this:
[code]$sql = "SELECT * FROM users";
$query = mysql_query($sql) or die("MySQL Error: " . $query . " : " . mysql_error());

$user = mysql_fetch_array($query);

if($user['hold'] == "Y")
{
    header("Location: banned.php");
}

//continue login process or what ever here as user is not banned.

[/code]
You need to check the "hold" value for a specific user using something like
[code]
.. WHERE userid = '$user'"[/code]

In the code above, if the first record in the table has a value of "y" then everyone gets sent to banned.php.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.