Jump to content

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


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

Guest
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.