Location: PHPKode > scripts > My Banners > my-banners/mojbaner.php
<?php
/***********************************************************************/
/* Statistika praæenja broja prikazivanja bannera na tuðim stranicama  */
/*                                                                     */
/* Copyright (c) 2002 by Hrvoje Novosel (hide@address.com)     */
/* http://www.crovortex.com                                            */
/***********************************************************************/
include("config.php");
function login() {
echo "<body bgcolor=\"#0B5882\" text=\"#000000\" link=\"#FF0000\" vlink=\"#FF0000\" alink=\"#FF0000\">"
    ."<LINK REL=\"StyleSheet\" HREF=\"style.css\" TYPE=\"text/css\">\n\n\n"
    ."<center><br><br><br><br><br>"
    ."<table width=\"10%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
    ."<tr>\n"
    ."<td width=\"17\"><img
src=\"grafika/kut1.gif\" width=\"17\" height=\"12\"  border=\"0\"></td>\n"
    ."<td class=\"omot1g\"><img
src=\"grafika/razmak.gif\" width=\"1\" height=\"12\"  border=\"0\"></td>\n"
    ."<td width=\"17\"><img
src=\"grafika/kut2.gif\" width=\"17\" height=\"12\"  border=\"0\"></td>\n"
    ."</tr>"
    ."<tr>"
    ."<td class=\"omot3l\"><img
src=\"grafika/razmak.gif\" width=\"17\" height=\"1\"  border=\"0\"></td>\n"
    ."<td class=\"bjlpozadina\">\n"
    ."<table width=\"10%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"
    ."<td colspan=\"5\">"
    ."<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"#000000\">\n"
    ."<tr>\n"
    ."<td align=\"center\" valign=\"middle\">\n"
    ."<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\"#FFFFFF\">\n"
    ."<tr>\n"
    ."<td class=\"svpozadina\"><center><b>Statistika ogla&#353;avanje</b></center></td>\n"
    ."</tr>\n"
    ."<tr>\n"
    ."<td class=\"clanaktxt\"><br><form action=\"mojbaner.php\" method=\"post\">
    Klijent:&nbsp;&nbsp;&nbsp; <input type=\"text\" name=\"loginid\" size=\"12\" maxlength=\"10\"><br>
    Zaporka: <input type=\"password\" name=\"pass\" size=\"12\" maxlength=\"10\"><br>
    <input type=\"hidden\" name=\"op\" value=\"login\"><input type=\"hidden\" name=\"novo\" value=\"ne\">
<center><input type=\"submit\" value=\"Ulaz\"></center>
    </form>\n"
    ."</td>\n"
    ."</tr>\n"
    ."<tr>\n"
    ."<td class=\"svpozadina\"><center>Molim unesite podatke.</center>\n"
    ."</td>\n"
    ."</tr>\n"
    ."</table>\n"
    ."</td>\n"
    ."</tr>\n"
    ."</table>\n"
    ."</center>\n\n\n"
    ."</table>\n"
    ."</td>\n"
    ."<td width=\"17\" class=\"omot4d\"><img
    src=\"grafika/razmak.gif\" width=\"17\" height=\"1\" border=\"0\"></td>\n"
    ."</tr>\n"
    ."<tr>\n"
    ."<td width=\"17\" valign=\"top\" align=\"left\"><img
src=\"grafika/kut3.gif\" width=\"17\" height=\"12\" border=\"0\"></td>\n"
    ."<td class=\"omot2do\" valign=\"top\"><img
src=\"grafika/razmak.gif\" width=\"1\" height=\"12\" border=\"0\"><img
src=\"grafika/razmak.gif\" width=\"1\" height=\"12\" border=\"0\"></td>\n"
    ."<td width=\"17\" valign=\"top\" align=\"right\"><img
src=\"grafika/kut4.gif\" width=\"17\" height=\"12\" border=\"0\"></td>\n"
    ."</tr>\n"
    ."</table>\n";
}
function prvi($novo, $loginid, $pass) {
global $mojlogin, $mojpass, $tabela, $lokacija;
if ($loginid == $mojlogin and $pass == $mojpass) {
echo "<body bgcolor=\"#0B5882\" text=\"#000000\" link=\"#FF0000\" vlink=\"#FF0000\" alink=\"#FF0000\">"
    ."<LINK REL=\"StyleSheet\" HREF=\"style.css\" TYPE=\"text/css\">\n\n\n"
    ."<center><br><br><br><br><br>"
    ."<table width=\"10%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
    ."<tr>\n"
    ."<td width=\"17\"><img
src=\"grafika/kut1.gif\" width=\"17\" height=\"12\" border=\"0\"></td>\n"
    ."<td class=\"omot1g\"><img
src=\"grafika/razmak.gif\" width=\"1\" height=\"12\" border=\"0\"></td>\n"
    ."<td width=\"17\"><img
src=\"grafika/kut2.gif\" width=\"17\" height=\"12\" border=\"0\"></td>\n"
    ."</tr>"
    ."<tr>"
    ."<td class=\"omot3l\"><img
src=\"grafika/razmak.gif\" width=\"17\" height=\"1\" border=\"0\"></td>\n"
    ."<td class=\"bjlpozadina\">\n"
    ."<table width=\"10%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"
    ."<td colspan=\"5\">"
    ."<table width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"#000000\">\n"
    ."<tr>\n"
    ."<td align=\"center\" valign=\"middle\">\n"
    ."<table width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" bgcolor=\"#FFFFFF\">\n"
    ."<tr>\n"
    ."<td class=\"svpozadina\"><center><b>Administracija mojih banera</b></center></td>\n"
    ."</tr>\n"
    ."<tr>\n"
    ."<td class=\"clanaktxt\">";
echo "<center><font class=\"option\"><b>Trenutno aktivni baneri</b></font></center><br>"
    ."<table width=100% border=0><tr>"
    ."<td bgcolor=\"#FF9933\" align=\"center\"><b>ID</b></td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\"><b>Stranica</b></td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\"><b>Impresija</b></td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\"><b>Klikova</b></td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\"><b>% klikova</b></td><tr>";
$rezultat = mysql_query("select ids, stranica, impresija, klikova from $tabela order by ids") or die("ne radi");
while(list($ids, $stranica, $impresija, $klikova) = mysql_fetch_row($rezultat)) {
if ($impresija==0) {
  $postoklik=0;
} else {
  if ($impresija>$klikova) {
  $postoklik = substr(100 * $klikova / $impresija, 0, 5);
  } else {
  $postoklik=100;
  }
}
echo "<td bgcolor=\"#FF9933\" align=\"center\">$ids</td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\">$stranica</td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\">$impresija</td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\">$klikova</td>"
    ."<td bgcolor=\"#FF9933\" align=\"center\">$postoklik%</td><tr>";
}
echo "</td></tr></table>";
echo "<br>";
if ($novo=="da") {
  $rezultatt = mysql_query("select max(ids) from $tabela") or die("ne radi");
  list($idsn) = mysql_fetch_row($rezultatt);
  echo "<center>URL slike za novu stranicu:<br><b> $lokacija/baner.php?op=prikaz&ids=$idsn </b>"
      ."<br>URL klika za novu stranicu:<br><b> $lokacija/baner.php?op=klik&ids=$idsn </b><br></center>";
}
echo "<center><form action=\"mojbaner.php\" method=\"post\">"
    ."Stranica na kojoj je baner: <input type=\"text\" name=\"stranica\" size=\"30\" maxlength=\"60\"><br>"
    ."<input type=\"hidden\" name=\"op\" value=\"dodaj\"><input type=\"hidden\" name=\"loginid\" value=\"$loginid\">"
    ."<input type=\"hidden\" name=\"pass\" value=\"$pass\"><input type=\"submit\" value=\"Dodaj\">"
    ."</form></center>"
    ."</td>\n"
    ."</tr>\n"
    ."<tr>\n"
    ."<td class=\"svpozadina\"><center>Molim unesite podatke.</center>\n"
    ."</td>\n"
    ."</tr>\n"
    ."</table>\n"
    ."</td>\n"
    ."</tr>\n"
    ."</table>\n"
    ."</center>\n\n\n"
    ."</table>\n"
    ."</td>\n"
    ."<td width=\"17\" class=\"omot4d\"><img
    src=\"grafika/razmak.gif\" width=\"17\" height=\"1\" border=\"0\"></td>\n"
    ."</tr>\n"
    ."<tr>\n"
    ."<td width=\"17\" valign=\"top\" align=\"left\"><img
src=\"grafika/kut3.gif\" width=\"17\" height=\"12\" border=\"0\"></td>\n"
    ."<td class=\"omot2do\" valign=\"top\"><img
src=\"grafika/razmak.gif\" width=\"1\" height=\"12\" border=\"0\"><img
src=\"grafika/razmak.gif\" width=\"1\" height=\"12\" border=\"0\"></td>\n"
    ."<td width=\"17\" valign=\"top\" align=\"right\"><img
src=\"grafika/kut4.gif\" width=\"17\" height=\"12\" border=\"0\"></td>\n"
    ."</tr>\n"
    ."</table>\n";
} else {
  echo "Nedozvoljen pristup!";
}
}
function Dodaj($stranica, $loginid, $pass) {
  global $mojlogin, $mojpass, $tabela;
  if ($loginid == $mojlogin and $pass == $mojpass) {
  mysql_query("insert into $tabela values (NULL, '$stranica', '0', '0')");
  Header("Location: mojbaner.php?op=login&loginid=$mojlogin&pass=$mojpass&novo=da");
  } else {
  echo "Nedozvoljen pristup";
}
}

switch($op) {
  case "dodaj":
    Dodaj($stranica, $loginid, $pass);
    break;
  case "login":
    prvi($novo, $loginid, $pass);
    break;
  default:
    login();
    break;
}
?>
Return current item: My Banners