Commit 378fb380 authored by Feu's avatar Feu
Browse files

prise en charge equivalence @utbm.fr / @assidu-utbm.fr

parent d06abd71
...@@ -166,11 +166,22 @@ class utilisateur extends stdentity ...@@ -166,11 +166,22 @@ class utilisateur extends stdentity
return; return;
}*/ }*/
$req = new requete($this->db, "SELECT `utilisateurs`.* FROM `utilisateurs` " . if (ereg("^([A-Za-z0-9\._-]+)@(utbm\.fr|assidu-utbm\.fr)$", $email, $regs))
"LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur` = `utilisateurs`.`id_utilisateur` " . $req = new requete($this->db,
"WHERE `utilisateurs`.`email_utl` = '" . mysql_real_escape_string($email) . "' OR " . "SELECT `utilisateurs`.* FROM `utilisateurs` " .
"`utl_etu_utbm`.`email_utbm` = '" . mysql_real_escape_string($email) . "' " . "LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur` = `utilisateurs`.`id_utilisateur` " .
"LIMIT 1"); "WHERE `utilisateurs`.`email_utl` = '".mysql_real_escape_string($regs[1]."@utbm.fr")."' " .
"OR `utilisateurs`.`email_utl` = '".mysql_real_escape_string($regs[1]."@assidu-utbm.fr")."' " .
"OR `utl_etu_utbm`.`email_utbm` = '".mysql_real_escape_string($regs[1]."@utbm.fr")."' " .
"OR `utl_etu_utbm`.`email_utbm` = '".mysql_real_escape_string($regs[1]."@assidu-utbm.fr")."' " .
"LIMIT 1");
else
$req = new requete($this->db,
"SELECT `utilisateurs`.* FROM `utilisateurs` " .
"LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur` = `utilisateurs`.`id_utilisateur` " .
"WHERE `utilisateurs`.`email_utl` = '" . mysql_real_escape_string($email) . "' OR " .
"`utl_etu_utbm`.`email_utbm` = '" . mysql_real_escape_string($email) . "' " .
"LIMIT 1");
if ( $req->lines == 1 ) if ( $req->lines == 1 )
{ {
...@@ -304,11 +315,22 @@ class utilisateur extends stdentity ...@@ -304,11 +315,22 @@ class utilisateur extends stdentity
*/ */
function is_email_avaible ( $email ) function is_email_avaible ( $email )
{ {
$req = new requete($this->db, "SELECT `utilisateurs`.* FROM `utilisateurs` " . if (ereg("^([A-Za-z0-9\._-]+)@(utbm\.fr|assidu-utbm\.fr)$", $email, $regs))
"LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur` = `utilisateurs`.`id_utilisateur` " . $req = new requete($this->db,
"WHERE `utilisateurs`.`email_utl` = '" . mysql_real_escape_string($email) . "' OR " . "SELECT `utilisateurs`.* FROM `utilisateurs` " .
"`utl_etu_utbm`.`email_utbm` = '" . mysql_real_escape_string($email) . "' " . "LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur` = `utilisateurs`.`id_utilisateur` " .
"AND `utilisateurs`.`id_utilisateur`!='".$this->id."'"); "WHERE (`utilisateurs`.`email_utl` = '".mysql_real_escape_string($regs[1]."@utbm.fr")."' " .
"OR `utilisateurs`.`email_utl` = '".mysql_real_escape_string($regs[1]."@assidu-utbm.fr")."' " .
"OR `utl_etu_utbm`.`email_utbm` = '".mysql_real_escape_string($regs[1]."@utbm.fr")."' " .
"OR `utl_etu_utbm`.`email_utbm` = '".mysql_real_escape_string($regs[1]."@assidu-utbm.fr")."') " .
"AND `utilisateurs`.`id_utilisateur`!='".$this->id."'");
else
$req = new requete($this->db,
"SELECT `utilisateurs`.* FROM `utilisateurs` " .
"LEFT JOIN `utl_etu_utbm` ON `utl_etu_utbm`.`id_utilisateur`=`utilisateurs`.`id_utilisateur` " .
"WHERE (`utilisateurs`.`email_utl`='" . mysql_real_escape_string($email) . "' OR " .
"`utl_etu_utbm`.`email_utbm`='" . mysql_real_escape_string($email) . "') " .
"AND `utilisateurs`.`id_utilisateur`!='".$this->id."'");
return ( $req->lines == 0 ); return ( $req->lines == 0 );
} }
......
...@@ -679,7 +679,7 @@ class site extends interfaceweb ...@@ -679,7 +679,7 @@ class site extends interfaceweb
{ {
$cts = new contents("Connexion"); $cts = new contents("Connexion");
$frm = new form("connect",$topdir."connect.php",true,"POST","Connexion"); $frm = new form("connect",$topdir."connect.php",true,"POST","Connexion");
$frm->add_select_field("domain","Connexion",array("utbm"=>"UTBM","assidu"=>"Assidu","id"=>"ID","autre"=>"Autre","alias"=>"Alias")); $frm->add_select_field("domain","Connexion",array("utbm"=>"UTBM / Assidu", "id"=>"ID", "autre"=>"E-mail", "alias"=>"Alias"));
$frm->add_text_field("username","Utilisateur","prenom.nom","",20,true); $frm->add_text_field("username","Utilisateur","prenom.nom","",20,true);
$frm->add_password_field("password","Mot de passe","","",20); $frm->add_password_field("password","Mot de passe","","",20);
$frm->add_checkbox ( "personnal_computer", "Me connecter automatiquement la prochaine fois", false ); $frm->add_checkbox ( "personnal_computer", "Me connecter automatiquement la prochaine fois", false );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment