MyBB Community Forums

Full Version: check ban user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
guys i need a function to add on my external php script for check ban on mybb users

I want this function check the database if user is banned, return this echo:
line 1: you are banned from this board
line 2: ban reason: $banreason
line 3: ban time: $bantime

look guys i dont programer so i know this code have many problem i just want to show you what i need :

<?php
class ban
  {
    Function check_ban($uid)
    {
      $sql = "Select * From mybb_banned ORDER BY dateline DESC LIMIT 30";
      $result=mysql_query($sql);
	  
      if($mybb->user['uid'] = $result2 ['uid'])
        {
		 return array( 'banreason' => $result['baneason'] ,
					   'bantime'   => $result[ 'bantime' ],
				     );
        }
    }
}

$result2 = $ban->check_ban( $uid );
	
	if( $result == false )
	{
		echo "you are banned\n" ;
		echo $result[ 'banreason' ]."\n" ;
		echo $result[ 'bantime' ] ;
	}
?>



Thank you

and waiting :|
pleas someone ask to my question. Mybb Staff?
It'd be good if it were in the right forum...
Why don't you simply check the current user's group id whether it is banned group (7) or not?

Or you can just fetch the data from mybb_banned table and verify the current user's uid is in that table's uid column or not and fetch the related info from the table accordingly ...
Nice idea but i need a code to use that so pls give me code.