[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Advertising/ -> index.php (source)

   1  <?php
   2  
   3  /************************************************************************/
   4  /* PHP-NUKE: Web Portal System                                          */
   5  /* ===========================                                          */
   6  /*                                                                      */
   7  /* Copyright (c) 2005 by Francisco Burzi                                */
   8  /* http://phpnuke.org                                                   */
   9  /*                                                                      */
  10  /* Google Page Rank Calculation                                         */
  11  /* Copyright 2004 by GoogleCommunity.com                                */
  12  /*                                                                      */
  13  /* This program is free software. You can redistribute it and/or modify */
  14  /* it under the terms of the GNU General Public License as published by */
  15  /* the Free Software Foundation; either version 2 of the License.       */
  16  /************************************************************************/
  17  
  18  // This system includes Google Page Rank Calculation made by GoogleCommunity.com
  19  // Don't abuse this script. It's here for your use, to give accurate information
  20  // about your site to your potential advertising customers. If you need the complete
  21  // Google Page Rank Calculator script, please go to: http://www.GoogleCommunity.com
  22  // and download the latest and stand alone release.
  23  
  24  if (!defined('MODULE_FILE')) {
  25      die ("You can't access this file directly...");
  26  }
  27  
  28  require_once ("mainfile.php");
  29  $module_name = basename(dirname(__FILE__));
  30  get_lang($module_name);
  31  
  32  function is_client($client) {
  33      global $prefix, $db;
  34      if(!is_array($client)) {
  35          $client = base64_decode($client);
  36          $client = addslashes($client);
  37          $client = explode(":", $client);
  38          $cid = "$client[0]";
  39          if (isset($client[2])) { $pwd = $client[2]; }
  40      } else {
  41          $cid = "$client[0]";
  42          if (isset($client[2])) { $pwd = $client[2]; }
  43      }
  44      if (!empty($cid) AND !empty($pwd)) {
  45          $result = $db->sql_query("SELECT passwd FROM ".$prefix."_banner_clients WHERE cid='$cid'");
  46          $row = $db->sql_fetchrow($result);
  47          $pass = $row['passwd'];
  48          if(!empty($pass) AND $pass == $pwd) {
  49              return 1;
  50          }
  51      }
  52      return 0;
  53  }
  54  
  55  function themenu() {
  56      global $module_name, $prefix, $db, $client, $op;
  57      echo "<br>";
  58      if (is_client($client)) {
  59          if ($op == "client_home") {
  60              $client_opt = _MYADS;
  61          } else {
  62              $client_opt = "<a href=\"modules.php?name=$module_name&op=client_home\">"._MYADS."</a>";
  63          }
  64      } else {
  65          $client_opt = "<a href=\"modules.php?name=$module_name&op=client\">"._CLIENTLOGIN."</a>";
  66      }
  67      OpenTable();
  68      echo "<center><b>"._ADSMENU."</b><br><br>[ <a href=\"modules.php?name=$module_name\">"._MAINPAGE."</a> | <a href=\"modules.php?name=$module_name&op=sitestats\">"._SITESTATS."</a> | <a href=\"modules.php?name=$module_name&op=terms\">"._TERMS."</a> | <a href=\"modules.php?name=$module_name&op=plans\">"._PLANSPRICES."</a> | $client_opt ]</center>";
  69      CloseTable();
  70  }
  71  
  72  function theindex() {
  73      global $prefix, $db, $sitename;
  74      include ("header.php");
  75      title("$sitename "._ADVERTISING."");
  76      OpenTable();
  77      echo ""._WELCOMEADS."";  
  78      CloseTable();
  79      themenu();
  80      include ("footer.php");
  81  }
  82  
  83  function sitestats() {
  84      global $module_name, $prefix, $db, $user_prefix, $nukeurl, $sitename;
  85      $url = $nukeurl;    
  86      $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_year WHERE hits!='0'");
  87      $hits = 0;
  88      $a = 0;
  89      while ($row = $db->sql_fetchrow($result)) {
  90          $hits = $hits+$row['hits'];
  91          $a++;
  92      }
  93      $views_y = $hits/$a;
  94      $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_month WHERE hits!='0'");
  95      $hits = 0;
  96      $a = 0;
  97      while ($row = $db->sql_fetchrow($result)) {
  98          $hits = $hits+$row['hits'];
  99          $a++;
 100      }
 101      $views_m = $hits/$a;
 102      $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_date WHERE hits!='0'");
 103      $hits = 0;
 104      $a = 0;
 105      while ($row = $db->sql_fetchrow($result)) {
 106          $hits = $hits+$row['hits'];
 107          $a++;
 108      }
 109      $views_d = $hits/$a;
 110      $result = $db->sql_query("SELECT hits FROM ".$prefix."_stats_hour WHERE hits!='0'");
 111      $hits = 0;
 112      $a = 0;
 113      while ($row = $db->sql_fetchrow($result)) {
 114          $hits = $hits+$row['hits'];
 115          $a++;
 116      }
 117      $views_h = $hits/$a;
 118      $views_y = round($views_y);
 119      $views_m = round($views_m);
 120      $views_d = round($views_d);
 121      $views_h = round($views_h);
 122      $row = $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total'"));
 123      $views_t = $row['count'];
 124      $regusers = $db->sql_numrows($db->sql_query("SELECT user_id FROM ".$user_prefix."_users"));
 125      include ("header.php");
 126      title("$sitename: "._GENERALSTATS."");
 127      OpenTable();
 128      echo ""._HEREARENUMBERS."<br><br><br>"
 129          ."<li>"._TOTALVIEWS." <b>$views_t</b><br><br>"
 130          ."<li>"._VIEWSYEAR." <b>$views_y</b><br><br>"
 131          ."<li>"._VIEWSMONTH." <b>$views_m</b><br><br>"
 132          ."<li>"._VIEWSDAY." <b>$views_d</b><br><br>"
 133          ."<li>"._VIEWSHOUR." <b>$views_h</b><br><br>"
 134          ."<li>"._CURREGUSERS." <b>$regusers</b><br><br>";
 135      if ($url != "http://--------.---") {
 136          echo "<li>"._GOOGLERANK." <b>".getrank($url)."</b><br><br>";
 137      }
 138      CloseTable();
 139      themenu();
 140      include ("footer.php");
 141  }
 142  
 143  function plans() {
 144      global $module_name, $prefix, $db, $bgcolor2, $sitename;
 145      include ("header.php");
 146      title("$sitename: "._PLANSPRICES."");
 147      OpenTable();
 148      $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner_plans WHERE active='1'"));
 149      if ($numrows > 0) {
 150          $result = $db->sql_query("SELECT * FROM ".$prefix."_banner_plans WHERE active='1'");
 151          echo ""._LISTPLANS."<br><br>";
 152          echo "<table border=\"1\" width=\"100%\" cellpadding=\"3\">";
 153          echo "<tr><td align=\"center\" nowrap bgcolor=\"$bgcolor2\"><b>"._PLANNAME."</b></td><td bgcolor=\"$bgcolor2\">&nbsp;<b>"._DESCRIPTION."</b></td><td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._QUANTITY."</b></td><td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._PRICE."</b></td><td align=\"center\" bgcolor=\"$bgcolor2\" nowrap><b>"._BUYLINKS."</b></td></tr>";
 154          while ($row = $db->sql_fetchrow($result)) {
 155              if ($row['delivery_type'] == "0") {
 156                  $delivery = _IMPRESSIONS;
 157              } elseif ($row['delivery_type'] == "1") {
 158                  $delivery = _CLICKS;
 159              } elseif ($row['delivery_type'] == "2") {
 160                  $delivery = _DAYS;
 161              } elseif ($row['delivery_type'] == "3") {
 162                  $delivery = _MONTHS;
 163              } elseif ($row['delivery_type'] == "4") {
 164                  $delivery = _YEARS;
 165              }
 166              echo "<tr><td valign=\"top\"><b>".$row['name']."</b></td><td>".$row['description']."</td><td valign=\"bottom\"><center>".$row['delivery']."<br>$delivery</center></td><td valign=\"bottom\">".$row['price']."</td><td valign=\"bottom\" nowrap><center>".$row['buy_links']."</center></td></tr>";
 167          }
 168          echo "</table>";
 169      } else {
 170          echo "<center>"._ADSNOCONTENT."<br><br>"._GOBACK."</center>";
 171      }
 172      CloseTable();
 173      themenu();
 174      include ("footer.php");
 175  }
 176  
 177  function terms() {
 178      global $module_name, $prefix, $db, $sitename;
 179      $today = getdate();
 180      $month = $today['mon'];
 181      if ($month == 1) {$month = _JANUARY;} elseif ($month == 2) {$month = _FEBRUARY;} elseif ($month == 3) {$month = _MARCH;} elseif ($month == 4) {$month = _APRIL;} elseif ($month == 5) {$month = _MAY;} elseif ($month == 6) {$month = _JUNE;} elseif ($month == 7) {$month = _JULY;} elseif ($month == 8) {$month = _AUGUST;} elseif ($month == 9) {$month = _SEPTEMBER;} elseif ($month == 10) {$month = _OCTOBER;} elseif ($month == 11) {$month = _NOVEMBER;} elseif ($month == 12) {$month = _DECEMBER;}
 182      $year = $today['year'];
 183      include ("header.php");
 184      title("$sitename: "._TERMSCONDITIONS."");
 185      $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_banner_terms"));
 186      $terms = eregi_replace("\[sitename\]", $sitename, $row['terms_body']);
 187      $terms = eregi_replace("\[country\]", $row['country'], $terms);
 188      OpenTable();
 189      echo "<center><font class='title'><b>$sitename: "._TERMSCONDITIONS."</b></font></center><br><br>"
 190          ."$terms"
 191          ."<p align='right'>".$row['country'].", $month $year</p>";
 192      CloseTable();
 193      themenu();
 194      include ("footer.php");
 195  }
 196  
 197  function client() {
 198      global $module_name, $prefix, $db, $sitename, $client;
 199      if (is_client($client)) {
 200          Header("Location: modules.php?name=$module_name&op=client_home");
 201      } else {
 202          include ("header.php");
 203          title("$sitename: "._ADSYSTEM."");
 204          OpenTable();
 205          echo "<center><font class=\"title\"><b>"._CLIENTLOGIN."</b></font></center><br>";
 206          echo "<form method=\"POST\" action=\"modules.php?name=$module_name\"><table border=\"0\" align=\"center\" cellpadding=\"3\"><tr>";
 207          echo "<td align=\"right\">"._LOGIN.":</td><td><input type=\"text\" name=\"login\" size=\"15\"></td></tr>";
 208          echo "<td align=\"right\">"._PASSWORD.":</td><td><input type=\"password\" name=\"pass\" size=\"15\"></td></tr>";
 209          echo "<td>&nbsp;</td><td><input type=\"hidden\" name=\"op\" value=\"client_valid\"><input type=\"submit\" value=\""._ENTER."\"></tr></td></table></form>";
 210          CloseTable();
 211          themenu();
 212          include ("footer.php");
 213      }
 214  }
 215  
 216  function zeroFill($a, $b) {
 217      $z = hexdec(80000000);
 218      if ($z & $a) {
 219          $a = ($a>>1);
 220          $a &= (~$z);
 221          $a |= 0x40000000;
 222          $a = ($a>>($b-1));
 223      } else {
 224          $a = ($a>>$b);
 225      }
 226      return $a;
 227  }
 228  
 229  function mix($a,$b,$c) {
 230    $a -= $b; $a -= $c; $a ^= (zeroFill($c,13));
 231    $b -= $c; $b -= $a; $b ^= ($a<<8);
 232    $c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
 233    $a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
 234    $b -= $c; $b -= $a; $b ^= ($a<<16);
 235    $c -= $a; $c -= $b; $c ^= (zeroFill($b,5));
 236    $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));   
 237    $b -= $c; $b -= $a; $b ^= ($a<<10);
 238    $c -= $a; $c -= $b; $c ^= (zeroFill($b,15));
 239    return array($a,$b,$c);
 240  }
 241  
 242  function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {
 243      if(is_null($length)) {
 244          $length = sizeof($url);
 245      }
 246      $a = $b = 0x9E3779B9;
 247      $c = $init;
 248      $k = 0;
 249      $len = $length;
 250      while($len >= 12) {
 251          $a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));
 252          $b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));
 253          $c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));
 254          $mix = mix($a,$b,$c);
 255          $a = $mix[0]; $b = $mix[1]; $c = $mix[2];
 256          $k += 12;
 257          $len -= 12;
 258      }
 259      $c += $length;
 260      switch($len) {
 261          case 11: $c+=($url[$k+10]<<24);
 262          case 10: $c+=($url[$k+9]<<16);
 263          case 9 : $c+=($url[$k+8]<<8);
 264          case 8 : $b+=($url[$k+7]<<24);
 265          case 7 : $b+=($url[$k+6]<<16);
 266          case 6 : $b+=($url[$k+5]<<8);
 267          case 5 : $b+=($url[$k+4]);
 268          case 4 : $a+=($url[$k+3]<<24);
 269          case 3 : $a+=($url[$k+2]<<16);
 270          case 2 : $a+=($url[$k+1]<<8);
 271          case 1 : $a+=($url[$k+0]);
 272      }
 273      $mix = mix($a,$b,$c);
 274      return $mix[2];
 275  }
 276  
 277  function strord($string) {
 278      for($i=0;$i<strlen($string);$i++) {
 279          $result[$i] = ord($string{$i});
 280      }
 281      return $result;
 282  }
 283  
 284  function getrank($url) {
 285      define('GOOGLE_MAGIC', 0xE6359A60);
 286      $url = 'info:'.$url;
 287      $ch = GoogleCH(strord($url));
 288      $file = "http://www.google.com/search?client=navclient-auto&ch=6$ch&features=Rank&q=$url";
 289      $data = file($file);
 290      $rankarray = explode (':', $data[2]);
 291      $rank = $rankarray[2];
 292      return $rank;
 293  }
 294  
 295  function client_logout() {
 296      global $module_name;
 297      $client = "";
 298      setcookie("client");
 299      Header("Location: modules.php?name=$module_name&op=client");
 300      die();
 301  }
 302  
 303  function client_valid($login, $pass) {
 304      global $prefix, $db, $module_name, $sitename;
 305      $login = filter($login, "nohtml");
 306      $login = filter($pass, "nohtml");
 307      $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner_clients WHERE login='$login' AND passwd='$pass'"));
 308      if ($numrows != 1) {
 309          include ("header.php");
 310          title("$sitename: "._ADSYSTEM."");
 311          OpenTable();
 312          echo "<center>"._LOGININCORRECT."<br><br>"._GOBACK."</center>";
 313          CloseTable();
 314          themenu();
 315          include ("footer.php");
 316          die();
 317      } else {
 318          $row = $db->sql_fetchrow($db->sql_query("SELECT cid FROM ".$prefix."_banner_clients WHERE login='$login' AND passwd='$pass'"));
 319          $cid = $row['cid'];
 320          $info = base64_encode("$cid:$login:$pass");
 321          setcookie("client","$info",time()+3600);
 322          Header("Location: modules.php?name=$module_name&op=client_home");
 323      }
 324  }
 325  
 326  function client_home() {
 327      global $prefix, $db, $sitename, $bgcolor2, $module_name, $client;
 328      if (!is_client($client)) {
 329          Header("Location: modules.php?name=$module_name&op=client");
 330          die();
 331      } else {
 332          $client = base64_decode($client);
 333          $client = addslashes($client);
 334          $client = explode(":", $client);
 335          $cid = $client[0];
 336          $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_banner_clients WHERE cid='$cid'"));
 337          include ("header.php");
 338          title("$sitename "._ADSYSTEM."");
 339          OpenTable();
 340          echo "<center>"._ACTIVEADSFOR." ".$row['name']."</center><br>"
 341                 ."<table width=\"100%\" border=\"1\"><tr>"
 342                 ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._NAME."</b></td>"
 343              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPMADE."</b></td>"
 344              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPTOTAL."</b></td>"
 345              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPLEFT."</b></td>"
 346              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._CLICKS."</b></td>"
 347              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>% "._CLICKS."</b></td>"
 348              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._TYPE."</b></td>"
 349              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._FUNCTIONS."</b></td><tr>";
 350          $sql = "SELECT * FROM ".$prefix."_banner WHERE cid='".$row['cid']."' AND active='1'";
 351          $result = $db->sql_query($sql);
 352          while ($row = $db->sql_fetchrow($result)) {
 353              $bid = $row['bid'];
 354              $bid = intval($bid);
 355              $imptotal = $row['imptotal'];
 356              $imptotal = intval($imptotal);
 357              $impmade = $row['impmade'];
 358              $impmade = intval($impmade);
 359              $clicks = $row['clicks'];
 360              $clicks = intval($clicks);
 361              $date = $row['date'];
 362              if ($impmade == 0) {
 363                  $percent = 0;
 364              } else {
 365                  $percent = substr(100 * $clicks / $impmade, 0, 5);
 366                  $percent = "$percent%";
 367              }
 368              if ($imptotal == 0) {
 369                  $left = _UNLIMITED;
 370                  $imptotal = _UNLIMITED;
 371              } else {
 372                  $left = $imptotal-$impmade;
 373              }
 374              if ($row['ad_class'] == "flash" || $row['ad_class'] == "code") {
 375                  $clicks = "N/A";
 376                  $percent = "N/A";
 377              }
 378              if ($row['name'] == "") {
 379                  $row['name'] = _NONE;
 380              }
 381              echo "<td align=\"center\">".$row['name']."</td>"
 382                  ."<td align=\"center\">$impmade</td>"
 383                  ."<td align=\"center\">$imptotal</td>"
 384                  ."<td align=\"center\">$left</td>"
 385                  ."<td align=\"center\">$clicks</td>"
 386                  ."<td align=\"center\">$percent</td>"
 387                  ."<td align=\"center\">".ucFirst($row['ad_class'])."</td>"
 388                  ."<td align=\"center\"><a href=\"modules.php?name=$module_name&op=client_report&cid=$cid&bid=$bid\"><img src=\"images/edit.gif\" border=\"0\" alt=\""._EMAILSTATS."\" title=\""._EMAILSTATS."\"></a>  <a href=\"modules.php?name=$module_name&op=view_banner&cid=$cid&bid=$bid\"><img src=\"images/view.gif\" border=\"0\" alt=\""._VIEWBANNER."\" title=\""._VIEWBANNER."\"></a></td><tr>";
 389          }
 390          echo "</table>";
 391          $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_banner_clients WHERE cid='$cid'"));
 392          echo "<br><br><center>"._INACTIVEADS." ".$row['name']."</center><br>"
 393              ."<table width=\"100%\" border=\"1\"><tr>"
 394              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._NAME."</b></td>"
 395              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPMADE."</b></td>"
 396              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPTOTAL."</b></td>"
 397              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPLEFT."</b></td>"
 398              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._CLICKS."</b></td>"
 399              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>% "._CLICKS."</b></td>"
 400              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._TYPE."</b></td>"
 401              ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._FUNCTIONS."</b></td><tr>";
 402          $sql = "SELECT * FROM ".$prefix."_banner WHERE cid='".$row['cid']."' AND active='0'";
 403          $result = $db->sql_query($sql);
 404          while ($row = $db->sql_fetchrow($result)) {
 405              $bid = $row['bid'];
 406              $bid = intval($bid);
 407              $imptotal = $row['imptotal'];
 408              $imptotal = intval($imptotal);
 409              $impmade = $row['impmade'];
 410              $impmade = intval($impmade);
 411              $clicks = $row['clicks'];
 412              $clicks = intval($clicks);
 413              $date = $row['date'];
 414              if($impmade == 0) {
 415                  $percent = 0;
 416              } else {
 417                  $percent = substr(100 * $clicks / $impmade, 0, 5);
 418                  $percent = "$percent%";
 419              }
 420              if($imptotal == 0) {
 421              $left = _UNLIMITED;
 422                  $imptotal = _UNLIMITED;
 423              } else {
 424                  $left = $imptotal-$impmade;
 425              }
 426              if ($row['ad_class'] == "flash" || $row['ad_class'] == "code") {
 427                  $clicks = "N/A";
 428                  $percent = "N/A";
 429              }
 430              if ($row['name'] == "") {
 431                  $row['name'] = _NONE;
 432              }
 433              echo "<td align=\"center\">".$row['name']."</td>"
 434                  ."<td align=\"center\">$impmade</td>"
 435                  ."<td align=\"center\">$imptotal</td>"
 436                  ."<td align=\"center\">$left</td>"
 437                  ."<td align=\"center\">$clicks</td>"
 438                  ."<td align=\"center\">$percent</td>"
 439                  ."<td align=\"center\">".ucFirst($row['ad_class'])."</td>"
 440                  ."<td align=\"center\"><a href=\"modules.php?name=$module_name&op=client_report&cid=$cid&bid=$bid\"><img src=\"images/edit.gif\" border=\"0\" alt=\""._EMAILSTATS."\" title=\""._EMAILSTATS."\"></a>  <a href=\"modules.php?name=$module_name&op=view_banner&cid=$cid&bid=$bid\"><img src=\"images/view.gif\" border=\"0\" alt=\""._VIEWBANNER."\" title=\""._VIEWBANNER."\"></a></td><tr>";
 441              $a = 1;
 442          }
 443          if ($a != 1) {
 444              echo "<td align=\"center\" colspan=\"8\"><i>"._NOCONTENT."</i></td></tr>";
 445          }
 446          echo "</table><br><br><center>[ <a href=\"modules.php?name=$module_name&op=client_logout\">"._LOGOUT."</a> ]</center>";
 447          CloseTable();
 448          themenu();
 449          include ("footer.php");
 450      }
 451  }
 452  
 453  function view_banner($cid, $bid) {
 454      global $prefix, $db, $module_name, $client, $bgcolor2, $sitename;
 455      if (!is_client($client)) {
 456          Header("Location: modules.php?name=$module_name&op=client");
 457          die();
 458      } else {
 459          $client = base64_decode($client);
 460          $client = addslashes($client);
 461          $client = explode(":", $client);
 462          $client_id = $client[0];
 463          if ($cid != $client_id) {
 464              include ("header.php");
 465              title("$sitename "._ADSYSTEM."");
 466              OpenTable();
 467              echo "<center>"._ADISNTYOUR."<br><br>"._GOBACK."</center>";
 468              CloseTable();
 469              themenu();
 470              include ("footer.php");
 471              die();
 472          } else {
 473              include ("header.php");
 474              title("$sitename "._ADSYSTEM."");
 475              OpenTable();
 476              $row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_banner WHERE bid='$bid'"));    
 477              $cid = intval($row['cid']);
 478              $imptotal = intval($row['imptotal']);
 479              $impmade = intval($row['impmade']);
 480              $clicks = intval($row['clicks']);
 481              $imageurl = $row['imageurl'];
 482              $clickurl = $row['clickurl'];
 483              $ad_class = $row['ad_class'];
 484              $ad_code = $row['ad_code'];
 485              $ad_width = $row['ad_width'];
 486              $ad_height = $row['ad_height'];
 487              $alttext = $row['alttext'];
 488              echo "<center><font class=\"title\"><b>" . _YOURBANNER . ": ".$row['name']."</b></font><br><br>";
 489              if ($ad_class == "code") {
 490                  $ad_code = stripslashes(FixQuotes($ad_code));
 491                  echo "<table border=\"0\" align=\"center\"><tr><td>$ad_code</td></tr></table><br><br>";
 492              } elseif ($ad_class == "flash") {
 493                  echo "<center>
 494                      <OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
 495                      codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\"
 496                      WIDTH=\"$ad_width\" HEIGHT=\"$ad_height\" id=\"$bid\">
 497                      <PARAM NAME=movie VALUE=\"$imageurl\">
 498                      <PARAM NAME=quality VALUE=high>
 499                      <EMBED src=\"$imageurl\" quality=high WIDTH=\"$ad_width\" HEIGHT=\"$ad_height\"
 500                      NAME=\"$bid\" ALIGN=\"\" TYPE=\"application/x-shockwave-flash\"
 501                      PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">
 502                      </EMBED>
 503                      </OBJECT>
 504                      </center><br><br>";
 505              } else {
 506                  echo "<center><img src=\"$imageurl\" border=\"1\" alt=\"$alttext\" title=\"$alttext\" width=\"$ad_width\" height=\"$ad_height\"></center><br><br>";
 507              }
 508              echo "<center>Banner Information: ".$row['name']."</center><br>"
 509                     ."<table width=\"100%\" border=\"1\"><tr>"
 510                     ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._NAME."</b></td>"
 511                  ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPMADE."</b></td>"
 512                  ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPTOTAL."</b></td>"
 513                  ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._IMPLEFT."</b></td>"
 514                  ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._CLICKS."</b></td>"
 515                  ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>% "._CLICKS."</b></td>"
 516                  ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>"._TYPE."</b></td><tr>";
 517              $bid = $row['bid'];
 518              $bid = intval($bid);
 519              $imptotal = $row['imptotal'];
 520              $imptotal = intval($imptotal);
 521              $impmade = $row['impmade'];
 522              $impmade = intval($impmade);
 523              $clicks = $row['clicks'];
 524              $clicks = intval($clicks);
 525              $date = $row['date'];
 526              if ($impmade == 0) {
 527                  $percent = 0;
 528              } else {
 529                  $percent = substr(100 * $clicks / $impmade, 0, 5);
 530                  $percent = "$percent%";
 531              }
 532              if ($imptotal == 0) {
 533                  $left = _UNLIMITED;
 534                  $imptotal = _UNLIMITED;
 535              } else {
 536                  $left = $imptotal-$impmade;
 537              }
 538              if ($row['ad_class'] == "flash" || $row['ad_class'] == "code") {
 539                  $clicks = "N/A";
 540                  $percent = "N/A";
 541              }
 542              if ($row['name'] == "") {
 543                  $row['name'] = _NONE;
 544              }
 545              if ($row['active'] == 1) {
 546                  $status = _ACTIVE;
 547              } elseif ($row['active'] == 0) {
 548                  $status = _INACTIVE;
 549              }
 550              echo "<td align=\"center\">".$row['name']."</td>"
 551                  ."<td align=\"center\">$impmade</td>"
 552                  ."<td align=\"center\">$imptotal</td>"
 553                  ."<td align=\"center\">$left</td>"
 554                  ."<td align=\"center\">$clicks</td>"
 555                  ."<td align=\"center\">$percent</td>"
 556                  ."<td align=\"center\">".ucFirst($row['ad_class'])."</td></tr><tr>"
 557                  ."<td align=\"center\" colspan=\"7\">"._CURRENTSTATUS." $status</td></tr>"
 558                  ."</table><br><br>"
 559                  ."[ <a href=\"modules.php?name=$module_name&op=client_report&cid=$cid&bid=$bid\">"._EMAILSTATS."</a> | <a href=\"modules.php?name=$module_name&op=logout\">"._LOGOUT."</a> ]";
 560              CloseTable();
 561              themenu();
 562              include ("footer.php");
 563          }
 564      }
 565  }
 566  
 567  function client_report($cid, $bid) {
 568      global $prefix, $db, $module_name, $client, $sitename;
 569      if (!is_client($client)) {
 570          Header("Location: modules.php?name=$module_name&op=client");
 571          die();
 572      } else {
 573          $client = base64_decode($client);
 574          $client = addslashes($client);
 575          $client = explode(":", $client);
 576          $client_id = $client[0];
 577          if ($cid != $client_id) {
 578              include ("header.php");
 579              title("$sitename: "._ADSYSTEM."");
 580              OpenTable();
 581              echo "<center>"._FUNCTIONSNOTALLOWED."<br><br>"._GOBACK."</center>";
 582              CloseTable();
 583              themenu();
 584              include ("footer.php");
 585              die();
 586          } else {
 587              include ("header.php");
 588              title("$sitename: "._ADSYSTEM."");
 589              OpenTable();
 590              $bid = intval($bid);
 591              $cid = intval($cid);
 592              $sql = "SELECT name, email FROM ".$prefix."_banner_clients WHERE cid='$cid'";
 593              $result = $db->sql_query($sql);
 594              $row = $db->sql_fetchrow($result);
 595              $name = htmlentities($row['name']);
 596              $email = $row['email'];
 597              if ($email == "") {
 598                  echo "<center><br><br>"
 599                      ."<b>"._STATSNOTSEND."</b><br><br>"
 600                      ."<a href=\"javascript:history.go(-1)\">"._GOBACK."</a>";
 601                  CloseTable();
 602                  themenu();
 603                  include ("footer.php");
 604                  die();
 605              } else {
 606                  $sql2 = "SELECT bid, name, imptotal, impmade, clicks, imageurl, clickurl, date, ad_class FROM ".$prefix."_banner WHERE bid='$bid' AND cid='$cid'";
 607                  $result2 = $db->sql_query($sql2);
 608                  $row2 = $db->sql_fetchrow($result2);
 609                  $bid = $row2['bid'];
 610                  $bid = intval($bid);
 611                  $imptotal = $row2['imptotal'];
 612                  $imptotal = intval($imptotal);
 613                  $impmade = $row2['impmade'];
 614                  $impmade = intval($impmade);
 615                  $clicks = $row2['clicks'];
 616                  $clicks = intval($clicks);
 617                  $imageurl = $row2['imageurl'];
 618                  $clickurl = $row2['clickurl'];
 619                  $date = $row2['date'];
 620                  if($impmade==0) {
 621                      $percent = 0;
 622                  } else {
 623                      $percent = substr(100 * $clicks / $impmade, 0, 5);
 624                  }
 625                  if($imptotal==0) {
 626                      $left = _UNLIMITED;
 627                      $imptotal = _UNLIMITED;
 628                  } else {
 629                      $left = $imptotal-$impmade;
 630                  }
 631                  $fecha = date("F jS Y, h:iA.");
 632                  $subject = ""._YOURSTATS." $sitename";
 633                  if (empty($row2['ad_class']) || $row2['ad_class'] == "image") {
 634                      $message = ""._FOLLOWINGSTATS." $sitename:\n\n\n"._CLIENTNAME.": $name\n"._BANNERID.": $bid\n"._BANNERNAME.": ".$row['name']."\n"._BANNERIMAGE.": $imageurl\n"._BANNERURL.": $clickurl\n\n"._IMPPURCHASED.": $imptotal\n"._IMPREMADE.": $impmade\n"._IMPRELEFT.": $left\n"._RECEIVEDCLICKS.": $clicks\n"._CLICKSPERCENT.": $percent%\n\n\n"._GENERATEDON.": $fecha";
 635                  } elseif ($row2['ad_class'] == "flash") {
 636                      $message = ""._FOLLOWINGSTATS." $sitename:\n\n\n"._CLIENTNAME.": $name\n"._BANNERID.": $bid\n"._BANNERNAME.": ".$row['name']."\n"._FLASHMOVIE.": $imageurl\n\n"._IMPPURCHASED.": $imptotal\n"._IMPREMADE.": $impmade\n"._IMPRELEFT.": $left\n"._RECEIVEDCLICKS.": N/A\n"._CLICKSPERCENT.": N/A\n\n\n"._GENERATEDON.": $fecha";
 637                  } elseif ($row2['ad_class'] == "code") {
 638                      $message = ""._FOLLOWINGSTATS." $sitename:\n\n\n"._CLIENTNAME.": $name\n"._BANNERID.": $bid\n"._BANNERNAME.": ".$row['name']."\n\n"._IMPPURCHASED.": $imptotal\n"._IMPREMADE.": $impmade\n"._IMPRELEFT.": $left\n"._RECEIVEDCLICKS.": N/A\n"._CLICKSPERCENT.": N/A\n\n\n"._GENERATEDON.": $fecha";
 639                  }
 640                  $from = "$sitename";
 641                  mail($email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
 642                  echo "<center><br><br><br>"
 643                      ."<b>"._STATSSENT." $email</b><br><br>"
 644                      ."[ <a href=\"javascript:history.go(-1)\">"._GOBACK."</a> ]";
 645                  CloseTable();
 646                  themenu();
 647                  include ("footer.php");
 648              }
 649          }
 650      }
 651  }
 652  
 653  switch ($op) {
 654  
 655      default:
 656      theindex();
 657      break;
 658  
 659      case "sitestats":
 660      sitestats();
 661      break;
 662  
 663      case "plans":
 664      plans();
 665      break;
 666  
 667      case "terms":
 668      terms();
 669      break;
 670  
 671      case "client":
 672      client();
 673      break;
 674      
 675      case "client_home":
 676      client_home();
 677      break;
 678      
 679      case "client_valid":
 680      client_valid($login, $pass);
 681      break;
 682      
 683      case "client_logout":
 684      client_logout();
 685      break;
 686      
 687      case "client_report":
 688      client_report($cid, $bid);
 689      break;
 690      
 691      case "view_banner":
 692      view_banner($cid, $bid);
 693      break;
 694  
 695  }
 696  
 697  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7