<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* Based on PhpNuke 4.x source code                                     */
/*                                                                      */
/* NPDS Copyright (c) 2002-2007 by Philippe Brunier                     */
/*                                                                      */
/* 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.       */
/************************************************************************/
function Access_Error () {
  include("admin/die.php");
}
if (!eregi("admin.php", $PHP_SELF)) { Access_Error(); }

global $language;
$hlpfile = "manuels/$language/banners.html";
$result = sql_query("select radminsuper from ".$NPDS_Prefix."authors where aid='$aid'");
list($radminsuper) = sql_fetch_row($result);
if ($radminsuper!=1) {
   Access_Error();
}

function BannersAdmin() {
    global $NPDS_Prefix;
    global $hlpfile;
    include ("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
    echo adm_translate("Administration des Bannières");
    echo "</td></tr></table>\n";
    echo "<br /><span class=\"header\"><b>".adm_translate("Bannières actives")."</b></span><br />\n<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tr>
    <td class=\"ongl\">".adm_translate("ID")."</td>
    <td class=\"ongl\">".adm_translate("Impressions")."</td>
    <td class=\"ongl\">".adm_translate("Imp. restantes")."</td>
    <td class=\"ongl\">".adm_translate("Clics")."</td>
    <td class=\"ongl\">% ".adm_translate("Clics")."</td>
    <td class=\"ongl\">".adm_translate("Nom de l'Annonceur")."</td>
    <td class=\"ongl\">".adm_translate("Fonctions")."</td></tr>";
    $result = sql_query("SELECT bid, cid, imageurl, imptotal, impmade, clicks, date FROM ".$NPDS_Prefix."banner WHERE userlevel!='9' order by bid");
    while (list($bid, $cid, $imageurl, $imptotal, $impmade, $clicks, $date) = sql_fetch_row($result)) {
       $result2 = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient where cid='$cid'");
       list($cid, $name) = sql_fetch_row($result2);
       if ($impmade==0) {
          $percent = 0;
       } else {
          $percent = substr(100 * $clicks / $impmade, 0, 5);
       }
       if ($imptotal==0) {
          $left = "".adm_translate("Illimité")."";
       } else {
          $left = $imptotal-$impmade;
       }
       $rowcolor = tablos();
       echo "<tr $rowcolor><td>$bid</td>
       <td>$impmade</td>
       <td>$left</td>
       <td>$clicks</td>
       <td>$percent%</td>
       <td>$name | <span style=\"font-size: 10px;\">".basename(aff_langue($imageurl))."</span></td>
       <td nowrap=\"nowrap\"><a href=\"admin.php?op=BannerEdit&amp;bid=$bid\" class=\"noir\">".adm_translate("Editer")."</a> | <a href=\"admin.php?op=BannerDelete&amp;bid=$bid&amp;ok=0\" class=\"rouge\">".adm_translate("Effacer")."</a></td></tr>";
    }
    echo "\n</table><hr noshade><br />";

    echo "<span class=\"header\"><b>".adm_translate("Bannières inactives")."</b></span><br />\n<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tr>
    <td class=\"ongl\">".adm_translate("ID")."</td>
    <td class=\"ongl\">".adm_translate("Impressions")."</td>
    <td class=\"ongl\">".adm_translate("Imp. restantes")."</td>
    <td class=\"ongl\">".adm_translate("Clics")."</td>
    <td class=\"ongl\">% ".adm_translate("Clics")."</td>
    <td class=\"ongl\">".adm_translate("Nom de l'Annonceur")."</td>
    <td class=\"ongl\">".adm_translate("Fonctions")."</td></tr>";
    $result = sql_query("SELECT bid, cid, imageurl, imptotal, impmade, clicks, date FROM ".$NPDS_Prefix."banner WHERE userlevel='9' order by bid");
    while (list($bid, $cid, $imageurl, $imptotal, $impmade, $clicks, $date) = sql_fetch_row($result)) {
       $result2 = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient where cid='$cid'");
       list($cid, $name) = sql_fetch_row($result2);
       if ($impmade==0) {
          $percent = 0;
       } else {
          $percent = substr(100 * $clicks / $impmade, 0, 5);
       }
       if ($imptotal==0) {
          $left = "".adm_translate("Illimité")."";
       } else {
          $left = $imptotal-$impmade;
       }
       $rowcolor = tablos();
       echo "<tr $rowcolor><td>$bid</td>
       <td>$impmade</td>
       <td>$left</td>
       <td>$clicks</td>
       <td>$percent%</td>
       <td>$name | <span style=\"font-size: 10px;\">".basename(aff_langue($imageurl))."</span></td>
       <td nowrap=\"nowrap\"><a href=\"admin.php?op=BannerEdit&amp;bid=$bid\" class=\"noir\">".adm_translate("Editer")."</a> | <a href=\"admin.php?op=BannerDelete&amp;bid=$bid&amp;ok=0\" class=\"rouge\">".adm_translate("Effacer")."</a></td></tr>";
    }
    echo "\n</table><hr noshade><br />";

    echo "<span class=\"header\"><b>".adm_translate("Bannières terminées")."</b></span><br />
    <table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tr>
    <td class=\"ongl\">".adm_translate("ID")."</td>
    <td class=\"ongl\">".adm_translate("Imp.")."</td>
    <td class=\"ongl\">".adm_translate("Clics")."</td>
    <td class=\"ongl\">% ".adm_translate("Clics")."</td>
    <td class=\"ongl\">".adm_translate("Date de début")."</td>
    <td class=\"ongl\">".adm_translate("Date de fin")."</td>
    <td class=\"ongl\">".adm_translate("Nom de l'Annonceur")."</td>
    <td class=\"ongl\">".adm_translate("Fonctions")."</td></tr>";
    $result = sql_query("select bid, cid, impressions, clicks, datestart, dateend from ".$NPDS_Prefix."bannerfinish order by bid");
    while (list($bid, $cid, $impressions, $clicks, $datestart, $dateend) = sql_fetch_row($result)) {
       $result2 = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient where cid='$cid'");
       list($cid, $name) = sql_fetch_row($result2);
       if ($impressions==0) {$impressions=1;}
       $percent = substr(100 * $clicks / $impressions, 0, 5);
       $rowcolor = tablos();
       echo "<tr $rowcolor><td>$bid</td>
       <td>$impressions</td>
       <td>$clicks</td>
       <td>$percent%</td>
       <td>$datestart</td>
       <td>$dateend</td>
       <td>$name</td>
       <td nowrap=\"nowrap\"><a href=\"admin.php?op=BannerFinishDelete&amp;bid=$bid\" class=\"rouge\">".adm_translate("Effacer")."</a></td></tr>";
    }
    echo "\n</table><hr noshade><br />";
    echo "<span class=\"header\"><b>".adm_translate("Annonceurs faisant de la publicité")."</b></span><br />
    <table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tr>
    <td class=\"ongl\">".adm_translate("ID")."</td>
    <td class=\"ongl\">".adm_translate("Nom de l'Annonceur")."</td>
    <td class=\"ongl\">".adm_translate("Bannières actives")."</td>
    <td class=\"ongl\">".adm_translate("Nom du Contact")."</td>
    <td class=\"ongl\">".adm_translate("E-mail")."</td>
    <td class=\"ongl\">".adm_translate("Fonctions")."</td></tr>";
    $result = sql_query("select cid, name, contact, email from ".$NPDS_Prefix."bannerclient order by cid");
    while (list($cid, $name, $contact, $email) = sql_fetch_row($result)) {
       $result2 = sql_query("select cid from ".$NPDS_Prefix."banner where cid='$cid'");
       $numrows = sql_num_rows($result2);
       $rowcolor = tablos();
       echo "<tr $rowcolor><td>$cid</td>
       <td>$name</td>
       <td>$numrows</td>
       <td>$contact</td>
       <td><font size=1>$email</font></td>
       <td nowrap=\"nowrap\"><a href=\"admin.php?op=BannerClientEdit&amp;cid=$cid\" class=\"noir\">".adm_translate("Editer")."</a> | <a href=\"admin.php?op=BannerClientDelete&amp;cid=$cid\" class=\"rouge\">".adm_translate("Effacer")."</a></td></tr>";
    }
    echo "\n</table><hr noshade><br />\n";
    // Add Banner
    $result = sql_query("select * from ".$NPDS_Prefix."bannerclient");
    $numrows = sql_num_rows($result);
    if ($numrows>0) {
       echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
       echo "".adm_translate("Ajouter une nouvelle Bannière")."";
       echo "</td></tr></table>\n";
       echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td colspan=2>";
       echo "<li>".adm_translate("Pour les Bannières Javascript, saisir seulement le code javascript dans la zone <i>Url du Clik</i> et laisser la zone image vide.")."</li><br /><br />";
       echo "<li>".adm_translate("Pour les Bannières encore plus complexes (Flash, ...), saisir simplement la référence à votre_répertoire/votre_fichier<b>.txt</b> (fichier de code php) dans la zone <i>Url du Clik</i> et laisser la zone image vide.")."</li><br /><br />";
       echo "</td></tr>
       <form action=\"admin.php\" method=\"post\">
        <tr><td>".adm_translate("Nom de l'Annonceur : ")."</td><td>
        <select class=\"textbox_standard\" name=\"cid\">";
        $result = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient");
        while(list($cid, $name) = sql_fetch_row($result)) {
            echo "<option value=\"$cid\">$name</option>";
        }
        echo "</select></td></tr>";
        echo "<tr><td width=\"25%\">".adm_translate("Impressions réservées : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"imptotal\" size=\"12\" maxlength=\"11\"> 0 = ".adm_translate("Illimité")."</td></tr>
        <tr><td>".adm_translate("URL de l'image : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"imageurl\" size=\"45\" maxlength=\"200\"></td></tr>
        <tr><td>".adm_translate("URL du Clic : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"clickurl\" size=\"45\" maxlength=\"200\"></td></tr>
        <tr><td>".adm_translate("Niveau de l'Utilisateur")." :</td><td><input class=\"textbox_standard\" type=\"text\" name=\"userlevel\" size=\"2\" maxlength=\"2\" value=\"0\"> <span style=\"font-size: 10px;\">".adm_translate("0=Tout le monde, 1=Membre seulement, 3=Administrateur seulement, 9=Désactiver").".</span></td></tr>
        <input type=\"hidden\" name=\"op\" value=\"BannersAdd\">
        <tr><td><input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate("Ajouter une Bannière")."\"></td></tr>
        </form></table>";
    }
    // Add Client
    echo "<br /><table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
    echo "".adm_translate("Ajouter un nouvel Annonceur")."";
    echo "</td></tr></table>\n";
    echo "<br /><table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\">
    <form action=\"admin.php\" method=\"post\">
    <tr><td width=\"25%\">".adm_translate("Nom de l'Annonceur : ")."</td><td><input class=\"textbox\" type=\"text\" name=\"name\" size=\"30\" maxlength=\"60\"></td></tr>
    <tr><td>".adm_translate("Nom du Contact : ")."</td><td><input class=\"textbox\" type=\"text\" name=\"contact\" size=\"30\" maxlength=\"60\"></td></tr>
    <tr><td>".adm_translate("E-mail: ")."</td><td><input class=\"textbox\" type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\"></td></tr>
    <tr><td>".adm_translate("Identifiant : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"login\" size=\"12\" maxlength=\"10\"></td></tr>
    <tr><td>".adm_translate("Mot de Passe : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"passwd\" size=\"12\" maxlength=\"10\"></td></tr>
    <tr><td>".adm_translate("Informations supplémentaires : ")."</td><td><textarea class=\"textbox\" name=\"extrainfo\" cols=\"45\" rows=\"10\"></textarea></td></tr>
    <input type=\"hidden\" name=\"op\" value=\"BannerAddClient\">
    <tr><td><input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate("Ajouter Annonceur")."\"></td></tr>
    </form></table>";
    closetable();
    include ("footer.php");
}

function BannersAdd($name, $cid, $imptotal, $imageurl, $clickurl, $userlevel) {
    global $NPDS_Prefix;
    sql_query("insert into ".$NPDS_Prefix."banner values (NULL, '$cid', '$imptotal', '1', '0', '$imageurl', '$clickurl', '$userlevel', now())");
    Header("Location: admin.php?op=BannersAdmin");
}

function BannerAddClient($name, $contact, $email, $login, $passwd, $extrainfo) {
    global $NPDS_Prefix;
    sql_query("insert into ".$NPDS_Prefix."bannerclient values (NULL, '$name', '$contact', '$email', '$login', '$passwd', '$extrainfo')");
    Header("Location: admin.php?op=BannersAdmin");
}

function BannerFinishDelete($bid) {
    global $NPDS_Prefix;
    sql_query("delete from ".$NPDS_Prefix."bannerfinish where bid='$bid'");
    Header("Location: admin.php?op=BannersAdmin");
}

function BannerDelete($bid, $ok=0) {
    global $NPDS_Prefix;
    if ($ok==1) {
       sql_query("delete from ".$NPDS_Prefix."banner where bid='$bid'");
       Header("Location: admin.php?op=BannersAdmin");
    } else {
       global $hlpfile;
       include("header.php");
       GraphicAdmin($hlpfile);
       $result=sql_query("select cid, imptotal, impmade, clicks, imageurl, clickurl from ".$NPDS_Prefix."banner where bid='$bid'");
       list($cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl) = sql_fetch_row($result);
       opentable();
       echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
       echo adm_translate("Effacer Bannière");
       echo "</td></tr></table>\n";
       if ($imageurl!="") {
          echo "<a href=\"".aff_langue($clickurl)."\"><img src=\"".aff_langue($imageurl)."\" alt=\"\" border=\"1\" /></a><br />";
       } else {
          echo $clickurl;
       }
       echo "<br /><table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr>
       <td class=\"ongl\">".adm_translate("ID")."</td>
       <td class=\"ongl\">".adm_translate("Impressions")."</td>
       <td class=\"ongl\">".adm_translate("Imp. restantes")."</td>
       <td class=\"ongl\">".adm_translate("Clics")."</td>
       <td class=\"ongl\">% ".adm_translate("Clics")."</td>
       <td class=\"ongl\">".adm_translate("Nom de l'Annonceur")."</td></tr>";
       $result2 = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient where cid='$cid'");
       list($cid, $name) = sql_fetch_row($result2);
       $percent = substr(100 * $clicks / $impmade, 0, 5);
       if ($imptotal==0) {
          $left = unlimited;
       } else {
          $left = $imptotal-$impmade;
       }
       echo "
       <tr><td>$bid</td>
       <td>$impmade</td>
       <td>$left</td>
       <td>$clicks</td>
       <td>$percent%</td>
       <td>$name</td></tr>";
    }
    echo "</table><br />
    <p align=\"center\">".adm_translate("Etes-vous sûr de vouloir effacer cette Bannière ?")." -
    [ <a href=\"admin.php?op=BannerDelete&amp;bid=$bid&amp;ok=1\" class=\"rouge\">".adm_translate("Oui")."</a> | <a href=\"admin.php?op=BannersAdmin\"  class=\"noir\">".adm_translate("Non")."</a> ]</p><br />";
    closetable();
    include("footer.php");
}

function BannerEdit($bid) {
    global $NPDS_Prefix;
    global $hlpfile;
    include("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    $result=sql_query("select cid, imptotal, impmade, clicks, imageurl, clickurl, userlevel from ".$NPDS_Prefix."banner where bid='$bid'");
    list($cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $userlevel) = sql_fetch_row($result);
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
    echo adm_translate("Edition Bannière");
    echo "</td></tr></table><p align=\"center\">\n";
    if ($imageurl!="") {
       echo "<img src=\"".aff_langue($imageurl)."\" border=\"1\" alt=\"\" /><br /><br />";
    } else {
       echo $clickurl;
    }
    echo "</p><br />";
    echo "<li>".adm_translate("Pour les Bannières Javascript, saisir seulement le code javascript dans la zone <i>Url du Clik</i> et laisser la zone image vide.")."</li><br /><br />";
    echo "<li>".adm_translate("Pour les Bannières encore plus complexes (Flash, ...), saisir simplement la référence à votre_répertoire/votre_fichier<b>.txt</b> (fichier de code php) dans la zone <i>Url du Clik</i> et laisser la zone image vide.")."</li>";
    echo "<form action=\"admin.php\" method=\"post\">";
    echo "<br /><table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\">
    <form action=\"admin.php\" method=\"post\">
    <tr><td width=\"25%\">".adm_translate("Nom de l'Annonceur : ")."</td><td><select class=\"textbox_standard\" name=\"cid\">";
    $result = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient where cid='$cid'");
    list($cid, $name) = sql_fetch_row($result);
    echo "<option value=\"$cid\" selected>$name</option>";
    $result = sql_query("select cid, name from ".$NPDS_Prefix."bannerclient");
    while (list($ccid, $name) = sql_fetch_row($result)) {
       if ($cid!=$ccid) {
          echo "<option value=\"$ccid\">$name</option>";
       }
    }
    echo "</select></td></tr>";
    if ($imptotal==0) {
       $impressions = "".adm_translate("Illimité")."";
    } else {
       $impressions = $imptotal;
    }
    echo"<tr><td>".adm_translate("Ajouter plus d'affichages : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"impadded\" size=\"12\" maxlength=\"11\"> ".adm_translate("Réservé : ")."<b>$impressions</b> ".adm_translate("Fait : ")."<b>$impmade</b></td></tr>
    <tr><td>".adm_translate("URL de l'image : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"imageurl\" size=\"50\" maxlength=\"200\" value=\"$imageurl\"></td></tr>
    <tr><td>".adm_translate("URL du Clic : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"clickurl\" size=\"50\" maxlength=\"200\" value=\"".htmlentities($clickurl)."\"></td></tr>
    <tr><td>".adm_translate("Niveau de l'Utilisateur")." :</td><td><input class=\"textbox_standard\" type=\"text\" name=\"userlevel\" size=\"2\" maxlength=\"2\" value=\"$userlevel\"> <span style=\"font-size: 10px;\">".adm_translate("0=Tout le monde, 1=Membre seulement, 3=Administrateur seulement, 9=Désactiver").".</span></td></tr>
    <input type=\"hidden\" name=\"bid\" value=\"$bid\">
    <input type=\"hidden\" name=\"imptotal\" value=\"$imptotal\">
    <input type=\"hidden\" name=\"op\" value=\"BannerChange\">
    <tr><td><input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate("Modifier la Bannière")."\"></td></tr>
    </form></table>";
    closetable();
    include("footer.php");
}

///////////////////////////////////
function BannerChange($bid, $cid, $imptotal, $impadded, $imageurl, $clickurl, $userlevel) {
    global $NPDS_Prefix;
    $imp = $imptotal+$impadded;
    sql_query("update ".$NPDS_Prefix."banner set cid='$cid', imptotal='$imp', imageurl='$imageurl', clickurl='$clickurl', userlevel='$userlevel' where bid='$bid'");
    Header("Location: admin.php?op=BannersAdmin");
}

function BannerClientDelete($cid, $ok=0) {
    global $NPDS_Prefix;
    global $sitename;
    if ($ok==1) {
       sql_query("delete from ".$NPDS_Prefix."banner where cid='$cid'");
       sql_query("delete from ".$NPDS_Prefix."bannerclient where cid='$cid'");
       Header("Location: admin.php?op=BannersAdmin");
    } else {
       include("header.php");
       GraphicAdmin($hlpfile);
       $result=sql_query("select cid, name from ".$NPDS_Prefix."bannerclient where cid='$cid'");
       list($cid, $name) = sql_fetch_row($result);
       echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
       echo adm_translate("Supprimer l'Annonceur");
       echo "</td></tr></table>\n";
       echo "<br /><p align=\"center\">
       ".adm_translate("Vous êtes sur le point de supprimer cet Annonceur : ")." <b>$name</b> ".adm_translate("et toutes ses Bannières !!!")."</p><br /><br />";
       $result2 = sql_query("select imageurl, clickurl from ".$NPDS_Prefix."banner where cid='$cid'");
       $numrows = sql_num_rows($result2);
       if ($numrows==0) {
          echo adm_translate("Cet Annonceur n'a pas de Bannière active pour le moment.")."<br /><br />";
       } else {
          echo "<span class=\"rouge\"><b>".adm_translate("ATTENTION !!!")."</b></span><br /><br />
          ".adm_translate("Cet Annonceur a les BANNIÈRES ACTIVES suivantes dans")." $sitename :<br /><br />";
       }
       while (list($imageurl, $clickurl) = sql_fetch_row($result2)) {
          if ($imageurl!="") {
             echo "<img src=\"".aff_langue($imageurl)."\" border=\"1\" alt=\"\"><br /><br />";
          } else {
             echo $clickurl."<br /><br />";
          }
       }
    }
    echo "<p align=\"center\">".adm_translate("Etes-vous sûr de vouloir effacer cet Annonceur et TOUTES ses Bannières ?")." -
    [ <a href=\"admin.php?op=BannerClientDelete&amp;cid=$cid&amp;ok=1\" class=\"rouge\">".adm_translate("Oui")."</a> | <a href=\"admin.php?op=BannersAdmin\" class=\"noir\">".adm_translate("Non")."</a> ]</p><br /><br />";
    closetable();
    include("footer.php");
}

function BannerClientEdit($cid) {
    global $NPDS_Prefix;
    global $hlpfile;
    include("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    $result = sql_query("select name, contact, email, login, passwd, extrainfo from ".$NPDS_Prefix."bannerclient where cid='$cid'");
    list($name, $contact, $email, $login, $passwd, $extrainfo) = sql_fetch_row($result);
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
    echo adm_translate("Editer l'Annonceur");
    echo "</td></tr></table>\n";
    echo "<br /><table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
    <form action=\"admin.php\" method=\"post\">";
    echo "<tr><td width=\"30%\">".adm_translate("Nom de l'Annonceur : ")."</td><td><input class=\"textbox\" type=\"text\" name=\"name\" value=\"".$name."\" size=\"30\" maxlength=\"60\"></td></tr>
    <tr><td>".adm_translate("Nom du Contact : ")."</td><td><input class=\"textbox\" type=\"text\" name=\"contact\" value=\"$contact\" size=\"30\" maxlength=\"60\"></td></tr>
    <tr><td>".adm_translate("E-mail: ")."</td><td><input class=\"textbox\" type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\" value=\"$email\"></td></tr>
    <tr><td>".adm_translate("Identifiant : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"login\" size=\"12\" maxlength=\"10\" value=\"$login\"></td></tr>
    <tr><td>".adm_translate("Mot de Passe : ")."</td><td><input class=\"textbox_standard\" type=\"text\" name=\"passwd\" size=\"12\" maxlength=\"10\" value=\"$passwd\"></td></tr>
    <tr><td>".adm_translate("Informations supplémentaires : ")."</td><td><textarea class=\"textbox\" name=\"extrainfo\" cols=\"60\" rows=\"10\">$extrainfo</textarea></td></tr>
    <input type=\"hidden\" name=\"cid\" value=\"$cid\">
    <input type=\"hidden\" name=\"op\" value=\"BannerClientChange\">
    <tr><td><input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate("Modifier Annonceur")."\"></td></tr>
    </form></table>";
    closetable();
    include("footer.php");
}

function BannerClientChange($cid, $name, $contact, $email, $extrainfo, $login, $passwd, $extrainfo) {
    global $NPDS_Prefix;
    sql_query("update ".$NPDS_Prefix."bannerclient set name='$name', contact='$contact', email='$email', login='$login', passwd='$passwd', extrainfo='$extrainfo' where cid='$cid'");
    Header("Location: admin.php?op=BannersAdmin");
}

switch($op) {
    case "BannersAdmin":
         BannersAdmin();
         break;

    case "BannersAdd":
         BannersAdd($name, $cid, $imptotal, $imageurl, $clickurl, $userlevel);
         break;

    case "BannerAddClient":
         BannerAddClient($name, $contact, $email, $login, $passwd, $extrainfo);
         break;

    case "BannerFinishDelete":
         BannerFinishDelete($bid);
         break;

    case "BannerDelete":
         BannerDelete($bid, $ok);
         break;

    case "BannerEdit":
         BannerEdit($bid);
         break;

    case "BannerChange":
         BannerChange($bid, $cid, $imptotal, $impadded, $imageurl, $clickurl, $userlevel);
         break;

    case "BannerClientDelete":
         BannerClientDelete($cid, $ok);
         break;

    case "BannerClientEdit":
         BannerClientEdit($cid);
         break;

    case "BannerClientChange":
         BannerClientChange($cid, $name, $contact, $email, $extrainfo, $login, $passwd, $extrainfo);
         break;
}
?>