1 (edited by 2010-11-30 16:24:31)

Topic: [HACK] Ban Registered Users

Title: Article Within Multiple Categories
Author: NyNe
Cutenews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: there are 4 user levels, this hack makes a 5th called 'banned'.
So if you are sick of flames, set it so only registered users can post, get the register.php (and i recomend lostpass.php) and then install this hack so you can set users to banned
The banned status prevents users from logging into the news system, so they can not change their profile information, which is useful with the souped up register.php which has an option to only allow one username per e-mail address
*UPDATE* forces banned users to logout after the login sequence (it didnt let them login before but this is just added security)
Instructions:
open functions.inc.php
find:

(strtolower($member_db[2]) == strtolower($username) && $member_db[3] == $md5_password)


replace with:

(strtolower($member_db[2]) == strtolower($username) && $member_db[3] == $md5_password && $member_db[1] != "5")

open editusers.mdu
find:

   <option value=4>4 (commenter)</option>
    <option selected value=3>3 (journalist)</option>
   <option value=2>2 (editor)</option>
   <option value=1>1 (administrator)</option>


add above:

    <option value=5>5 (banned)</option>


find:

   <tr>
   <td valign="top"> Administrator : have full access and privilegies

     Editor : can add news and edit others posts

     Journalist : can only add and edit own news

     Commenter : only post comments</td>
   </tr>


replace with:

   <tr>
   <td valign="top"> Administrator : have full access and privilegies

     Editor : can add news and edit others posts

     Journalist : can only add and edit own news

     Commenter : only post comments

     Banned : can not do anything</td>
  </tr>


find:

case 4: $user_level = "commenter"; break;


add under:

case 5: $user_level = "banned"; break;


find:

case "4": $level = "commenter"; break;


add under:

case "5": $level = "banned"; break;


find:

if($user_arr[1] == 4){echo" <option value=4 selected>4 (commenter)</option>";}   else {echo" <option value=4>4 (commenter)</option>";}


add above:

if($user_arr[1] == 5){echo" <option value=5 selected>5 (banned)</option>";}   else {echo" <option value=5>5 (banned)</option>";}

open shows.inc.php
find:

if((strtolower($user_arr[2]) == strtolower($name) or strtolower($user_arr[4]) == strtolower($name)) and    ($user_arr[3] != $CNpass and $user_arr[3] != md5($password))   and $name != "")


add under:

if ($user_arr[1] == "5") {
echo"<div style=\"text-align: center;\">This name is banned from commenting.</div>";
       $CN_HALT = TRUE;
     break 2;
} else {


find:

if(strtolower($user_arr[2]) == strtolower($name)) $is_member = TRUE;


add above:

}

open main.mdu
find:

if($member_db[1] == 4 and $action == "dologin"){ header("Location: $config_http_script_dir/index.php?mod=options&action=personal"); exit; }


add under:

if($member_db[1] == 5 and $action == "dologin"){ header("Location: $config_http_script_dir/index.php?action=logout"); exit; }

2 (edited by 2004-12-05 00:25:57)

Re: [HACK] Ban Registered Users

this looks great.

I'm interested in easily and userfriendly removing and banning users and comments from cutenews and phpbb2, perhaps banning of the user can even be integrated between the two scripts, with the existing register integration mod between the two active... I won't be looking into this myself anytime soon though.

Re: [HACK] Ban Registered Users

well i dont use the integration script so you'll have to figure it out yourself sometime though this script and the disable comments script in the hacks section *should* both work even with that hack