From 93c38227374180ff2b43afde317b64e09ab6f3db Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Thu, 2 Sep 2004 19:03:19 +0000 Subject: [PATCH] username --- htdocs/groupex/export-econfiance.php | 9 ++++++-- htdocs/stats/graph_promo.php | 4 ++-- include/xorg.session.inc.php | 42 ++++++++++++++++++------------------ scripts/migration.sql | 8 +++---- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/htdocs/groupex/export-econfiance.php b/htdocs/groupex/export-econfiance.php index 3ce90ed..069e74e 100644 --- a/htdocs/groupex/export-econfiance.php +++ b/htdocs/groupex/export-econfiance.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: export-econfiance.php,v 1.3 2004-08-31 10:03:30 x2000habouzit Exp $ + $Id: export-econfiance.php,v 1.4 2004-09-02 19:03:19 x2000habouzit Exp $ ***************************************************************************/ @@ -32,7 +32,12 @@ if (isset($_SESSION["chall"]) && $_SESSION["chall"] != "" && $_GET["PASS"] == md require("db_connect.inc.php"); -$all = $globals->db->query("SELECT prenom,nom,username FROM auth_user_md5 as u,listes_ins as i WHERE i.idu=u.user_id AND i.idl=174 AND i.idu != 0 ORDER BY nom"); +$all = $globals->db->query("SELECT u.prenom,u.nom,a.alias + FROM auth_user_md5 AS u, + listes_ins AS i + INNER JOIN aliases AS a ON ( u.user_id = a.id AND a.type='a_vie' ) + WHERE i.idu=u.user_id AND i.idl=174 AND i.idu != 0 + ORDER BY nom"); $res = "\n\n\n\n"; diff --git a/htdocs/stats/graph_promo.php b/htdocs/stats/graph_promo.php index 0122225..cc5ee18 100644 --- a/htdocs/stats/graph_promo.php +++ b/htdocs/stats/graph_promo.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: graph_promo.php,v 1.3 2004-08-31 10:03:31 x2000habouzit Exp $ + $Id: graph_promo.php,v 1.4 2004-09-02 19:03:19 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -35,7 +35,7 @@ define('DUREEJOUR',24*3600); //recupere le nombre d'inscriptions par jour sur la plage concernée $donnees=$globals->db->query("SELECT if(date_ins>DATE_SUB(NOW(),INTERVAL $JOURS DAY), TO_DAYS(date_ins)-TO_DAYS(NOW()), ".(-($JOURS+1)).") AS jour, - count(username) AS nb + count(user_id) AS nb FROM auth_user_md5 WHERE promo = $promo GROUP BY jour"); //genere des donnees compatibles avec GNUPLOT diff --git a/include/xorg.session.inc.php b/include/xorg.session.inc.php index 387a12b..6958732 100644 --- a/include/xorg.session.inc.php +++ b/include/xorg.session.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.session.inc.php,v 1.21 2004-09-02 18:46:49 x2000habouzit Exp $ + $Id: xorg.session.inc.php,v 1.22 2004-09-02 19:03:19 x2000habouzit Exp $ ***************************************************************************/ require("diogenes.core.session.inc.php"); @@ -118,6 +118,25 @@ class XorgSession extends DiogenesCoreSession { } exit; } + + function getUserId($auth,$username) { + global $globals; + + $res = $globals->db->query("SELECT id FROM aliases WHERE alias='$username'"); + list($uid) = mysql_fetch_row($res); + mysql_free_result($res); + return $uid; + } + + + function getUsername($auth,$uid) { + global $globals; + + $res = $globals->db->query("SELECT alias FROM aliases WHERE id='$uid' AND type='a_vie'"); + list($username) = mysql_fetch_row($res); + mysql_free_result($res); + return $username; + } } /** verifie si un utilisateur a les droits pour voir une page @@ -182,7 +201,7 @@ function try_cookie() { mysql_free_result($res); $expected_value=md5($password); if($expected_value == $_COOKIE['ORGaccess']) { - start_connexion($_COOKIE['ORGuid'], $uid, false); + start_connexion($uid, false); return 0; } else return 1; } @@ -259,25 +278,6 @@ function set_skin() { $_SESSION['skin_id'] = SKIN_COMPATIBLE_ID; } - - function getUserId($auth,$username) { - global $globals; - - $res = $globals->db->query("SELECT id FROM aliases WHERE alias='$username'"); - list($uid) = mysql_fetch_row($res); - mysql_free_result($res); - return $uid; - } - - - function getUsername($auth,$uid) { - global $globals; - - $res = $globals->db->query("SELECT alias FROM aliases WHERE id='$uid' AND type='a_vie'"); - list($username) = mysql_fetch_row($res); - mysql_free_result($res); - return $username; - } } ?> diff --git a/scripts/migration.sql b/scripts/migration.sql index 4dbe518..af351b1 100644 --- a/scripts/migration.sql +++ b/scripts/migration.sql @@ -31,10 +31,10 @@ ALTER TABLE x4dat.auth_user_md5 DROP COLUMN prenom_soundex; ALTER TABLE x4dat.auth_user_md5 DROP COLUMN epouse_soundex; INSERT INTO logger.actions SET text="connexion_auth_ext",description="connection via l'auth des groupes X"; -- drop des anciens alias --> aliases ---*-- ALTER TABLE x4dat.auth_user_md5 DROP COLUMN loginbis; ---*-- ALTER TABLE x4dat.auth_user_md5 DROP COLUMN username; ---*-- ALTER TABLE x4dat.auth_user_md5 DROP COLUMN alias; - +ALTER TABLE x4dat.auth_user_md5 DROP COLUMN loginbis; +ALTER TABLE x4dat.auth_user_md5 DROP COLUMN username; +ALTER TABLE x4dat.auth_user_md5 DROP COLUMN alias; +ALTER TABLE `aliases` CHANGE `type` `type` ENUM( 'a_vie', 'epouse', 'alias', 'homonyme', 'liste', 'liste-owner', 'liste-request', 'liste-sans-moderation' ) DEFAULT 'alias' NOT NULL -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- 2.1.4