mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
rajout du test du login ainsi que de l"validite" de l'email (a tester tout cela)
This commit is contained in:
@@ -27,41 +27,60 @@ require("../../paiement.class.php");
|
||||
|
||||
|
||||
$db = new Db();
|
||||
llxHeader();
|
||||
$errmsg='';
|
||||
$num=0;
|
||||
|
||||
if ($HTTP_POST_VARS["action"] == 'add')
|
||||
{
|
||||
|
||||
$adh = new Adherent($db);
|
||||
$adh->statut = -1;
|
||||
$adh->prenom = $prenom;
|
||||
$adh->nom = $nom;
|
||||
$adh->societe = $societe;
|
||||
$adh->adresse = $adresse;
|
||||
$adh->cp = $cp;
|
||||
$adh->ville = $ville;
|
||||
$adh->email = $email;
|
||||
$adh->login = $login;
|
||||
$adh->pass = $pass;
|
||||
$adh->note = $note;
|
||||
$adh->pays = $pays;
|
||||
$adh->typeid = $type;
|
||||
$adh->commentaire = $HTTP_POST_VARS["comment"];
|
||||
$adh->morphy = $HTTP_POST_VARS["morphy"];
|
||||
// test si le login existe deja
|
||||
$sql = "SELECT login FROM llx_adherent WHERE login='$login';";
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
}
|
||||
|
||||
if ($adh->create($user->id) )
|
||||
{
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
||||
}
|
||||
// Envoi d'un Email de confirmation au nouvel adherent
|
||||
$mesg="Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\nPrenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass\nNote : $note\nType : $type\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\nhttp://$SERVER_NAME/adherents/private/edit.php\n\n";
|
||||
mail($email,"Votre adhesion sur http://$SERVER_NAME/",$mesg);
|
||||
Header("Location: new.php?action=added");
|
||||
if (isset($email) && $email != '' && ereg('@',$email) && !$num){
|
||||
// email a peu pres correct et le login n'existe pas
|
||||
$adh = new Adherent($db);
|
||||
$adh->statut = -1;
|
||||
$adh->prenom = $prenom;
|
||||
$adh->nom = $nom;
|
||||
$adh->societe = $societe;
|
||||
$adh->adresse = $adresse;
|
||||
$adh->cp = $cp;
|
||||
$adh->ville = $ville;
|
||||
$adh->email = $email;
|
||||
$adh->login = $login;
|
||||
$adh->pass = $pass;
|
||||
$adh->note = $note;
|
||||
$adh->pays = $pays;
|
||||
$adh->typeid = $type;
|
||||
$adh->commentaire = $HTTP_POST_VARS["comment"];
|
||||
$adh->morphy = $HTTP_POST_VARS["morphy"];
|
||||
|
||||
if ($adh->create($user->id) )
|
||||
{
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
||||
}
|
||||
// Envoi d'un Email de confirmation au nouvel adherent
|
||||
$mesg="Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\n\nPrenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass\nNote : $note\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\nhttp://$SERVER_NAME/adherents/private/edit.php\n\n";
|
||||
mail($email,"Votre adhesion sur http://$SERVER_NAME/",$mesg);
|
||||
Header("Location: new.php?action=added");
|
||||
}
|
||||
}else{
|
||||
if ($num ==0){
|
||||
$errmsg .="Login deja utilise. Veuillez en changer<BR>\n";
|
||||
}
|
||||
if (isset($email) && $email != '' && ereg('@',$email)){
|
||||
$errmsg .="Adresse Email invalide<BR>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
@@ -70,22 +89,13 @@ if ($HTTP_POST_VARS["action"] == 'add')
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
|
||||
$sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp";
|
||||
$sql .= " AND f.rowid = $facid";
|
||||
|
||||
if (isset($action) && $action== 'added'){
|
||||
print "<FONT COLOR=\"blue\">Nouvel Adh<64>rent ajout<75>. En attente de validation</FONT><BR>\n";
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
if ($num) {
|
||||
$obj = $db->fetch_object( 0);
|
||||
|
||||
$total = $obj->total;
|
||||
}
|
||||
if (isset($errmsg) && $errmsg != ''){
|
||||
print "<FONT COLOR=\"red\">$errmsg</FONT><BR>\n";
|
||||
}
|
||||
|
||||
print_titre("Nouvel adh<64>rent");
|
||||
print "Les login et password vous serviront a editer vos coordonnees ulterieurement<BR>\n";
|
||||
print "<form action=\"$PHP_SELF\" method=\"post\">\n";
|
||||
@@ -109,24 +119,19 @@ print "<tr><td>Personne</td><td>\n";
|
||||
$htmls->select_array("morphy", $morphys);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td valign="top" rowspan="11"><textarea name="comment" wrap="soft" cols="40" rows="25"></textarea></td></tr>';
|
||||
print '<td valign="top" rowspan="11"><textarea name="comment" wrap="soft" cols="40" rows="25">'.$comment.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td>Pr<50>nom</td><td><input type="text" name="prenom" size="40"></td></tr>';
|
||||
print '<tr><td>Pr<50>nom</td><td><input type="text" name="prenom" size="40" value="'.$prenom.'"></td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40"></td></tr>';
|
||||
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40"></td></tr>';
|
||||
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40" value="'.$nom.'"></td></tr>';
|
||||
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40" value="'.$societe.'"></td></tr>';
|
||||
print '<tr><td>Adresse</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3"></textarea></td></tr>';
|
||||
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40"></td></tr>';
|
||||
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40"></td></tr>';
|
||||
print '<tr><td>Email</td><td><input type="text" name="email" size="40"></td></tr>';
|
||||
print '<tr><td>Login</td><td><input type="text" name="login" size="40"></td></tr>';
|
||||
print '<tr><td>Password</td><td><input type="text" name="pass" size="40"></td></tr>';
|
||||
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adresse.'</textarea></td></tr>';
|
||||
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="8" value="'.$cp.'"> <input type="text" name="ville" size="40" value="'.$ville.'"></td></tr>';
|
||||
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40" value="'.$pays.'"></td></tr>';
|
||||
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$email.'"></td></tr>';
|
||||
print '<tr><td>Login</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>';
|
||||
print '<tr><td>Password</td><td><input type="text" name="pass" size="40" value="'.$pass.'"></td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="Enregistrer"></td></tr>';
|
||||
print "</form>\n";
|
||||
|
||||
Reference in New Issue
Block a user