dolibarr 25.0.0-alpha
credentials.php
Go to the documentation of this file.
1<?php
26// Load Dolibarr environment
27require '../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
40require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
42require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
43require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
48require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
49require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
50require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
51require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
52if (isModEnabled('ldap')) {
53 require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
54}
55if (isModEnabled('member')) {
56 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
57}
58if (isModEnabled('category')) {
59 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
60}
61if (isModEnabled('stock')) {
62 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
63}
64
65// Load translation files required by page
66$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks', 'other'));
67
68$id = GETPOSTINT('id');
69$action = GETPOST('action', 'aZ09');
70$mode = GETPOST('mode', 'alpha');
71$confirm = GETPOST('confirm', 'alpha');
72$optioncss = GETPOST('optioncss', 'aZ09');
73$cancel = GETPOST('cancel', 'alpha');
74$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'usercredentials'; // To manage different context of search
75$backtopage = GETPOST('backtopage');
76$backtopageforcancel = GETPOST('backtopageforcancel');
77
78$group = GETPOSTINT("group", 3);
79
80// Load variable for pagination
81$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
82$sortfield = GETPOST('sortfield', 'aZ09comma');
83$sortorder = GETPOST('sortorder', 'aZ09comma');
84$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
85if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
86 // If $page is not defined, or '' or -1 or if we click on clear filters
87 $page = 0;
88}
89$offset = $limit * $page;
90$pageprev = $page - 1;
91$pagenext = $page + 1;
92
93
94if (empty($id) && $action != 'add' && $action != 'create') {
95 $id = $user->id;
96}
97
98$object = new User($db);
99
100// fetch optionals attributes and labels
101$extrafields->fetch_name_optionals_label($object->table_element);
102
103// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
104$hookmanager->initHooks(array('usercard', 'globalcard'));
105
106$error = 0;
107
108if ($id > 0) {
109 $res = $object->fetch($id, '', '', 1);
110}
111
112// Security check
113$socid = 0;
114if ($user->socid > 0) {
115 $socid = $user->socid;
116}
117$feature2 = 'user';
118$result = restrictedArea($user, 'user', $id, 'user', $feature2);
119
120// Define value to know what current user can do on users. A test on logged user is done later to complete
121$permissiontoadd = (!empty($user->admin) || $user->hasRight("user", "user", "write")) && (empty($user->socid) || $user->socid == $object->socid);
122$permissiontoread = (!empty($user->admin) || $user->hasRight("user", "user", "read")) && (empty($user->socid) || $user->socid == $object->socid);
123$permissiontoedit = (!empty($user->admin) || $user->hasRight("user", "user", "write")) && (empty($user->socid) || $user->socid == $object->socid);
124$permissiontodisable = (!empty($user->admin) || $user->hasRight("user", "user", "delete")) && (empty($user->socid) || $user->socid == $object->socid);
125$permissiontoreadgroup = $permissiontoread;
126$permissiontoeditgroup = $permissiontoedit;
127if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
128 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read")) && (empty($user->socid) || $user->socid == $object->socid);
129 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write")) && (empty($user->socid) || $user->socid == $object->socid);
130}
131
132$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
133$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
134$permissiontocloneuser = $permissiontoadd;
135// Can clone only in master entity if transverse mode is used
136if (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity > 1) {
137 $permissiontoclonesuperadmin = false;
138 $permissiontocloneadmin = false;
139 $permissiontocloneuser = false;
140}
141
142if ($user->id != $id && !$permissiontoread) {
144}
145
146$caneditpasswordandsee = false;
147$caneditpasswordandsend = false;
148
149// Define value to know what current user can do on properties of edited user
150$permissiontoeditpasswordandsee = false;
151$permissiontoeditpasswordandsend = false;
152if ($id > 0) {
153 // $user is the current logged user, $id is the user we want to edit
154 $permissiontoedit = ((($user->id == $id) && $user->hasRight("user", "self", "write")) || (($user->id != $id) && $user->hasRight("user", "user", "write"))) && (empty($user->socid) || $user->socid == $object->socid);
155 $permissiontoeditpasswordandsee = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password") && $user->admin)) && (empty($user->socid) || $user->socid == $object->socid);
156 $permissiontoeditpasswordandsend = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password"))) && (empty($user->socid) || $user->socid == $object->socid);
157}
158
159
160/*
161 * Actions
162 */
163
164$parameters = array('id' => $id, 'socid' => $socid, 'group' => $group, 'caneditgroup' => $permissiontoeditgroup);
165$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
166if ($reshook < 0) {
167 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
168}
169
170if (empty($reshook)) {
171 $backurlforlist = DOL_URL_ROOT.'/user/list.php';
172
173 if (empty($backtopage) || ($cancel && empty($id))) {
174 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
175 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
176 $backtopage = $backurlforlist;
177 } else {
178 $backtopage = DOL_URL_ROOT.'/user/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
179 }
180 }
181 }
182
183 if ($cancel) {
184 if (!empty($backtopageforcancel)) {
185 header("Location: ".$backtopageforcancel);
186 exit;
187 } elseif (!empty($backtopage)) {
188 header("Location: ".$backtopage);
189 exit;
190 }
191 $action = '';
192 }
193
194 // Action to start a TOTP enrollment. A user enrolls only for themselves, so the secret is never known by anybody else.
195 if ($action == 'addtotp' && $permissiontoeditpasswordandsee && $user->id == $object->id && getDolGlobalString('MAIN_SECURITY_ALLOW_TOTP')) {
196 if (dolTotpGetEnrollment($db, $object->id) !== null) {
197 setEventMessages($langs->trans("TOTPAlreadyEnrolled"), null, 'warnings');
198 $action = '';
199 } elseif (empty($_SESSION['dol_totp_enroll'][$object->id]) || $_SESSION['dol_totp_enroll'][$object->id]['expire'] < dol_now()) {
200 // The candidate secret stays in session and reaches the database only once a valid code has confirmed it
201 $_SESSION['dol_totp_enroll'][$object->id] = array('secret' => dolTotpNewSecret(), 'expire' => dol_now() + 600);
202 }
203 }
204
205 // Action to confirm a TOTP enrollment with a first valid code, which proves the application is correctly set up.
206 // The user is authenticated and sees the secret on the same page, so there is nothing to guess: the attempts are capped only to be safe.
207 if ($action == 'confirmtotp' && $permissiontoeditpasswordandsee && $user->id == $object->id && getDolGlobalString('MAIN_SECURITY_ALLOW_TOTP')) {
208 $enroll = empty($_SESSION['dol_totp_enroll'][$object->id]) ? array() : $_SESSION['dol_totp_enroll'][$object->id];
209 if (empty($enroll['secret']) || $enroll['expire'] < dol_now()) {
210 unset($_SESSION['dol_totp_enroll'][$object->id]);
211 setEventMessages($langs->trans("TOTPEnrollmentExpired"), null, 'errors');
212 $action = '';
213 } else {
214 $laststep = dolTotpCheckCode($enroll['secret'], GETPOST('totpcode', 'alphanohtml', 2));
215 if ($laststep <= 0) {
216 dol_syslog("Two-factor authentication enrollment of ".$object->login.": confirmation code refused", LOG_WARNING);
217 $_SESSION['dol_totp_enroll'][$object->id]['tries'] = (empty($enroll['tries']) ? 0 : $enroll['tries']) + 1;
218 if ($_SESSION['dol_totp_enroll'][$object->id]['tries'] >= 5) { // A new secret is generated by the next enrollment
219 unset($_SESSION['dol_totp_enroll'][$object->id]);
220 setEventMessages($langs->trans("TOTPEnrollmentExpired"), null, 'errors');
221 $action = '';
222 } else {
223 setEventMessages($langs->trans("TOTPBadCode"), null, 'errors');
224 $action = 'addtotp';
225 }
226 } else {
227 $result = dolTotpSaveEnrollment($db, $object->id, $enroll['secret'], $laststep, $object->entity);
228 if ($result > 0) {
229 unset($_SESSION['dol_totp_enroll'][$object->id]);
230 dol_syslog("Two-factor authentication enabled for ".$object->login, LOG_NOTICE);
231 setEventMessages($langs->trans("TOTPEnrolled"), null, 'mesgs');
232 $action = '';
233 } elseif ($result == -2) {
234 unset($_SESSION['dol_totp_enroll'][$object->id]);
235 setEventMessages($langs->trans("TOTPNoEncryptionKey"), null, 'errors');
236 $action = '';
237 } else {
238 setEventMessages($db->lasterror(), null, 'errors');
239 $action = 'addtotp';
240 }
241 }
242 }
243 }
244
245 // Action to give up an enrollment in progress: the candidate secret is dropped, a new enrollment will show a new one
246 if ($action == 'canceltotp' && $permissiontoeditpasswordandsee && $user->id == $object->id) {
247 unset($_SESSION['dol_totp_enroll'][$object->id]);
248 $action = '';
249 }
250
251 // Action to remove a TOTP enrollment. Not conditioned by MAIN_SECURITY_ALLOW_TOTP, so an admin can still remove one after the option has been turned off.
252 if ($action == 'confirm_deletetotp' && $confirm == 'yes' && $permissiontoeditpasswordandsee) {
253 if (dolTotpDeleteEnrollment($db, $object->id) > 0) {
254 dol_syslog("Two-factor authentication disabled for ".$object->login." by ".$user->login, LOG_WARNING);
255 setEventMessages($langs->trans("TOTPRemoved"), null, 'mesgs');
256 } else {
257 setEventMessages($db->lasterror(), null, 'errors');
258 }
259 $action = '';
260 }
261}
262
263
264/*
265 * View
266 */
267
268$form = new Form($db);
269
270$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
271$title = $person_name." - ".$langs->trans('Credentials');
272$help_url = '';
273
274if ($action == 'addtotp') { // This page shows the secret of an enrollment, it must not stay in any cache: same headers as top_httphead() with $forcenocache
275 header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
276}
277
278llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-credentials');
279
280$param = '';
281
282
283// Section TOTP
284
285// Panel of an enrollment in progress. The secret is shown here and nowhere else, as a QR code to scan and as a key to type by hand.
286if ($action == 'addtotp' && $user->id == $object->id && !empty($_SESSION['dol_totp_enroll'][$object->id]['secret'])) {
287 $secrettoshow = $_SESSION['dol_totp_enroll'][$object->id]['secret'];
288
289 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
290 print '<input type="hidden" name="token" value="'.newToken().'">';
291 print '<input type="hidden" name="action" value="confirmtotp">';
292 print '<input type="hidden" name="id" value="'.((int) $object->id).'">';
293 print '<div class="info">';
294 print '<div class="paddingbottom">'.$langs->trans("TOTPScanQrCode").'</div>';
295
296 require_once TCPDF_PATH.'tcpdf_barcodes_2d.php';
297 $qrobj = new TCPDF2DBarcode(dolTotpGetUri($object->login, $secrettoshow), 'QRCODE,M');
298 $qrpng = $qrobj->getBarcodePngData(4, 4, array(0, 0, 0));
299 if (!empty($qrpng)) {
300 print '<div class="paddingbottom"><img src="data:image/png;base64,'.base64_encode($qrpng).'" alt=""></div>';
301 }
302
303 print '<div class="paddingbottom">'.$langs->trans("TOTPOrTypeKey").' <strong>'.dolPrintLabel(trim(chunk_split($secrettoshow, 4, ' '))).'</strong></div>';
304 print '<div>'.$langs->trans("TOTPConfirmCode").' ';
305 print '<input type="text" name="totpcode" class="width75" autocomplete="off" inputmode="numeric" maxlength="8" autofocus>';
306 print ' <input type="submit" class="button small" value="'.$langs->trans("Validate").'">';
307 print ' <a class="button button-cancel small" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=canceltotp&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
308 print '</div>';
309 print '</div><br>';
310 print '</form>';
311}
312
313print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
314print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
315print '<input type="hidden" name="token" value="'.newToken().'">';
316print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
317print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
318print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
319print '<input type="hidden" name="page" value="'.$page.'">';
320print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
321print '<input type="hidden" name="page_y" value="">';
322print '<input type="hidden" name="mode" value="'.$mode.'">';
323
324//$tmpurlforbutton = 'javascript:console.log("open add totp form");jQuery(".divsectiontotp").toggle(); void(0);';
325
326// A user has at most one enrollment, and enrolls only for themselves
327$totpenrollment = dolTotpGetEnrollment($db, $object->id);
328$cancreatetotp = ($permissiontoeditpasswordandsee && $user->id == $object->id && getDolGlobalString('MAIN_SECURITY_ALLOW_TOTP') && $totpenrollment === null);
329
330$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addtotp&token='.newToken(), '', $cancreatetotp ? 1 : 0);
331
332//$listoftotps = $user->fetchAll($sortorder, $sortfield, 1000, 0, "(fk_user:=:".((int) $object->id).") AND (service:=:'dolibarr_totp')", true);
333$nbtotalofrecords = $num = ($totpenrollment === null ? 0 : 1);
334
335$massactionbutton = '';
336
337print_barre_liste($langs->trans("TOTP"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, -1, 0, 1);
338
339/*
340print '<div class="hideobject divsectiontotp marginbottom">';
341print '<input placeholder="'.dolPrintHTML("TOPTSecret").'" class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST('api_key', 'alphanohtml').'" autocomplete="off">';
342if (!empty($conf->use_javascript_ajax)) {
343 print img_picto($langs->transnoentities('Generate'), 'refresh', 'id="generate_api_key" class="linkobject paddingleft"');
344}
345print '</div><br>';
346*/
347
348// Confirmation of the removal, which puts this user back to a password only login
349if ($action == 'deletetotp' && $permissiontoeditpasswordandsee) {
350 print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.((int) $object->id), $langs->trans('TOTPDisable'), $langs->trans('TOTPConfirmDisable', $object->login), 'confirm_deletetotp', '', 0, 1);
351}
352
353print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
354print '<table class="tagtable nobottomiftotal liste">'."\n";
355
356// Fields title label
357// --------------------------------------------------------------------
358print '<tr class="liste_titre">';
359print_liste_field_titre('TOTPEnrolledOn');
360print_liste_field_titre('TOTPLastUse');
361print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
362print '</tr>'."\n";
363
364// The secret itself is never listed: it is shown only once, during the enrollment
365if ($totpenrollment !== null) {
366 print '<tr class="oddeven">';
367 if (is_array($totpenrollment)) {
368 print '<td>'.dol_print_date($totpenrollment['datec'], 'dayhour').'</td>';
369 print '<td>'.($totpenrollment['lastaccess'] ? dol_print_date($totpenrollment['lastaccess'], 'dayhour') : '<span class="opacitymedium">'.$langs->trans("Never").'</span>').'</td>';
370 } else {
371 print '<td colspan="2"><span class="error">'.$langs->trans("TOTPUnreadableEnrollment").'</span></td>'; // The row exists but can't be read: only the removal is possible
372 }
373 print '<td class="center nowraponall">';
374 if ($permissiontoeditpasswordandsee) {
375 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deletetotp&token='.newToken().'">'.img_delete($langs->trans("TOTPDisable")).'</a>';
376 }
377 print '</td>';
378 print '</tr>';
379} else {
380 print '<tr><td colspan="3"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
381}
382
383print '</table>'."\n";
384print '</div>'."\n";
385
386print '</form>';
387
388// Add button to autosuggest a key
389include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
390print dolJSToSetRandomPassword('password', 'generate_password', 0);
391if (isModEnabled('api')) {
392 print dolJSToSetRandomPassword('api_key', 'generate_api_key', 1);
393}
394
395
396
397
398// Section Other
399
400// ...
401
402
403
404// End of page
405llxFooter();
406$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage generation of HTML components Only common components must be here.
Class to manage Dolibarr users.
dol_now($mode='gmt')
Return date for now.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolTotpSaveEnrollment($db, $fk_user, $secret, $laststep, $entity=1)
Save a TOTP enrollment confirmed by a valid code.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
dolTotpNewSecret($nbbytes=20)
Generate a new secret for a TOTP enrollment (RFC 6238), in the base32 form expected by the authentica...
dolTotpDeleteEnrollment($db, $fk_user)
Delete the TOTP enrollment of a user, who then logs in with the password only again.
dolTotpGetUri($login, $base32secret, $issuer='', $digits=6, $period=30)
Build the otpauth:// URI of an enrollment, to be shown as a QR code to the user.
dolTotpCheckCode($base32secret, $code, $timestamp=0, $period=30, $digits=6, $drift=1)
Check a code sent by a user against a secret, accepting a drift of some periods to tolerate a clock o...
dolTotpGetEnrollment($db, $fk_user)
Load the TOTP enrollment of a user.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.