Subversion Repositories Sites.tela-botanica.org

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU Lesser General Public                                           |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library 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                                    |
// | Lesser General Public License for more details.                                                      |
// |                                                                                                      |
// | You should have received a copy of the GNU Lesser General Public                                     |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: spip_cookie.php,v 1.1 2004/07/06 15:42:28 alex Exp $
/**
* Envoie de cookie pour SPIP à partir d'une inscription 
*
* Envoie de cookie pour SPIP à partir d'une inscription 
*
*@package inscription
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.1 $ $Date: 2004/07/06 15:42:28 $
// +------------------------------------------------------------------------------------------------------+
*/


// Ce fichier doit être placé à la racine de SPIP
// Il doit être appellé dans chaque squelette
// après l'ouverture d'une session, si on ouvre une session

// Il faut récupérer une valeur userid, c'est à dire
// loggué l'utilisateur par exemple avec PEAR

if ($userid != 0) {


    setcookie("spip_admin", "@$login", time()+3600*24*30, "/vecam/") ;

    include ("ecrire/inc_version.php3");

    include_ecrire ("inc_meta.php3");
    include_ecrire ("inc_session.php3");
    $query = "SELECT * FROM spip_auteurs WHERE id_auteur=$userid";
    $result = mysql_query($query);
    $GLOBALS['auteur_session'] = mysql_fetch_array($result) ;
    $GLOBALS['auteur_session']['statut'] = "1comite" ;
    $GLOBALS['auteur_session']['lang'] = "en" ;

    if (!$HTTP_COOKIE_VARS["spip_session"]) {
        $id_session = $userid."_".(md5 (uniqid (rand ())));
        setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;

    } else {
        $id_session = preg_replace("/[0-9]+_/", $userid."_", $HTTP_COOKIE_VARS["spip_session"]) ;
        setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
    }

    ajouter_session($GLOBALS['auteur_session'], $id_session) ;

   
}












?>