Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2413 → Rev 2414

/web/acc/manager/htdocs/import_user.php
58,6 → 58,9
$l_out_passwd = "Password :";
$l_out_mind = "Don't forget to change your password (a link is on the authentication window)";
}
 
require('/etc/freeradius-web/config.php');
 
function getImportFileList(){
$importFile = array();
if ($handle = opendir('/tmp')) {
74,20 → 77,39
}
return $importFile;
}
 
function GenPassword($nb_car="8")
{
{
// Random password
$password = "";
$chaine = "aAzZeErRtTyYuUIopP152346897mMLkK";
$chaine .= "jJhHgGfFdDsSqQwWxXcCvVbBnN152346897";
while($nb_car != 0)
{
while($nb_car != 0) {
$i = rand(0,71);
$password .= $chaine[$i];
$nb_car --;
}
return $password ;
$nb_car--;
}
return $password;
}
 
function freeradiusweb_removeDisallowedChars($login)
{
if ($login != '')
{
$accent = "âêôûéàèùîáâãäçèéêëìíîïñòóôõöùúûü";
$login = preg_replace("/[^\w$accent\.\/\@\:\-]/",'',$login);
}
if ($login != '' && $config['general_strip_realms'] == 'yes'){
$realm_del = ($config['general_realm_delimiter'] != '') ? $config['general_realm_delimiter'] : '@';
$realm_for = ($config['general_realm_format'] != '') ? $config['general_realm_format'] : 'suffix';
$new = explode($realm_del,$login,2);
if (count($new) == 2)
$login = ($realm_for == 'suffix') ? $new[0] : $new[1];
}
 
return $login;
}
 
?>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><? echo "$l_title"; ?></th></tr>
100,7 → 122,6
echo "$l_database_state";
 
$LIBpath = "../lib/";
require('/etc/freeradius-web/config.php');
if (is_file($LIBpath."sql/drivers/$config[sql_type]/functions.php"))
{
include_once($LIBpath."sql/drivers/$config[sql_type]/functions.php");
163,7 → 184,8
if ($password == "")
{
$password = GenPassword();
}
}
$login = freeradiusweb_removeDisallowedChars($login);
$login = da_sql_escape_string($link,$login);
$passwd = da_sql_escape_string($link,$passwd);
$passwd = da_encrypt($password);