// ******************************************************************************** // * PHP My Pub * // * crée par Frank JAMOIS * // * sur les bases de "la Regie Pub" de François L. * // * Site : http://www.phpmypub.net/ * // * E-mail : aide@phpmypub.net * // * * // * Copyright (C) 2003 Frank JAMOIS * // * * // * This file is part of phpMyPub. * // * * // * phpMyPub 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. * // * * // * phpMyPub 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 Foobar; if not, write to the Free Software * // * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * // * * // * * // * phpMyPub est un logiciel libre; vous pouvez le redistribuer * // * et/ou le modifier selon les termes de la GNU General Public * // * License (Licence Publique Générale GNU) telle qu'elle a été * // * publiée par la Free Software Foundation; soit la version 2 de de * // * la licence, soit (comme vous le souhaitez) toute version * // * ultérieure. * // * * // * phpMyPub est distribué dans l'espoir qu'il sera utile, mais * // * SANS LA MOINDRE GARANTIE; pas même la garantie implicite de * // * COMMERCIABILITE ou d'ADEQUATION A UN BUT PARTICULIER. Voir la GNU * // * General Public License pour plus de détails. * // * * // * Vous devriez avoir reçu une copie de la GNU General Public License * // * en même temps que ce programme; sinon, merci d'écrire à la Free * // * Software Foundation, Inc, 59 Temple Place, Suite 330, Boston, MA * // * 02111-1307 USA * // * * // ******************************************************************************** // // On récupere les données de connexion require "config.php"; // mettre le chemin du fichier config.php ou php3 // Connexion a la base de données $mysql_link = mysql_connect("$serveur","$user","$password"); mysql_select_db("$base",$mysql_link); // creation du nom du cookie $NomCook = $NomCookie.$IdBan ; // mise en majuscule du nom du cookie $Cookie = strtoupper($NomCook); // controle de la presence du cookie if ($HTTP_COOKIE_VARS[$Cookie] != $IdBan OR $ActiveCookie == non) { if ($ActiveCookie == oui) { // creation du cookie if ($ExpireCookie != '') { // calcule du temps de validite du cookie $expire=time()+$ExpireCookie; } setcookie ($Cookie,$IdBan,$expire); } // On ajoute un clique de plus $sql="UPDATE $table SET ClickBan = ClickBan + 1 WHERE IdBan = $IdBan "; mysql_query($sql,$mysql_link); // On ajoute un clique de plus pour les stats $mois=date("m"); $annee=date("Y"); $sql="UPDATE $table_stat SET Click_Stat = Click_Stat + 1 WHERE ( (Id_Pub = $IdBan) AND (Mois_Stat = $mois) AND (Annee_Stat = $annee) )"; mysql_query($sql,$mysql_link); } // On recupere l'URL de la bannière $sql="SELECT UrlBan FROM $table WHERE IdBan = $IdBan "; $res=mysql_query($sql,$mysql_link); // On redirige la page vers l'URL if ($row=mysql_fetch_row($res)) header("Location: $row[0]"); // Ou on affiche le message d'erreur else echo "
"; ?>