dolibarr 24.0.1
security.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
41
42$action = GETPOST('action', 'aZ09');
43
44// Load translation files required by the page
45$langs->loadLangs(array("users", "admin", "other"));
46
47if (!$user->admin) {
49}
50
51// Allow/Disallow change to clear passwords once passwords are encrypted
52$allow_disable_encryption = false;
53
54
55/*
56 * Actions
57 */
58
59if ($action == 'setgeneraterule') {
60 if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', GETPOST("value", "alphanohtml"), 'chaine', 0, '', $conf->entity)) {
62 }
63}
64
65if ($action == 'activate_encrypt') {
66 $error = 0;
67
68 $db->begin();
69
70 // On old version, a bug created the constant into user entity, so we delete it to be sure such entry won't exists. We want it in entity 0 or nowhere.
71 dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", $conf->entity);
72 // We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody
73 $entityforall = 0;
74 dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $entityforall);
75
76 $sql = "SELECT u.rowid, u.pass, u.pass_crypted";
77 $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
78 $sql .= " WHERE u.pass IS NOT NULL AND LENGTH(u.pass) < 32"; // Not a MD5 value
79
80 $resql = $db->query($sql);
81 if ($resql) {
82 $numrows = $db->num_rows($resql);
83 $i = 0;
84 while ($i < $numrows) {
85 $obj = $db->fetch_object($resql);
86 if (dol_hash($obj->pass)) {
87 $sql = "UPDATE ".MAIN_DB_PREFIX."user";
88 $sql .= " SET pass_crypted = '".dol_hash($obj->pass)."', pass = NULL";
89 $sql .= " WHERE rowid=".((int) $obj->rowid);
90 //print $sql;
91
92 $resql2 = $db->query($sql);
93 if (!$resql2) {
95 $error++;
96 break;
97 }
98
99 $i++;
100 }
101 }
102 } else {
104 }
105
106 //print $error." ".$sql;
107 //exit;
108 if (!$error) {
109 $db->commit();
110 } else {
111 $db->rollback();
112 dol_print_error($db, '');
113 }
114} elseif ($action == 'disable_encrypt') {
115 // By default, $allow_disable_encryption is false we do not allow to disable encryption because passwords can't be decoded once encrypted.
116 // We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody
117 if ($allow_disable_encryption) {
118 dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", $conf->entity);
119 dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", 0);
120 }
121}
122
123if ($action == 'activate_encryptdbpassconf') {
124 $result = encodedecode_dbpassconf(1);
125 if ($result > 0) {
126 sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.
127
128 // database value not required
129 // dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1");
130 header("Location: security.php");
131 exit;
132 } else {
133 setEventMessages($langs->trans('InstrucToEncodePass', dolEncrypt($dolibarr_main_db_pass)), null, 'warnings');
134 }
135} elseif ($action == 'disable_encryptdbpassconf') {
136 $result = encodedecode_dbpassconf(0);
137 if ($result > 0) {
138 sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.
139
140 // database value not required
141 // dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED",$conf->entity);
142 header("Location: security.php");
143 exit;
144 } else {
145 // setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings');
146 setEventMessages($langs->trans('InstrucToClearPass', $langs->transnoentitiesnoconv("DatabasePassword")), null, 'warnings');
147 }
148}
149
150if ($action == 'activate_MAIN_SECURITY_DISABLEFORGETPASSLINK') {
151 dolibarr_set_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", '1', 'chaine', 0, '', $conf->entity);
152} elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') {
153 dolibarr_del_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", $conf->entity);
154}
155
156if ($action == 'updatepattern') {
157 $pattern = GETPOST("pattern", "alpha");
158 $explodePattern = explode(';', $pattern); // List of ints separated with ';' containing counts
159
160 $patternInError = false;
161 if ((int) $explodePattern[0] < 1 || (int) $explodePattern[4] < 0) {
162 $patternInError = true;
163 }
164
165 if ((int) $explodePattern[0] < (int) $explodePattern[1] + (int) $explodePattern[2] + (int) $explodePattern[3]) {
166 $patternInError = true;
167 }
168
169 if (!$patternInError) {
170 dolibarr_set_const($db, "USER_PASSWORD_PATTERN", $pattern, 'chaine', 0, '', $conf->entity);
171 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
172 header("Location: security.php");
173 exit;
174 }
175}
176
177
178
179/*
180 * View
181 */
182
183$form = new Form($db);
184
185$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
186llxHeader('', $langs->trans("Passwords"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-security');
187
188print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup');
189
190print '<div class="info">'.$langs->trans("GeneratedPasswordDesc")."</div>\n";
191
192
193$head = security_prepare_head();
194
195print dol_get_fiche_head($head, 'passwords', '', -1);
196
197print '<br>';
198
199// Select manager to generate passwords
200print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
201print '<input type="hidden" name="token" value="'.newToken().'">';
202print '<input type="hidden" name="action" value="update">';
203print '<input type="hidden" name="constname" value="USER_PASSWORD_GENERATED">';
204print '<input type="hidden" name="consttype" value="yesno">';
205
206// Load array with all password generation modules
207$dir = "../core/modules/security/generate";
208clearstatcache();
209$handle = opendir($dir);
210$i = 1;
211$arrayhandler = array();
212if (is_resource($handle)) {
213 while (($file = readdir($handle)) !== false) {
214 $reg = array();
215 if (preg_match('/(modGeneratePass[a-z]+)\.class\.php$/i', $file, $reg)) {
216 // Charging the numbering class
217 $classname = $reg[1];
218 require_once $dir.'/'.$file;
219
220 $obj = new $classname($db, $conf, $langs, $user);
221 '@phan-var-force ModeleGenPassword $obj';
222 $arrayhandler[$obj->id] = $obj;
223 $i++;
224 }
225 }
226 closedir($handle);
227}
228asort($arrayhandler);
229
230print '<div class="div-table-responsive-no-min">';
231print '<table class="noborder centpercent">';
232print '<tr class="liste_titre">';
233print '<td colspan="2">'.$langs->trans("RuleForGeneratedPasswords").'</td>';
234print '<td>'.$langs->trans("Example").'</td>';
235print '<td class="center">'.$langs->trans("Activated").'</td>';
236print '</tr>';
237
238$tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN'));
239
240foreach ($arrayhandler as $key => $module) {
241 // Show modules according to features level
242 if (!empty($module->version) && $module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
243 continue;
244 }
245 if (!empty($module->version) && $module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
246 continue;
247 }
248
249 if ($module->isEnabled()) {
250 print '<tr class="oddeven"><td>';
251 print img_picto('', $module->picto, 'class="width25 size15x marginrightonly"').' ';
252 print '<div class="refid inline-block">'.ucfirst($key).'</span>';
253 print "</td><td>\n";
254 print $module->getDescription().'<br>';
255 print $langs->trans("MinLength").': <span class="opacitymedium">'.$module->length.'</span>';
256 print '</td>';
257
258 // Show example of numbering module
259 print '<td class="nowraponall">';
260 $tmp = $module->getExample();
261 if (preg_match('/^Error/', $tmp)) {
262 $langs->load("errors");
263 print '<div class="error">'.$langs->trans($tmp).'</div>';
264 } elseif ($tmp == 'NotConfigured') {
265 print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
266 } else {
267 print '<span class="opacitymedium">'.$tmp.'</span>';
268 }
269 print '</td>'."\n";
270
271 print '<td class="center">';
272 if (getDolGlobalString('USER_PASSWORD_GENERATED') == $key) {
273 //print img_picto('', 'tick');
274 print img_picto($langs->trans("Enabled"), 'switch_on');
275 } else {
276 print '<a href="'.$_SERVER['PHP_SELF'].'?action=setgeneraterule&token='.newToken().'&value='.$key.'">';
277 //print $langs->trans("Activate");
278 print img_picto($langs->trans("Disabled"), 'switch_off');
279 print '</a>';
280 }
281 print "</td></tr>\n";
282 }
283}
284print '</table>';
285print '</div>';
286
287print '</form>';
288
289
290// Pattern for Password Perso
291if (getDolGlobalString('USER_PASSWORD_GENERATED') == "Perso") {
292 print '<br>';
293
294 print '<div class="div-table-responsive-no-min">';
295 print '<table class="noborder centpercent">';
296 print '<tr class="liste_titre">';
297 print '<td colspan="2"> '.$langs->trans("PasswordPatternDesc").'</td>';
298 print '</tr>';
299
300
301 print '<tr class="oddeven">';
302 print '<td>'.$langs->trans("MinLength")."</td>";
303 print '<td><input type="number" class="width50 right" value="'.$tabConf[0].'" id="minlength" min="1"></td>';
304 print '</tr>';
305
306
307 print '<tr class="oddeven">';
308 print '<td>'.$langs->trans("NbMajMin")."</td>";
309 print '<td><input type="number" class="width50 right" value="'.$tabConf[1].'" id="NbMajMin" min="0"></td>';
310 print '</tr>';
311
312
313 print '<tr class="oddeven">';
314 print '<td>'.$langs->trans("NbNumMin")."</td>";
315 print '<td><input type="number" class="width50 right" value="'.$tabConf[2].'" id="NbNumMin" min="0"></td>';
316 print '</tr>';
317
318
319 print '<tr class="oddeven">';
320 print '<td>'.$langs->trans("NbSpeMin")."</td>";
321 print '<td><input type="number" class="width50 right" value="'.$tabConf[3].'" id="NbSpeMin" min="0"></td>';
322 print '</tr>';
323
324
325 print '<tr class="oddeven">';
326 print '<td>'.$langs->trans("NbIteConsecutive")."</td>";
327 print '<td><input type="number" class="width50 right" value="'.$tabConf[4].'" id="NbIteConsecutive" min="0"></td>';
328 print '</tr>';
329
330
331 print '<tr class="oddeven">';
332 print '<td>'.$langs->trans("NoAmbiCaracAutoGeneration")."</td>";
333 print '<td><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <label for="NoAmbiCaracAutoGeneration" id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</label></td>';
334 print '</tr>';
335
336 print '</table>';
337
338 print '<div class="center">';
339 print '<a class="button button-save" id="linkChangePattern">'.$langs->trans("Save").'</a>';
340 print '</div>';
341
342 print '<br><br>';
343
344 print '<script type="text/javascript">';
345 print ' function getStringArg(){';
346 print ' var pattern = "";';
347 print ' pattern += $("#minlength").val() + ";";';
348 print ' pattern += $("#NbMajMin").val() + ";";';
349 print ' pattern += $("#NbNumMin").val() + ";";';
350 print ' pattern += $("#NbSpeMin").val() + ";";';
351 print ' pattern += $("#NbIteConsecutive").val() + ";";';
352 print ' pattern += $("#NoAmbiCaracAutoGeneration")[0].checked ? "1" : "0";';
353 print ' return pattern;';
354 print ' }';
355
356 print ' function valuePossible(){';
357 print ' var fields = ["#minlength", "#NbMajMin", "#NbNumMin", "#NbSpeMin", "#NbIteConsecutive"];';
358 print ' for(var i = 0 ; i < fields.length ; i++){';
359 print ' if($(fields[i]).val() < $(fields[i]).attr("min")){';
360 print ' return false;';
361 print ' }';
362 print ' }';
363 print ' ';
364 print ' var length = parseInt($("#minlength").val());';
365 print ' var length_mini = parseInt($("#NbMajMin").val()) + parseInt($("#NbNumMin").val()) + parseInt($("#NbSpeMin").val());';
366 print ' return length >= length_mini;';
367 print ' }';
368
369 print ' function generatelink(){';
370 print ' return "security.php?action=updatepattern&token='.newToken().'&pattern="+getStringArg();';
371 print ' }';
372
373 print ' function valuePatternChange(){';
374 print ' console.log("valuePatternChange");';
375 print ' var lang_save = "'.$langs->trans("Save").'";';
376 print ' var lang_error = "'.$langs->trans("Error").'";';
377 print ' var lang_Disabled = "'.$langs->trans("Disabled").'";';
378 print ' var lang_Activated = "'.$langs->trans("Activated").'";';
379 print ' $("#textcheckbox").html($("#NoAmbiCaracAutoGeneration")[0].checked ? unescape(lang_Activated) : unescape(lang_Disabled));';
380 print ' if(valuePossible()){';
381 print ' $("#linkChangePattern").attr("href",generatelink()).text(lang_save);';
382 print ' }';
383 print ' else{';
384 print ' $("#linkChangePattern").attr("href", null).text(lang_error);';
385 print ' }';
386 print ' }';
387
388 print ' $("#minlength").change(function(){valuePatternChange();});';
389 print ' $("#NbMajMin").change(function(){valuePatternChange();});';
390 print ' $("#NbNumMin").change(function(){valuePatternChange();});';
391 print ' $("#NbSpeMin").change(function(){valuePatternChange();});';
392 print ' $("#NbIteConsecutive").change(function(){valuePatternChange();});';
393 print ' $("#NoAmbiCaracAutoGeneration").change(function(){valuePatternChange();});';
394
395 print '</script>';
396}
397
398
399// Crypt passwords in database
400
401print '<br>';
402print '<form method="post" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
403print '<input type="hidden" name="token" value="'.newToken().'">';
404print '<input type="hidden" name="action" value="encrypt">';
405
406print '<table class="noborder centpercent">';
407print '<tr class="liste_titre">';
408print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
409print '<td class="center">'.$langs->trans("Activated").'</td>';
410print '<td class="center"></td>';
411print '</tr>';
412
413// Disable clear password in database
414print '<tr class="oddeven">';
415print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
416print '<td class="center" width="60">';
417if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
418 print img_picto($langs->trans("Active"), 'tick');
419}
420print '</td>';
421if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
422 print '<td class="center" width="100">';
423 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_encrypt&token='.newToken().'">'.$langs->trans("Activate").'</a>';
424 print "</td>";
425} else {
426 print '<td class="center" width="100">';
427 if ($allow_disable_encryption) {
428 //On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
429 //Do not allow "disable encryption" as passwords cannot be decrypted
430 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_encrypt&token='.newToken().'">'.$langs->trans("Disable").'</a>';
431 } else {
432 print '<span class="opacitymedium">'.$langs->trans("Always").'</span>';
433 }
434 print "</td>";
435}
436print "</td>";
437print '</tr>';
438
439
440// Crypt password into config file conf.php
441
442print '<tr class="oddeven">';
443print '<td colspan="3">'.$langs->trans("MainDbPasswordFileConfEncrypted").'</td>';
444print '<td align="center" width="60">';
445if (preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
446 print img_picto($langs->trans("Active"), 'tick');
447}
448
449print '</td>';
450
451print '<td class="center" width="100">';
452if (empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) {
453 $langs->load("errors");
454 print img_warning($langs->trans("WarningPassIsEmpty"));
455} else {
456 if (empty($dolibarr_main_db_encrypted_pass)) {
457 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_encryptdbpassconf&token='.newToken().'">'.$langs->trans("Activate").'</a>';
458 }
459 if (!empty($dolibarr_main_db_encrypted_pass)) {
460 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_encryptdbpassconf&token='.newToken().'">'.$langs->trans("Disable").'</a>';
461 }
462}
463print "</td>";
464
465print "</td>";
466print '</tr>';
467
468
469// Disable link "Forget password" on logon
470
471print '<tr class="oddeven">';
472print '<td colspan="3">'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").'</td>';
473print '<td class="center" width="60">';
474if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
475 print img_picto($langs->trans("Active"), 'tick');
476}
477print '</td>';
478if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
479 print '<td class="center" width="100">';
480 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
481 print "</td>";
482}
483if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
484 print '<td class="center" width="100">';
485 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
486 print "</td>";
487}
488print "</td>";
489print '</tr>';
490
491
492print '</table>';
493
494print '</form>';
495
496print '<br>';
497
498if (GETPOSTINT('info') > 0) {
499 if (function_exists('password_hash')) {
500 print $langs->trans("Note: The function password_hash exists on your PHP")."<br>\n";
501 } else {
502 print $langs->trans("Note: The function password_hash does not exist on your PHP")."<br>\n";
503 }
504 print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO')."<br>\n";
505 print 'MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT')."<br>\n";
506}
507
508print '</div>';
509
510// End of page
511llxFooter();
512$db->close();
security_prepare_head()
Prepare array with list of tabs.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
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
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
encodedecode_dbpassconf($level=0)
Encode or decode database password in config file.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.
dolEncrypt($chain, $key='', $ciphering='', $forceseed='', $obfuscationmode='dolcrypt')
Encode a string with a symmetric encryption.