From 51540237ec9eba302efeba81ddeb1884e95218ee Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 5 Sep 2004 22:25:44 +0000 Subject: [PATCH] inscription still in rework --- configs/menu.conf.php | 2 +- htdocs/inscription/index.php | 28 +++++ htdocs/{ => inscription}/maj.php | 20 ++- htdocs/inscription/step1.php | 31 +++++ htdocs/inscription/step2.php | 38 ++++++ htdocs/inscription/step3.php | 90 ++++++++++++++ htdocs/inscrire.php | 134 --------------------- include/identification.inc.php | 194 +++++++++++------------------- templates/{ => inscription}/maj.tpl | 2 +- templates/inscription/step1a.tpl | 41 +++++++ templates/inscription/step2.tpl | 5 +- templates/mails/marketing.utilisateur.tpl | 4 +- 12 files changed, 315 insertions(+), 274 deletions(-) create mode 100644 htdocs/inscription/index.php rename htdocs/{ => inscription}/maj.php (82%) create mode 100644 htdocs/inscription/step1.php create mode 100644 htdocs/inscription/step2.php create mode 100644 htdocs/inscription/step3.php delete mode 100644 htdocs/inscrire.php rename templates/{ => inscription}/maj.tpl (96%) create mode 100644 templates/inscription/step1a.tpl diff --git a/configs/menu.conf.php b/configs/menu.conf.php index 27b5431..022e77e 100644 --- a/configs/menu.conf.php +++ b/configs/menu.conf.php @@ -46,7 +46,7 @@ if(logged()) { $menu = Array( 'Polytechniciens' => Array( 'Me connecter !' => 'login.php', - 'M\'inscrire' => 'inscrire.php', + 'M\'inscrire' => 'inscription/', 'Pourquoi m\'inscrire ?' => 'docs/services.php' ), 'Visiteurs' => Array( diff --git a/htdocs/inscription/index.php b/htdocs/inscription/index.php new file mode 100644 index 0000000..bf5525e --- /dev/null +++ b/htdocs/inscription/index.php @@ -0,0 +1,28 @@ +run(); +?> diff --git a/htdocs/maj.php b/htdocs/inscription/maj.php similarity index 82% rename from htdocs/maj.php rename to htdocs/inscription/maj.php index 0505b9a..ee4e482 100644 --- a/htdocs/maj.php +++ b/htdocs/inscription/maj.php @@ -18,13 +18,11 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: maj.php,v 1.2 2004-08-31 10:03:28 x2000habouzit Exp $ + $Id: maj.php,v 1.1 2004-09-05 22:25:44 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); -$erreur = Array(); - if (isset($_REQUEST['n'])) { $sql = "SELECT * FROM envoidirect WHERE uid='".$_REQUEST["n"]."'"; $result = $globals->db->query($sql); @@ -32,24 +30,24 @@ if (isset($_REQUEST['n'])) { } if (isset($ligne) && $ligne) { + if(!isset($_REQUEST['charte'])) { + new_skinned_page('inscription/step1a.tpl', AUTH_PUBLIC); + } + // il faut remettre le matricule dans son format de saisie - $_REQUEST['matricule'] = strlen($ligne['matricule']>6) ? - substr($ligne['matricule'],2) : $ligne['matricule']; + $_REQUEST['matricule'] = strlen($ligne['matricule']>6) ? substr($ligne['matricule'],2) : $ligne['matricule']; $_REQUEST['promo'] = $ligne['promo']; $_REQUEST['nom'] = $ligne['nom']; $_REQUEST['prenom'] = $ligne['prenom']; $_REQUEST['email'] = $ligne['email']; - // on veut basculer sur inscrire.php - require("identification.inc.php"); - new_skinned_page('inscrire.form_data.tpl', AUTH_PUBLIC, true); - $page->assign('gotourl', $gotourl); - $gotourl = "inscrire.php"; + new_skinned_page('inscrire/step2.tpl', AUTH_PUBLIC); + $page->assign('envoidirect',$_REQUEST['n']); $page->run(); } -new_skinned_page('maj.tpl', AUTH_PUBLIC); +new_skinned_page('inscription/maj.tpl', AUTH_PUBLIC); $page->run(); ?> diff --git a/htdocs/inscription/step1.php b/htdocs/inscription/step1.php new file mode 100644 index 0000000..d7cc103 --- /dev/null +++ b/htdocs/inscription/step1.php @@ -0,0 +1,31 @@ +run(); + +?> diff --git a/htdocs/inscription/step2.php b/htdocs/inscription/step2.php new file mode 100644 index 0000000..43bf0b6 --- /dev/null +++ b/htdocs/inscription/step2.php @@ -0,0 +1,38 @@ +assign('homonyme', $homonyme); +$page->assign('forlife', $forlife); +$page->assign('mailorg', $mailorg); +$page->assign('prenom', $prenom); +$page->assign('nom', $nom); + +$page->run(); +?> diff --git a/htdocs/inscription/step3.php b/htdocs/inscription/step3.php new file mode 100644 index 0000000..3e65e8c --- /dev/null +++ b/htdocs/inscription/step3.php @@ -0,0 +1,90 @@ +assign('homonyme', $homonyme); + $page->assign('loginbis', isset($loginbis) ? $loginbis : ''); + $page->assign('mailorg', $mailorg); + + $page->assign('prenom', $prenom); + $page->assign('nom', $nom); + + $page->assign('erreur', join("\n",$erreur)); + $page->run(); +} + +$ins_id=rand_url_id(12); +$pass_clair=rand_pass(); +$password=md5($pass_clair); +$date=date("Y-m-j"); + +// on nettoie les appli_type(1|2) si elles ne sont pas affectees +if (!isset($_REQUEST["appli_type1"])) $_REQUEST["appli_type1"]=0; +if (!isset($_REQUEST["appli_type2"])) $_REQUEST["appli_type2"]=0; +if (!isset($loginbis)) $loginbis=""; + +// nouvelle inscription +$sql="REPLACE INTO en_cours + SET ins_id='$ins_id', password='$password', matricule='$matricule', promo='$promo', + nom='".addslashes($nom)."', prenom='".addslashes($prenom)."', email='{$_REQUEST['email']}', + naissance='{$_REQUEST['naissance']}', date='$date', nationalite='{$_REQUEST['nationalite']}', + appli_id1='{$_REQUEST['appli_id1']}', appli_type1='{$_REQUEST['appli_type1']}', + appli_id2='{$_REQUEST['appli_id2']}', appli_type2='{$_REQUEST['appli_type2']}', + loginbis='$mailorg', username='$forlife'"; +$globals->db->query($sql); + +$globals->db->query("UPDATE identification SET last_known_email='{$_REQUEST['email']}' WHERE matricule = $matricule"); +// si on venait de la page maj.php, on met a jour la table envoidirect +if(isset($_REQUEST['envoidirect'])) + $globals->db->query("UPDATE envoidirect SET date_succes='NOW()' WHERE uid='{$_REQUEST['envoidirect']}'"); + +require("tpl.mailer.inc.php"); +$mymail = new TplMailer('inscrire.mail.tpl'); +$mymail->assign('forlife',$forlife); +$mymail->assign('lemail',$_REQUEST['email']); +$mymail->assign('pass_clair',$pass_clair); +$mymail->assign('baseurl',$baseurl); +$mymail->assign('ins_id',$ins_id); +$mymail->assign('subj',$forlife."@polytechnique.org"); +$mymail->send(); + +new_skinned_page('inscription/step3.tpl', AUTH_PUBLIC); +$page->assign('mailorg', $mailorg); +$page->assign('forlife', $forlife); +$page->run(); +?> diff --git a/htdocs/inscrire.php b/htdocs/inscrire.php deleted file mode 100644 index 5e2a522..0000000 --- a/htdocs/inscrire.php +++ /dev/null @@ -1,134 +0,0 @@ -assign('erreur', $erreur); - $page->run(); - } elseif (empty($_REQUEST["email"])) { // formulaire identification soumis - // data pas encore envoyées - // vérification du format des données rentrées - if( empty($_REQUEST["nom"]) || empty($_REQUEST["prenom"]) || empty($_REQUEST["promo"]) - || ( strlen(strtok($_REQUEST["nom"],"()")) < strlen($_REQUEST["nom"]) ) - ) { - // il manque au moins une donnée - new_skinned_page('inscrire.form_id.tpl', AUTH_PUBLIC, true); - $erreur[] = "Il manque des champs ou certains champs contiennent des caractères interdits. Recommence."; - $page->assign('erreur', $erreur); - $page->run(); - } else { - // $_REQUEST["nom"], $_REQUEST["prenom"] et $_REQUEST["promo"] existent - new_skinned_page('inscrire.form_data.tpl', AUTH_PUBLIC, true); - - require("identification.inc.php"); - require("applis.func.inc.php"); - - $page->assign('homonyme', $homonyme); - $page->assign('loginbis', isset($loginbis) ? $loginbis : ''); - $page->assign('mailorg', $mailorg); - - $page->assign('prenom', $prenom); - $page->assign('nom', $nom); - - $page->assign('erreur', $erreur); - $page->run(); - } - } else { // $_REQUEST["email"] est renseignée donc l'inscription est finie - require("identification.inc.php"); - require("xorg.misc.inc.php"); - - if(!isvalid_email($_REQUEST["email"])) - $erreur[] = "Le champ 'E-mail' n'est pas valide."; - if (!isvalid_email_redirection($_REQUEST["email"])) - $erreur[] = "\"$mailorg@polytechnique.org\" doit renvoyer vers un email existant valide. En particulier, il ne peut pas être renvoyé vers lui-même."; - if (!ereg("[0-3][0-9][0-1][0-9][1][9]([0-9]{2})", $_REQUEST["naissance"])) - $erreur[] = "La 'Date de naissance' n'est pas correcte. Elle est obligatoire pour continuer mais ne sera jamais visible sur le site par la suite."; - - if(!empty($erreur)) { - new_skinned_page('inscrire.form_data.tpl', AUTH_PUBLIC, true); - require("applis.func.inc.php"); - $page->assign('homonyme', $homonyme); - $page->assign('loginbis', isset($loginbis) ? $loginbis : ''); - $page->assign('mailorg', $mailorg); - - $page->assign('prenom', $prenom); - $page->assign('nom', $nom); - - $page->assign('erreur', $erreur); - $page->run(); - } - - $ins_id=rand_url_id(12); - $pass_clair=rand_pass(); - $password=md5($pass_clair); - $date=date("Y-m-j"); - - // on nettoie les appli_type(1|2) si elles ne sont pas affectees - if (!isset($_REQUEST["appli_type1"])) $_REQUEST["appli_type1"]=0; - if (!isset($_REQUEST["appli_type2"])) $_REQUEST["appli_type2"]=0; - if (!isset($loginbis)) $loginbis=""; - - // nouvelle inscription - $sql="REPLACE INTO en_cours - SET ins_id='$ins_id', password='$password', matricule='$matricule', promo='{$_REQUEST['promo']}', - nom='".addslashes($nom)."', prenom='".addslashes($prenom)."', email='{$_REQUEST['email']}', - naissance='{$_REQUEST['naissance']}', date='$date', nationalite='{$_REQUEST['nationalite']}', - appli_id1='{$_REQUEST['appli_id1']}', appli_type1='{$_REQUEST['appli_type1']}', - appli_id2='{$_REQUEST['appli_id2']}', appli_type2='{$_REQUEST['appli_type2']}', - loginbis='$loginbis', username='$mailorg'"; - $globals->db->query($sql); - - $globals->db->query("UPDATE identification SET last_known_email='".$_REQUEST["email"]."' WHERE matricule = " . $matricule); - - // si on vient de la page maj.php, on met a jour la table envoidirect - if(isset($envoidirect)) - $globals->db->query("UPDATE envoidirect SET date_succes='".date("Y-m-j")."' WHERE uid='".$envoidirect."'"); - - require("tpl.mailer.inc.php"); - $mymail = new TplMailer('inscrire.mail.tpl'); - $mymail->assign('mailorg',$mailorg); - $mymail->assign('le_mail',$_REQUEST['email']); - $mymail->assign('pass_clair',$pass_clair); - $mymail->assign('baseurl',$baseurl); - $mymail->assign('ins_id',$ins_id); - - $mymail->assign('subj',$mailorg."@polytechnique.org"); - $mymail->send(); - - new_skinned_page('inscrire.preins.tpl', AUTH_PUBLIC, true); - $page->assign('mailorg', $mailorg); - $page->run(); - } -} else { - // $_REQUEST["charte"] n'existe pas, afficher la charte - new_skinned_page('inscrire.charte.tpl', AUTH_PUBLIC, true); - $page->assign('erreur', $erreur); - $page->run(); -} -?> diff --git a/include/identification.inc.php b/include/identification.inc.php index 56c242c..374eee0 100644 --- a/include/identification.inc.php +++ b/include/identification.inc.php @@ -18,56 +18,52 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: identification.inc.php,v 1.4 2004-09-01 20:57:11 x2000habouzit Exp $ + $Id: identification.inc.php,v 1.5 2004-09-05 22:25:45 x2000habouzit Exp $ ***************************************************************************/ +require_once('xorg.misc.inc.php'); function sortie_id($err) { - global $erreur,$page; - $erreur[] = $err; - new_skinned_page('inscrire.form_id.tpl', AUTH_PUBLIC, true); - $page->assign('erreur', $erreur); + global $page; + new_skinned_page('inscription/step1.tpl', AUTH_PUBLIC); + $page->assign('erreur', $err); $page->run(); } -if (strlen($_REQUEST["promo"])<4) { - sortie_id("La promotion comporte 4 chiffres."); +$promo = intval($_REQUEST["promo"]); +if ($promo<1900 || $promo>2100) { + sortie_id("La promotion doit comporter 4 chiffres."); } /* on recupere les donnees */ -$prenom=trim(strip_request('prenom')); -$prenom=eregi_replace("[[:space:]]+"," ",$prenom); - -$nom=trim(strip_request('nom')); -$nom=eregi_replace("[[:space:]]+"," ",$nom); +$prenom = preg_replace('/ +/','',trim(strip_request('prenom'))); +$nom = preg_replace('/ +/','',trim(strip_request('nom'))); // majuscules pour nom et prenom -$nom=strtoupper(replace_accent($nom)); +$nom = strtoupper(replace_accent($nom)); $prenom = make_firstname_case($prenom); // calcul du login $mailorg = make_username($prenom,$nom); +$forlife = make_forlife($prenom,$nom,$promo); // version uppercase du prenom $prenomup=strtoupper(replace_accent($prenom)); -// calcul de la plus longue chaine servant à l'identification -$chaine1=strtok($nom," -'"); -$chaine2=strtok(" -'"); -if ( strlen($chaine2) > strlen($chaine1) ) { - $chaine = $chaine2; -} else { - $chaine = $chaine1; -} +@list($chaine1,$chaine2) = preg_split("/[ \-']/",$nom); +$chaine = strlen($chaine2) > strlen($chaine1) ? $chaine2 : $chaine1; // c'est parti pour l'identification, les champs étant corrects -if ($_REQUEST["promo"] > 1995) { +if ($promo > 1995) { if (strlen($_REQUEST["matricule"]) != 6) { sortie_id("Le matricule qu'il faut que tu rentres doit comporter 6 chiffres."); } - /* transformation du matricule afin de le rendre Y2K compliant (i.e. de la forme PPPP0XXX où PPPP est l'année d'inscription à l'école (i.e. le numéro de promotion sauf pour les étrangers voie 2) et XXX le numéro d'entrée cette année-là */ + /* transformation du matricule afin de le rendre Y2K compliant + * (i.e. de la forme PPPP0XXX où PPPP est l'année d'inscription à l'école + * (i.e. le numéro de promotion sauf pour les étrangers voie 2) et XXX le numéro d'entrée cette année-là + */ $matrcondense = $_REQUEST["matricule"]; $rangentree = substr($_REQUEST["matricule"], 3, 3); @@ -85,15 +81,17 @@ if ($_REQUEST["promo"] > 1995) { // exemple yann.buril et yann.buril-dupont seraient acceptés ! alors que // le matricule est unique $result=$globals->db->query("SELECT user_id FROM auth_user_md5 where matricule=$matricule"); - if ($myrow = mysql_fetch_array($result)) { - $str="Matricule déjà existant. Causes possibles
\n" - ."- tu t'es trompé de matricule
\n" + if (mysql_num_rows($result)) { + $str="Matricule déjà existant. Causes possibles\n" + ."- tu t'es trompé de matricule\n" ."- tu t'es déjà inscrit une fois"; - $matricule = $matrcondense; sortie_id($str); } + // promotion jeune - $result=$globals->db->query("SELECT nom, prenom FROM identification where matricule='".$matricule."' AND promo='".$_REQUEST["promo"]."' AND deces=0"); + $result=$globals->db->query("SELECT nom, prenom + FROM identification + WHERE matricule='$matricule' AND promo='$promo' AND deces=0"); list($mynom, $myprenom) = mysql_fetch_row($result); $mynomup=strtoupper(replace_accent($mynom)); $myprenomup=strtoupper(replace_accent($myprenom)); @@ -101,12 +99,10 @@ if ($_REQUEST["promo"] > 1995) { if (strlen($chaine2)>0) { // il existe au moins 2 chaines // on teste l'inclusion des deux chaines - if ( strstr($mynomup,$chaine1) && strstr($mynomup,$chaine2) && ($myprenomup == $prenomup )) - $autorisation = TRUE; + $autorisation = ( strstr($mynomup,$chaine1) && strstr($mynomup,$chaine2) && ($myprenomup == $prenomup) ); } else { // la chaine2 est vide, on n'utilise que chaine - if ( strstr($mynomup,$chaine) && ($myprenomup == $prenomup) ) - $autorisation = TRUE; + $autorisation = ( strstr($mynomup,$chaine) && ($myprenomup == $prenomup) ); } if (!$autorisation) { @@ -114,12 +110,9 @@ if ($_REQUEST["promo"] > 1995) { sortie_id($str); } - // identification > 1990 OK - -} else { // promotion avant 1996 pas de matricule ! - +} else { // CODE SPECIAL POUR LES X DES PROMOTIONS AVANT 1996 - $sql = "SELECT nom,prenom,matricule FROM identification WHERE promo='".$_REQUEST["promo"]."' AND deces=0"; + $sql = "SELECT nom,prenom,matricule FROM identification WHERE promo='$promo' AND deces=0"; $result = $globals->db->query($sql); $autorisation = FALSE; @@ -136,7 +129,7 @@ if ($_REQUEST["promo"] > 1995) { break; } } - } else { // une seule chaine + } else { // une seule chaine while (list($mynom,$myprenom,$mymat) = mysql_fetch_array($result)) { // verification de toute la promo ! @@ -149,6 +142,7 @@ if ($_REQUEST["promo"] > 1995) { } } } + mysql_free_result($result); // on vérifie que le matricule n'est pas déjà dans auth_user_md5 @@ -158,9 +152,8 @@ if ($_REQUEST["promo"] > 1995) { if (! empty($matricule)) { $result=$globals->db->query("SELECT * FROM auth_user_md5 where matricule='".$matricule."'"); if ($myrow = mysql_fetch_array($result)) { - $str="Tu t'es déjà inscrit une fois. " - ."Ecris à support@polytechnique.org " - ."pour tout problème."; + $str="Tu t'es déjà inscrit une fois.\n" + ."Ecris à support@polytechnique.org pour tout problème."; sortie_id($str); } } @@ -172,91 +165,46 @@ if ($_REQUEST["promo"] > 1995) { // identification < 1991 OK } -// test si homonyme -$result=$globals->db->query("SELECT nom, prenom, promo FROM identification WHERE nom = '".addslashes($nom)."' AND prenom = '".addslashes($prenom)."' AND matricule <> '".$matricule."'"); -// (les comparaisons sont indépendantes de la case et des accents en mysql) -$homonyme = 0; -if ( mysql_num_rows($result) > 0 ) { - // on a un homonyme - $homonyme = 1; - $loginbis = $mailorg; - $mailorg = $mailorg . substr($_REQUEST["promo"],-2); - while ( list($mynom,$myprenom,$mypromo) = mysql_fetch_row($result) ) { - if (($mypromo % 100) == ($_REQUEST["promo"] % 100)) { - sortie_id("Tu as un homonyme dans ta promo, il " - ."faut traiter ce cas manuellement, envoie un mail à " - ."support@polytechnique.org"); - } - } - $result=$globals->db->query("SELECT user_id, promo FROM auth_user_md5 where username='$loginbis'"); - if ( list($uid,$mypromo) = mysql_fetch_row($result) ) { - // un homonyme est déjà enregistré, le prévenir - // (la promo ne peut pas être pareille, cas déjà testé) - mysql_free_result($result); - $newlogin = $loginbis.".".(($mypromo >= 2000) ? $mypromo : ($mypromo%100)); - $sql = "UPDATE auth_user_md5 SET loginbis='$loginbis', username = '$newlogin', alias='$loginbis', date_mise_alias_temp = NOW() WHERE user_id = $uid"; - $globals->db->query($sql); - if ( mysql_affected_rows() == 0 ) { - // pb de mise à jour - $MESSAGE = - "Pb lors de l'execution de \"$sql\" avec le message".mysql_error().", a corriger"; - mail("support","Pb d'update lors de l'inscription d'un homonyme",$MESSAGE); - } else { - // mise à jour OK - $HEADER = - "From: support@polytechnique.org\nCc: support@polytechnique.org"; - $MESSAGE = - "Un homonyme s'est inscrit, nous ne pouvons donc garder ton identifiant" - ."\n($loginbis) unique, il devient $newlogin ." - ."\n\nTu dois dès maintenant l'utiliser pour te connecter sur le site mais" - ."\nton adresse de courriel :" - ."\n $loginbis@polytechnique.org" - ."\nreste encore valable pour 1 mois, le temps que tu passes sur ta nouvelle" - ."\nadresse :" - ."\n $newlogin@polytechnique.org" - ."\nqui est déjà utilisable." - ."\n\nQuand ton identifiant sera désactivé, l'adresse :" - ."\n $loginbis@polytechnique.org" - ."\nrenverra vers un robot qui indique qu'il y a plusieurs personnes portant" - ."\nle même nom ; cela évite que l'un des homonymes reçoive des courriels" - ."\ndestinés à l'autre." - ."\n\nSache que tu peux aussi demander un alias de ton choix qui te donne une" - ."\nautre adresse qui te conviendra peut-être mieux." - ."\n\nCordialement" - ."\n\n-- \nPolytechnique.org" - ."\n\"Le portail des élèves & anciens élèves de l'X\""; - mail($loginbis,"Changement de ton login",$MESSAGE,$HEADER); - } // END IF if ( mysql_affected_rows() == 0 ) THEN ELSE - } // END IF -} // END IF +/*****************************************************************************/ +/***************************** IDENTIFICATION OK *****************************/ +/*****************************************************************************/ -// on teste si il n'y a pas d'alias -if (isset($loginbis)) - $result=$globals->db->query("SELECT username FROM auth_user_md5 where alias='$loginbis'"); - else - $result=$globals->db->query("SELECT username FROM auth_user_md5 where alias='$mailorg'"); - while ( list($autre_user) = mysql_fetch_row($result) ) { - // mise à jour OK - $HEADER="From: support@polytechnique.org\nBcc: support@polytechnique.org"; - $MESSAGE="Un homonyme s'est inscrit, nous ne pouvons donc garder ton alias " - .$loginbis. "\n\n" - ."Dès que tu auras pu prévenir tes correspondants fais nous signe, " - ."nous supprimerons ton alias.\n\n" - ."-- \nPolytechnique.org\n" - ."\"Le portail des élèves & anciens élèves de l'X\""; - mail($autre_user,"Changement de ton login",$MESSAGE,$HEADER); +$result = $globals->db->query("SELECT id,type FROM aliases WHERE alias='$mailorg'"); +$homonyme = mysql_num_rows($result) > 0; + +if ( $homonyme ) { + list($h_id,$h_type) = mysql_fetch_row($result); + mysql_free_result($result); + + $result = $globals->db->query("SELECT alias FROM aliases WHERE alias='$forlife'"); + if ( mysql_num_rows($result) > 0 ) { + sortie_id("Tu as un homonyme dans ta promo, il faut traiter ce cas manuellement.\n". + "envoie un mail à support@polytechnique.org"); } -mysql_free_result($result); + mysql_free_result($result); -// on vérifie l'adresse n'existe pas déjà dans auth_user_md5 !! -$result=$globals->db->query("SELECT * FROM auth_user_md5 where username='$mailorg'"); -if ( mysql_num_rows($result) > 0 ) { - // le même login existe déjà - $str="L'adresse ".$mailorg."@polytechnique.org est déjà prise. " - ."Seule une inscription manuelle est possible avec une autre adresse.
" - ."Envoie un mail à " - ."support@polytechnique.org"; - sortie_id($str); + if ( $h_type != 'homonyme' ) { + $globals->db->query("UPDATE aliases SET expire=ADD_DATE(NOW(),INTERVAL 1 MONTH) WHERE alias='$mailorg'"); + require_once('diogenes.mailer.inc.php'); + $mailer = new DiogenesMailer('Support Polytechnique.org ', + "$mailorg@polytechnique.org", + "perte de ton alias $mailorg dans un mois !", + false, + 'Support Polytechnique.org '); + $msg = + "Un homonyme s'est inscrit, nous ne pouvons donc garder ton alias '$loginbis'.\n\n". + "Tu gardes toute de même à compter de ce jour, l'usage de cet alias pour 1 mois encore\n\n". + "Lorsque cet alias sera désactivé, l'adresse :\n". + " $loginbis@polytechnique.org\n". + "renverra vers un robot qui indique qu'il y a plusieurs personnes portant le même nom ; cela évite que l'un des homonymes reçoive des courriels destinés à l'autre.\n\n". + "Cordialement\n\n". + "-- \n". + "Polytechnique.org\n". + "\"Le portail des élèves & anciens élèves de l'X\""; + $mailer->SetBody(wordwrap($msg,72)); + $mailer->send(); + } + unset($mailorg); } ?> diff --git a/templates/maj.tpl b/templates/inscription/maj.tpl similarity index 96% rename from templates/maj.tpl rename to templates/inscription/maj.tpl index daff9b3..3909fab 100644 --- a/templates/maj.tpl +++ b/templates/inscription/maj.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: maj.tpl,v 1.3 2004-08-31 11:25:39 x2000habouzit Exp $ + $Id: maj.tpl,v 1.1 2004-09-05 22:25:45 x2000habouzit Exp $ ***************************************************************************} diff --git a/templates/inscription/step1a.tpl b/templates/inscription/step1a.tpl new file mode 100644 index 0000000..6172522 --- /dev/null +++ b/templates/inscription/step1a.tpl @@ -0,0 +1,41 @@ +{*************************************************************************** + * Copyright (C) 2003-2004 Polytechnique.org * + * http://opensource.polytechnique.org/ * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + *************************************************************************** + $Id: step1a.tpl,v 1.1 2004-09-05 22:25:45 x2000habouzit Exp $ + ***************************************************************************} + + +
+
+ Conditions générales +
+

+ L'enregistrement se déroule en deux étapes. La pré-inscription te prendra moins + de 5 minutes. La seconde étape est une phase de validation où c'est nous qui te + recontactons pour te fournir un mot de passe et te demander de le changer. +

+ {include file="docs/charte.tpl"} +
+ + +
+
+ + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/inscription/step2.tpl b/templates/inscription/step2.tpl index 540f2d3..001c9e5 100644 --- a/templates/inscription/step2.tpl +++ b/templates/inscription/step2.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: step2.tpl,v 1.1 2004-09-05 22:01:11 x2000habouzit Exp $ + $Id: step2.tpl,v 1.2 2004-09-05 22:25:45 x2000habouzit Exp $ ***************************************************************************} @@ -31,7 +31,7 @@

