CUSTOMIZATION - Adding New Kind Of Users For Preventing Not Auth Acces


Subject: CUSTOMIZATION - Adding New Kind Of Users For Preventing Not Auth Acces
To create a new range of users (reg, mod, admins,...) we have to go to the file:

Code: [Download] [Hide] [Select]
includes/constants.php

and there seach for:

Code: [Download] [Hide] [Select]
// User Levels <- Do not change the values of USER or ADMIN
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 0);
define('ADMIN', 1);
define('MOD', 2);
define('GLOBAL_MOD', 3);
define('JUNIOR_ADMIN', 4);


and after that, before the next "//" with the sintax:

Code: [Download] [Hide] [Select]
define('TEXT', NUMBER);


create a new type of user
Ex:

Code: [Download] [Hide] [Select]
define('GREAT_ADMIN', 5)


So we´ve changed the red coloured zones.
NOTE THAT: we´ve choosed the number 5, but you can put any number that you want in that zone.

ANOTHER NOTE: the valve "GREAT_ADMIN" is an example, you can put what you want


=============================================================================

UTILITY: you can use this to disallow ohers admins to entry into the file

Code: [Download] [Hide] [Select]
adm/admin_db_utilities.php


by typying at the start of the file (easymod style):
Code: [Download] [Hide] [Select]

-----------SEARCH-------------------

$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);

-----------AFTER, ADD---------------

if( $userdata['user_level'] != ADMIN && $userdata['user_id'] != 2 )
redirect($phpbb_root_path . 'errors.'.$phpbbEx.'?code=401');



==================================================================

NOTE: You can use this in any file.


----------------------------------------------------

How to modify the rank of auths:

Enter into a db manager with editor.

GO to the table "prefix+users"
Modify the user to apply auth
In "user_level" put the number of the define command.

That´s all.

Profile PM  
Subject: Re: Adding New Kind Of Users For Preventing Not Auth Acces
Thanks for this tutorial... I've edited your message inserting HIGHLIGHT command in code instead of COLOR BBCode which is not working in CODE tag.

Finally I would just to add that if you define a constant is because you don't want to remember all the number assigned... so, for example if you put:
Code: [Download] [Hide]
  1. $user_level == ADMIN 


is perfectly identical to
Code: [Download] [Hide]
  1. $user_level == 1 


Because you set ADMIN = 1 as a constant.

Finally if you define new users type, you need then to specify elsewhere how a user can have a different level... otherwise you need to change each user level directly into phpMyAdmin.

Subject: Re: Adding New Kind Of Users For Preventing Not Auth Acces
novice programmer wrote: [View Post]

How to modify the rank of auths:

Enter into a db manager with editor.

GO to the table "prefix+users"
Modify the user to apply auth
In "user_level" put the number of the define command.

That´s all.


That explain how to change, as you said with:

Mighty Gorgon wrote: [View Post]

Finally if you define new users type, you need then to specify elsewhere how a user can have a different level... otherwise you need to change each user level directly into phpMyAdmin.

Profile PM  
Subject: Re: Adding New Kind Of Users For Preventing Not Auth Acces
Thanks for explains & changes.

There is another tho things:

If you want to disallow all users to entry the file put (easymod style):

Code: [Download] [Hide] [Select]

-----------[SEARCH]---------------------

$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx);

------------[AFTER, ADD]------------------

redirect('/errors.'.$phpEx.'?code=401');



WARING: THIS WILL DISALLOW YOURSELF TO ENTER THAT FILE!!!

Profile PM  
Subject: Re: Adding New Kind Of Users For Preventing Not Auth Acces
for allow only the first user entry (easymod style):

Code: [Download] [Hide] [Select]

---------[SEARCH]-------------------------------

require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx);

--------[AFTER, ADD]---------------------------

if ( $userdata['user_id'] != 2)
redirect('/errors.'.$phpEx.'?code=401');



That´s all.

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.9131s (PHP: 3% SQL: 97%)
SQL queries: 18 - Debug Off - GZIP Enabled