|
SWiSH Forum Forum użytkowników programów SWiSH |
 |
SWiSH Max - php wyczytac w swishu
deejay_robby - Sob 20 Sty, 2007 22:24 Temat postu: php wyczytac w swishu Czesc wam mam dosyc duuuuzy problem
Moj skrypt PHP
Kod: |
<?php
/* Copyright (c) 2004 by Georg Rabenstein */
/* http://netzworker.org */
/* Rabenstein Webdesign */
require_once("config.inc.php");
require_once("includes/functions.php");
/********************************************/
/* Function to display banners in all pages */
/********************************************/
function viewbanner() {
global $prefix, $dbi, $admin;
DbConnect();
$bresult = mysql_query("select * from ".$prefix."_banner", $dbi);
$numrows = mysql_num_rows($bresult);
if ($numrows>1) {
$numrows = $numrows-1;
mt_srand((double)microtime()*1000000);
$bannum = mt_rand(0, $numrows);
} else {
$bannum = 0;
}
$bresult2 = mysql_query("select bid, imageurl, clickurl from ".$prefix."_banner limit $bannum,1", $dbi);
list($bid, $imageurl, $clickurl) = mysql_fetch_row($bresult2);
mysql_query("update ".$prefix."_banner set impmade=impmade+1 where bid=$bid", $dbi);
if($numrows>0) {
$aborrar = mysql_query("select cid, imptotal, impmade, clicks, date from ".$prefix."_banner where bid=$bid", $dbi);
list($cid, $imptotal, $impmade, $clicks, $date) = mysql_fetch_row($aborrar);
/* Check if this impression is the last one and print the banner */
if (($imptotal <= $impmade) AND ($imptotal != 0)) {
mysql_query("insert into ".$prefix."_bannerfinish values (NULL, '$cid', '$impmade', '$clicks', '$date', now())", $dbi);
mysql_query("delete from ".$prefix."_banner where bid=$bid", $dbi);
}
DbClose($dbi);
if (!$imageurl || $imageurl =="") {
echo "<center><script language=\"javascript\" src=\"$clickurl\" type=\"text/javascript\"></script></center>";
}
if (!$clickurl || $clickurl == ""){
echo "<center><IFRAME marginWidth=0 marginHeight=0 src=\"$imageurl\" frameBorder=0 noResize width=468 height=60 scrolling=no></IFRAME></center>";
} if($clickurl !== "" && $imageurl !="") {
echo"<center><a href=\"banners.php?op=click&bid=$bid\" target=\"_blank\"><img src=\"$imageurl\" border=\"0\" alt=\"Klick mich\"></a></center>";
}
}
}
/********************************************/
/* Function to redirect the clicks to the */
/* correct url and add 1 click */
/********************************************/
function clickbanner($bid) {
global $prefix, $dbi;
DbConnect();
$bresult = mysql_query("select clickurl from ".$prefix."_banner where bid=$bid", $dbi);
list($clickurl) = mysql_fetch_row($bresult);
mysql_query("update ".$prefix."_banner set clicks=clicks+1 where bid=$bid", $dbi);
DbClose($dbi);
Header("Location: $clickurl");
}
/********************************************/
/* Function to let your client login to see */
/* the stats */
/********************************************/
function clientlogin() {
OpenTable();
echo "<center><br><br><br><br>
<table width=\"200\" cellpadding=\"0\" cellspacing=\"1\" border=\"0\" bgcolor=\"#000000\"><tr><td>
<table width=\"100%\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" bgcolor=\"#FFFFFF\"><tr><td bgcolor=\"#EECFA1\">
<center><b>"._ADSTATS."</b></center>
</td></tr><tr><td bgcolor=\"#FFFACD\">
<form action=\"banners.php\" method=\"post\">
"._LOGINID.": <input type=\"text\" name=\"login\" size=\"12\" maxlength=\"10\"><br>
"._PWD.": <input type=\"password\" name=\"pass\" size=\"12\" maxlength=\"10\"><br>
<input type=\"hidden\" name=\"op\" value=\"Ok\">
<input type=\"submit\" value=\""._LOGIN."\">
</td></tr><tr><td bgcolor=\"#EECFA1\">
<font class=\"content\">
<center>"._PLEASELOGIN."</center>
</font></form>
</td></tr></table></td></tr></table>";
CloseTable();
}
/*********************************************/
/* Function to display the banners stats for */
/* each client */
/*********************************************/
function bannerstats($login, $pass) {
global $prefix, $dbi;
DbConnect();
$result = mysql_query("select cid, name, passwd from ".$prefix."_bannerclient where login='$login'", $dbi);
list($cid, $name, $passwd) = mysql_fetch_row($result);
if($login=="" AND $pass=="" OR $pass=="") {
echo "<center><br><font class=\"error\">"._LOGINFAILED."</font><br><br><a href=\"javascript:history.go(-1)\">"._GOBACK."</a></center>";
} else {
if ($pass==$passwd) {
OpenTable();
echo "<center>
<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#000000\"><tr><td>
<table border=\"0\" width=\"100%\" cellpadding=\"8\" cellspacing=\"1\" bgcolor=\"#FFFACD\"><tr><td>
<font class=\"option\">
<center><b>"._ACTIVEBANNERSFOR." $name</b></center><br>
</font>
<table width=\"100%\" border=\"0\"><tr>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>ID</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._IMPM."</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._IMPT."</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._IMPL."</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._CLK."</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>% "._CLK."</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._FUNCT."</b></td><tr>";
$result = mysql_query("select bid, imptotal, impmade, clicks, date from ".$prefix."_banner where cid='$cid'", $dbi);
while(list($bid, $imptotal, $impmade, $clicks, $date) = mysql_fetch_row($result)) {
if($impmade==0) {
$percent = 0;
} else {
$percent = substr(100 * $clicks / $impmade, 0, 5);
}
if($imptotal==0) {
$left = ""._UNLIMITED."";
} else {
$left = $imptotal-$impmade;
}
echo "
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$bid</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$impmade</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$imptotal</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$left</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$clicks</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$percent%</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\"><a href=\"banners.php?op=EmailStats&login=$login&cid=$cid&bid=$bid\">"._EMAILSS."</a></td><tr>";
}
echo "
</table>
<center><br><br>
"._BANNERSFOR." $sitename<br><br>";
$result = mysql_query("select bid, imageurl, clickurl from ".$prefix."_banner where cid='$cid'", $dbi);
while(list($bid, $imageurl, $clickurl) = mysql_fetch_row($result)) {
$numrows = mysql_num_rows($result);
if ($numrows>1) {
echo "<hr noshade width=\"80%\"><br>";
}
echo "<img src=\"$imageurl\" border=\"1\"><br>
<font class=\"content\">"._BNNID." $bid<br>
"._GET." <a href=\"banners.php?op=EmailStats&login=$login&cid=$cid&bid=$bid\">"._EMAILS."</a> "._FTBNN."<br>
"._BNNTO." <a href=\"$clickurl\">"._FTURL."</a><br>
<form action=\"banners.php\" method=\"submit\">
Change URL: <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"200\" value=\"$clickurl\">
<input type=\"hidden\" name=\"login\" value=\"$login\">
<input type=\"hidden\" name=\"bid\" value=\"$bid\">
<input type=\"hidden\" name=\"pass\" value=\"$pass\">
<input type=\"hidden\" name=\"cid\" value=\"$cid\">
<input type=\"submit\" name=\"op\" value=\""._CHANGE."\"></form></font>";
}
echo "
</td></tr></table></td></tr></table>
";
/* Finnished Banners */
echo "<center><br>
<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"000000\"><tr><td>
<table border=\"0\" width=\"100%\" cellpadding=\"8\" cellspacing=\"1\" bgcolor=\"#FFFACD\"><tr><td>
<font class=\"option\">
<center><b>"._FINBNNFOR." $name</b></center><br>
</font>
<table width=\"100%\" border=\"0\"><tr>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>ID</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._IMP.":</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._CLK.":</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>% "._CLK.":</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._SDATE.":</b></td>
<td bgcolor=\"#887765\"><font color=\"Black\"><center><b>"._EDATE.":</b></td></tr>";
$result = mysql_query("select bid, impressions, clicks, datestart, dateend from ".$prefix."_bannerfinish where cid='$cid'", $dbi);
while(list($bid, $impressions, $clicks, $datestart, $dateend) = mysql_fetch_row($result)) {
$percent = substr(100 * $clicks / $impressions, 0, 5);
DbClose($dbi);
echo "
<tr><td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$bid</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$impressions</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$clicks</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$percent%</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$datestart</td>
<td bgcolor=\"#AA9985\" align=\"center\"><font color=\"White\">$dateend</td></tr>";
}
echo "
</table></td></tr></table></td></tr></table>";
CloseTAble();
} else {
echo "<center><br><font class=\"error\">"._LOGINFAILED."><br><br><a href=\"javascript:history.go(-1)\">"._GOBACK."</a></center>";
}
}
}
/*********************************************/
/* Function to let the client E-mail his */
/* banner Stats */
/*********************************************/
function EmailStats($login, $cid, $bid, $pass) {
global $prefix, $dbi;
DbConnect();
$result2 = mysql_query("select name, email from ".$prefix."_bannerclient where cid='$cid'", $dbi);
list($name, $email) = mysql_fetch_row($result2);
if ($email=="") {
OpenTable();
echo "<center><br><br><br><font class=\"error\">
<b>"._CANTSENDSTATS."<br><br></b>
<a href=\"javascript:history.go(-1)\">"._GOBACK."</a>
";
} else {
$result = mysql_query("select bid, imptotal, impmade, clicks, imageurl, clickurl, date from ".$prefix."_banner where bid='$bid' and cid='$cid'", $dbi);
list($bid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date) = mysql_fetch_row($result);
DbClose($dbi);
if($impmade==0) {
$percent = 0;
} else {
$percent = substr(100 * $clicks / $impmade, 0, 5);
}
if($imptotal==0) {
$left = ""._UNLIMITED."";
$imptotal = ""._UNLIMITED."";
} else {
$left = $imptotal-$impmade;
}
$fecha = date("F jS Y, h:iA.");
$subject = ""._BANNERSTATSFORM."";
$message = ""._GREET." $name,\n"._HERESYOURSTAT."\n\n\n"._NAMED.": $name\nBanner ID: $bid\n"._IMGFILE.": $imageurl\nBanner URL: $clickurl\n\n"._IMPT.": $imptotal\n"._IMP.": $impmade\n"._IMPL.": $left\n"._CLK.": $clicks\n"._CPERCENT.": $percent%\n\n\n"._REPORTFROM." $fecha";
$from = "RwBigAdServer 2.5";
mail($email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
OpenTable();
echo "<center><br><br><br>
<b>"._STATSFOR." $bid "._SENDTO."<br>
<i>$email.</i><br><br></b>
<a href=\"javascript:history.go(-1)\">"._GOBACK."</a>
";
}
}
/*********************************************/
/* Function to let the client to change the */
/* url for his banner */
/*********************************************/
function change_banner_url_by_client($login, $pass, $cid, $bid, $url) {
global $prefix, $dbi;
DbConnect();
$result = mysql_query("select passwd from ".$prefix."_bannerclient where cid='$cid'", $dbi);
list($passwd) = mysql_fetch_row($result);
if (!empty($pass) AND $pass==$passwd) {
mysql_query("update ".$prefix."_banner set clickurl='$url' where bid='$bid'", $dbi);
DbClose($dbi);
OpenTable();
echo "<center><br>"._URLCHANGED."<br><br><a href=\"javascript:history.go(-1)\">"._GOBACK."</a></center>";
CloseTable();
} else {
OpenTable();
echo "<center><br><font class=\"error\">"._LOGINFAILED."</font>><br><br>"._PLEASE." <a href=\"banners.php?op=login\">"._TRYAGAIN."</a></center>";
CloseTable();
}
}
switch($op) {
case "click":
clickbanner($bid);
break;
case "login":
clientlogin();
break;
case "Ok":
bannerstats($login, $pass);
break;
case "Change":
change_banner_url_by_client($login, $pass, $cid, $bid, $url);
break;
case "EmailStats":
EmailStats($login, $cid, $bid, $pass);
break;
default:
viewbanner();
break;
}
?>
|
znajduje sie pod http://deejay-robby.de/bannerrotation/banners.php
Chetnie bym go wyswietlil na mojej stronie ktora jest zrobiona w swishu.. ale jak mam ja polaczyc?
w HTML by nie bylo problemu
Kod: | <iframe src="banners.php" frameborder="0" marginheight="0" marginweight="0" scrolling="0" scrollbars="0" "width="80" height="31" noresize></iframe> |
i juz ale w swish??!!
Moze ktos mi pomoze?
stefcio - Sob 20 Sty, 2007 23:00
sproboj wczytac ten kod z tagami do pola txt.
A jak to sie nieuda to wszystkie zienne po kolei trzeba transportowac do pliku swf:((
nugatt - Sob 20 Sty, 2007 23:01
Cytat: | sproboj wczytac ten kod z tagami do pola txt. | nie da rady
stefcio - Sob 20 Sty, 2007 23:02
Ale mi chodzi o kod html ten Kod: | <iframe src="banners.php" frameborder="0" marginheight="0" marginweight="0" scrolling="0" scrollbars="0" "width="80" height="31" noresize></iframe> |
deejay_robby - Sob 20 Sty, 2007 23:03
Hmmm szkoda... a jest inna mozliwisc zeby w danym mijscu na stronie byl wyswietlany za kazdym wejsciem inny banner?
stefcio - Sob 20 Sty, 2007 23:06
tak:)
deejay_robby - Sob 20 Sty, 2007 23:28
a mozesz zdradzic jak?
stefcio - Nie 21 Sty, 2007 14:07
w tablicw wpisujesz pare liczb potem losujesz i w on load lozujesz i jezeli wypadnie 1 to a=link baneru.jpg
a w polu txt dajesz img scr="add a"
rozumiesz czy zrobic to?
deejay_robby - Nie 21 Sty, 2007 19:18
hmm
wiem o co chodzi ale nie wiem jak to dokladnie mam zrobic.
jak widzisz na mojej stronie jest nie tylko wyswietlany banner ale rowniez zmienia sie adress stronny.
wpisane bedzie okolo 30 roznych bannerow tzn 30 roznych linkow stron.
Pomozesz?
stefcio - Nie 21 Sty, 2007 21:39
To trudna sprawa.
Duzo pracy i juz:))Pomoge ci we wtorek oki??Bo w pon niemam w ogole czasu:((
deejay_robby - Pon 22 Sty, 2007 09:46
wiem ze duzo pracy...odwdzeicze sie za to
stefcio - Pon 22 Sty, 2007 14:00
S-p-o-x jutro nad tym pomysle:))
|
|