{$erreur|smarty:nodefaults|nl2br}

-
+ {if $homonyme}

Ton adresse sera : {$forlife}@polytechnique.org @@ -150,6 +150,7 @@ + diff --git a/templates/mails/marketing.utilisateur.tpl b/templates/mails/marketing.utilisateur.tpl index 59b494e..2c7c470 100644 --- a/templates/mails/marketing.utilisateur.tpl +++ b/templates/mails/marketing.utilisateur.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: marketing.utilisateur.tpl,v 1.2 2004-08-31 11:25:41 x2000habouzit Exp $ + $Id: marketing.utilisateur.tpl,v 1.3 2004-09-05 22:25:46 x2000habouzit Exp $ ***************************************************************************} {subject text="Annuaire en ligne des Polytechniciens"} @@ -32,7 +32,7 @@ Ch a fiche n'est pas à jour dans l'annuaire des Polytechniciens sur Internet. Pour la mettre à jour, il te suffit de visiter cette page ou de copier cette adresse dans la barre de ton navigateur : ========================================================== -{$baseurl}/maj.php?n={$user_id} +{$baseurl}/inscription/maj.php?n={$user_id} ========================================================== Il ne te faut que 5 minutes sur http://www.polytechnique.org/ pour rejoindre les {$num_users} camarades branchés grâce au système de reroutage de l'X et qui permet de joindre un camarade en connaissant seulement son nom et son prénom... et de bénéficier pour la vie d'une adresse prestigieuse {$mailorg}@polytechnique.org et son alias discret {$mailorg}@m4x.org (m4x = mail for X). -- 2.1.4