Esempio n. 1
0
					$ele_id=$_POST['new_'.$cpt.'_eleid'];
					//$ele_login=$_POST['new_'.$cpt.'_login'];
					$nom=traitement_magic_quotes(corriger_caracteres($_POST['new_'.$cpt.'_nom']));
					$prenom=traitement_magic_quotes(corriger_caracteres($_POST['new_'.$cpt.'_prenom']));
					$sexe=$_POST['new_'.$cpt.'_sexe'];
					$naissance=$_POST['new_'.$cpt.'_naissance'];
					$doublant=$_POST['new_'.$cpt.'_doublant'];
					$regime=$_POST['new_'.$cpt.'_regime'];
					$nonat=$_POST['new_'.$cpt.'_nonat'];

					// Générer un login...
					$temp1 = mb_strtoupper($nom);
					$temp1 = mb_strtr($temp1, " '-", "___");
					$temp1 = mb_substr($temp1,0,7);
					$temp2 = mb_strtoupper($prenom);
					$temp2 = mb_strtr($temp2, " '-", "___");
					$temp2 = mb_substr($temp2,0,1);
					$login_eleve = $temp1.'_'.$temp2;

					// On teste l'unicité du login que l'on vient de créer
					$k = 2;
					$test_unicite = 'no';
					$temp = $login_eleve;
					while ($test_unicite != 'yes') {
						//$test_unicite = test_unique_e_login($login_eleve,$i);
						$test_unicite = test_unique_login($login_eleve);
						if ($test_unicite != 'yes') {
							$login_eleve = $temp.$k;
							$k++;
						}
					}
Esempio n. 2
0
function transliterate($st)
{
    $st = mb_strtr($st, "абвгдежзийклмнопрстуфыэАБВГДЕЖЗИЙКЛМНОПРСТУФЫЭ", "abvgdegziyklmnoprstufieABVGDEGZIYKLMNOPRSTUFIE");
    $st = strtr($st, array('ё' => "yo", 'х' => "h", 'ц' => "ts", 'ч' => "ch", 'ш' => "sh", 'щ' => "shch", 'ъ' => '', 'ь' => '', 'ю' => "yu", 'я' => "ya", 'Ё' => "Yo", 'Х' => "H", 'Ц' => "Ts", 'Ч' => "Ch", 'Ш' => "Sh", 'Щ' => "Shch", 'Ъ' => '', 'Ь' => '', 'Ю' => "Yu", 'Я' => "Ya"));
    return $st;
}