Icy Phoenix


Documentation And How To - CUSTOMIZATION - Adding New Kind Of Users For Preventing Not Auth Acces



novice programmer [ Wed 25 Jul, 2007 22:23 ]
Post 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: [Hide] [Select]
includes/constants.php

and there seach for:

Code: [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: [Hide] [Select]
define('TEXT', NUMBER);


create a new type of user
Ex:

Code: [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: [Hide] [Select]
adm/admin_db_utilities.php


by typying at the start of the file (easymod style):
Code: [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.


Mighty Gorgon [ Thu 26 Jul, 2007 00:22 ]
Post 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: [Hide]
  1. $user_level == ADMIN 


is perfectly identical to
Code: [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.


novice programmer [ Thu 26 Jul, 2007 22:09 ]
Post 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.


novice programmer [ Fri 27 Jul, 2007 21:27 ]
Post 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: [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!!!


novice programmer [ Fri 27 Jul, 2007 21:47 ]
Post subject: Re: Adding New Kind Of Users For Preventing Not Auth Acces
for allow only the first user entry (easymod style):

Code: [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.




Powered by Icy Phoenix