From: x2000habouzit Date: Thu, 30 Sep 2004 15:13:08 +0000 (+0000) Subject: omg, I can't believe I copied such a borked code X-Git-Tag: xorg/old~1465 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d5f279ccee247c811f6c0f8e652062179ca9033d;p=platal.git omg, I can't believe I copied such a borked code --- diff --git a/htdocs/inscription/maj.php b/htdocs/inscription/maj.php index 6e8b2af..7caa05e 100644 --- a/htdocs/inscription/maj.php +++ b/htdocs/inscription/maj.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: maj.php,v 1.2 2004-09-05 22:58:46 x2000habouzit Exp $ + $Id: maj.php,v 1.3 2004-09-30 15:13:08 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -36,7 +36,16 @@ if (isset($ligne) && $ligne) { } // il faut remettre le matricule dans son format de saisie - $_REQUEST['matricule'] = strlen($ligne['matricule']>6) ? substr($ligne['matricule'],2) : $ligne['matricule']; + + $year = intval(substr($ligne['matricule'],0,4)); + $rang = intval(substr($ligne['matricule'],4,4)); + if($year<1996) { + $_REQUEST['matricule'] = ''; + } elseif($year<2000) { + $_REQUEST['matricule'] = sprintf('%02u0%03u',$year % 100,$rang); + } elseif($year<2100) { + $_REQUEST['matricule'] = sprintf('1%02u%03u',$year % 100,$rang); + } $_REQUEST['promo'] = $ligne['promo']; $_REQUEST['nom'] = $ligne['nom']; $_REQUEST['prenom'] = $ligne['prenom'];