Topic: How do i...

<?php
    //this file must be in the same directory as the config.php file along with your other forum files.
    include 'include/functions.php';
    include 'config.php';
    
    $user = trim($_GET['u']);
    $pass = pun_hash(trim($_GET['p']));
    //this is the only thing you need to edit. Each Member group has its own id, admin = 1, mod = 2, 3 = guest, 4 = member. Ok, so basically you put each group id into this array that you want to be able to use the bot.
    $validids = array(1,2,4);
    
    $dbc = mysql_connect($db_host, $db_username, $db_password);
    
    if(!$dbc)
        die('error connecting');
        
    $selectdb = mysql_select_db($db_name,$dbc);
    
    if(!$selectdb)
        die('error selecting');
    
      $query = 'SELECT * FROM `users` WHERE username = \''.$user.'\'';
    
    $result = mysql_query($query) or die('query error');
    
    $array = mysql_fetch_array($result);
    
    $corpass = $array['password'];
    if($pass == $corpass)
    {
        if(in_array($array['group_id'],$validids))
            die('valid');
        else 
            die('invalid');
    }

    die('invalid');   
?>

This returns whether a certain name & password exists on my forums
It shows "valid" if they exist
"invalid" if they dont.

How would i get it to show banned if a user is banned?
anyone help?

Re: How do i...

Simplest way would be to modify the query like this

$query = 'SELECT password, group_id, b.id FROM `users` AS u LEFT JOIN `bans` AS b ON u.username = b.username WHERE u.username = \''.$user.'\'';

and then add a check into the code lower down

    if($pass == $corpass)
    {
        if ($array['id'])
            die('banned');
        elseif(in_array($array['group_id'],$validids))
            die('valid');
        else 
            die('invalid');
    }

Re: How do i...

thx m8 big_smile