ajout de tests pour emepcher la creation avec un login vide

This commit is contained in:
jlb 2003-08-31 23:22:57 +00:00
parent 83070ff1d5
commit 0f459c0d39

View File

@ -55,7 +55,45 @@ if ($HTTP_POST_VARS["action"] == 'cotisation')
if ($HTTP_POST_VARS["action"] == 'add') if ($HTTP_POST_VARS["action"] == 'add')
{ {
// test si le login existe deja
if(!isset($login) || $login==''){
$error+=1;
$errmsg .="Login vide. Veuillez en positionner un<BR>\n";
}
$sql = "SELECT login FROM llx_adherent WHERE login='$login';";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows();
}
if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){
$error+=1;
$errmsg .="Nom et Prenom obligatoires<BR>\n";
}
if (!isset($email) || $email == '' || !ereg('@',$email)){
$error+=1;
$errmsg .="Adresse Email invalide<BR>\n";
}
if ($num !=0){
$error+=1;
$errmsg .="Login deja utilise. Veuillez en changer<BR>\n";
}
if (!isset($pass) || $pass == '' ){
$error+=1;
$errmsg .="Password invalide<BR>\n";
}
if (isset($naiss) && $naiss !=''){
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)){
$error+=1;
$errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)<BR>\n";
}
}
if (isset($public)){
$public=1;
}else{
$public=0;
}
if (!$error){
// email a peu pres correct et le login n'existe pas
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->statut = -1; $adh->statut = -1;
$adh->prenom = $prenom; $adh->prenom = $prenom;
@ -88,6 +126,7 @@ if ($HTTP_POST_VARS["action"] == 'add')
} }
Header("Location: liste.php"); Header("Location: liste.php");
} }
}
} }
if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes) if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes)