<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2005 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 () {
  if (file_exists("meta/meta.php"))
     include ("meta/meta.php");
  echo "<title>NPDS</title></head><body bgcolor=\"white\"><br /><p align=\"center\"><span style=\"font-size: 14px; font-family: Arial; font-weight: bold; color: red;\">";
  echo "Access Denied / Acc&egrave;s Refus&eacute;";
  if (cur_charset=="utf-8") echo" / &#x901A;&#x5165;&#x88AB;&#x5426;&#x8BA4;";
  echo "</span>";
  echo "<br /><br /><span style=\"font-size: 12px; font-family: Arial; font-weight: bold; color: black;\">NPDS - Portal System";
  echo "</span></p></body></html>";
  die();
}
if (!eregi("admin.php", $PHP_SELF)) { Access_Error(); }
global $pdst; $pdst="0";

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

function BannersAdmin() {
    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 = mysql_query("SELECT bid, cid, imageurl, imptotal, impmade, clicks, date FROM banner WHERE userlevel!='9' order by bid");
    while (list($bid, $cid, $imageurl, $imptotal, $impmade, $clicks, $date) = mysql_fetch_row($result)) {
       $result2 = mysql_query("select cid, name from bannerclient where cid='$cid'");
       list($cid, $name) = mysql_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($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 = mysql_query("SELECT bid, cid, imageurl, imptotal, impmade, clicks, date FROM banner WHERE userlevel='9' order by bid");
    while (list($bid, $cid, $imageurl, $imptotal, $impmade, $clicks, $date) = mysql_fetch_row($result)) {
       $result2 = mysql_query("select cid, name from bannerclient where cid='$cid'");
       list($cid, $name) = mysql_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($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 = mysql_query("select bid, cid, impressions, clicks, datestart, dateend from bannerfinish order by bid");
    while (list($bid, $cid, $impressions, $clicks, $datestart, $dateend) = mysql_fetch_row($result)) {
       $result2 = mysql_query("select cid, name from bannerclient where cid='$cid'");
       list($cid, $name) = mysql_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 = mysql_query("select cid, name, contact, email from bannerclient  order by cid");
    while (list($cid, $name, $contact, $email) = mysql_fetch_row($result)) {
       $result2 = mysql_query("select cid from banner where cid='$cid'");
       $numrows = mysql_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 = mysql_query("select * from bannerclient");
    $numrows = mysql_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 = mysql_query("select cid, name from bannerclient");
        while(list($cid, $name) = mysql_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) {
    mysql_query("insert into 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) {
    mysql_query("insert into bannerclient values (NULL, '$name', '$contact', '$email', '$login', '$passwd', '$extrainfo')");
    Header("Location: admin.php?op=BannersAdmin");
}

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

function BannerDelete($bid, $ok=0) {
    if ($ok==1) {
       mysql_query("delete from banner where bid='$bid'");
       Header("Location: admin.php?op=BannersAdmin");
    } else {
       global $hlpfile;
       include("header.php");
       GraphicAdmin($hlpfile);
       $result=mysql_query("select cid, imptotal, impmade, clicks, imageurl, clickurl from banner where bid='$bid'");
       list($cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl) = mysql_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=\"$clickurl\"><img src=\"$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 = mysql_query("select cid, name from bannerclient where cid='$cid'");
       list($cid, $name) = mysql_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 $hlpfile;
    include("header.php");
    GraphicAdmin($hlpfile);
    OpenTable();
    $result=mysql_query("select cid, imptotal, impmade, clicks, imageurl, clickurl, userlevel from banner where bid='$bid'");
    list($cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $userlevel) = mysql_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=\"$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 = mysql_query("select cid, name from bannerclient where cid='$cid'");
    list($cid, $name) = mysql_fetch_row($result);
    echo "<option value=\"$cid\" selected>$name</option>";
    $result = mysql_query("select cid, name from bannerclient");
    while (list($ccid, $name) = mysql_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) {
    $imp = $imptotal+$impadded;
    mysql_query("update 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 $sitename;
    if ($ok==1) {
       mysql_query("delete from banner where cid='$cid'");
       mysql_query("delete from bannerclient where cid='$cid'");
       Header("Location: admin.php?op=BannersAdmin");
    } else {
       include("header.php");
       GraphicAdmin($hlpfile);
       $result=mysql_query("select cid, name from bannerclient where cid='$cid'");
       list($cid, $name) = mysql_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 = mysql_query("select imageurl, clickurl from banner where cid='$cid'");
       $numrows = mysql_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) = mysql_fetch_row($result2)) {
          if ($imageurl!="") {
             echo "<img src=\"$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 $hlpfile;
    include("header.php");
    GraphicAdmin($hlpfile);
    OpenTable();
    $result = mysql_query("select name, contact, email, login, passwd, extrainfo from bannerclient where cid='$cid'");
    list($name, $contact, $email, $login, $passwd, $extrainfo) = mysql_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) {
    mysql_query("update 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;
}
?>
