14include
'mainfile.php';
25 global $xoopsDB, $xoopsLogger, $xoopsConfig;
26 include(
'header.php');
28 .redirect {width: 70%;margin: 110px;text-align: center;padding: 15px;text-align:center;text-align: center;}
29 .redirect a:link {text-decoration: none;font-weight: bold;}
30 .redirect a:visited {text-decoration: none;font-weight: bold;}
31 .redirect a:hover {text-decoration: underline;font-weight: bold;}
34 <form action='banners.php' method='post'>
37 <div class='headings'>
38 <h3>Advertising Statistics</h3>
39 <p>Please type your client information</p>
43 <input class='textbox' type='text' name='login' size='12' maxlength='10'>
46 <input class='textbox' type='password' name='pass' size='12' maxlength='10'>
48 <input type='hidden' name='op' value='Ok'>";
50 echo $token->getHtml();
52 <footer><input type='submit' value='Login'></footer>
61function bannerstats($login, $pass)
63 global $xoopsDB, $xoopsConfig, $xoopsLogger;
64 if (
'' == $login ||
'' == $pass) {
65 redirect_header(
'banners.php', 2);
70 $myts =& MyTextSanitizer::getInstance();
72 $result = $xoopsDB->query(sprintf(
'SELECT cid, name, passwd FROM %s WHERE login=%s', $xoopsDB->prefix(
'bannerclient'), $xoopsDB->quoteString($login)));
73 list($cid, $name, $passwd) = $xoopsDB->fetchRow($result);
77 <h4>Current Active Banners for $name</h4>
80 <tr class='list_center'>
81 <th class='list_id'>ID</th>
82 <th class='list_center'>Imp. Made</th>
83 <th class='b_td'>Imp. Total</th>
84 <th class='b_td'><b>Imp. Left</th>
85 <th class='b_td'><b>Clicks</th>
86 <th class='b_td'><b>% Clicks</th>
87 <th class='list-action'>Action</th>
89 $result = $xoopsDB->query(
'select bid, imptotal, impmade, clicks, date from ' . $xoopsDB->prefix(
'banner') .
" where cid=$cid");
90 while (list($bid, $imptotal, $impmade, $clicks, $date) = $xoopsDB->fetchRow($result)) {
94 $percent = substr(100 * $clicks / $impmade, 0, 5);
99 $left = $imptotal-$impmade;
102 echo
"<tr class='list_center'>
109 <td><a href='banners.php?op=EmailStats&login=$login&pass=$pass&cid=$cid&bid=$bid&".$token->getUrl().
"'>E-mail Stats</a></td>
113 .
'<hr><div>Following are your running Banners in ' . htmlspecialchars($xoopsConfig[
'sitename']) .
' </div>';
115 $result = $xoopsDB->query(
'select bid, imageurl, clickurl, htmlbanner, htmlcode from ' . $xoopsDB->prefix(
'banner') .
" where cid=$cid");
116 while (list($bid, $imageurl, $clickurl, $htmlbanner, $htmlcode) = $xoopsDB->fetchRow($result)) {
117 $numrows = $xoopsDB->getRowsNum($result);
121 if (!empty($htmlbanner) && !empty($htmlcode)) {
123 $bannerHtml = $myts->displayTarea( $htmlcode );
124 echo
"<pre><code>".$bannerHtml.
"</code></pre>";
127 if (
'.swf' == strtolower(substr($imageurl, strrpos($imageurl,
'.')))) {
128 echo
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=6,0,40,0"; width="468" height="60">';
129 echo
"<param name=movie value=\"$imageurl\" />";
130 echo
"<param name=quality value='high' />";
131 echo
"<embed src=\"$imageurl\" quality='high' pluginspage=\"https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"; type=\"application/x-shockwave-flash\" width=\"468\" height=\"60\">";
135 echo
"<img src='$imageurl' border='1' alt=''>";
139 echo
"Banner ID: $bid<br>
140 Send <a href='banners.php?op=EmailStats&login=$login&cid=$cid&bid=$bid&pass=$pass&".$token->getUrl().
"'>E-Mail Stats</a> for this Banner<br>";
143 $clickurl = htmlspecialchars($clickurl, ENT_QUOTES);
144 echo
"This Banner points to <a href='$clickurl'>this URL</a><br>
145 <form action='banners.php' method='post'>
146 Change URL: <input class='textbox' type='text' name='url' size='50' maxlength='200' value='$clickurl'>
147 <input class='textbox' type='hidden' name='login' value='$login'>
148 <input class='textbox' type='hidden' name='bid' value='$bid'>
149 <input class='textbox' type='hidden' name='pass' value='$pass'>
150 <input class='textbox' type='hidden' name='cid' value='$cid'>
151 <input type='submit' name='op' value='Change'>";
152 echo $token->getHtml();
159 if (!$result = $xoopsDB->query(
'select bid, impressions, clicks, datestart, dateend from ' . $xoopsDB->prefix(
'bannerfinish') .
" where cid=$cid")) {
160 echo
"<h4 style='text-align:center;'>Banners Finished for $name</h4><br>
167 <td>End Date</td></tr>";
168 while (list($bid, $impressions, $clicks, $datestart, $dateend) = $xoopsDB->fetchRow($result)) {
169 $percent = substr(100 * $clicks / $impressions, 0, 5);
172 <td>$impressions</td>
175 <td>".formatTimestamp($datestart).
"</td>
176 <td>".formatTimestamp($dateend) .
'</td></tr>';
180 include
'footer.php';
182 redirect_header(
'banners.php', 2);
191function EmailStats($login, $cid, $bid, $pass)
193 global $xoopsDB, $xoopsConfig;
194 if (
'' != $login &&
'' != $pass) {
197 if ($result2 = $xoopsDB->query(sprintf(
'select name, email, passwd from %s where cid=%u AND login=%s', $xoopsDB->prefix(
'bannerclient'), $cid, $xoopsDB->quoteString($login)))) {
198 list($name, $email, $passwd) = $xoopsDB->fetchRow($result2);
199 if ($pass == $passwd) {
201 redirect_header(
'banners.php', 2,
"There isn't an email associated with client " . $name .
'.<br>Please contact the Administrator');
204 if ($result = $xoopsDB->query(
'select bid, imptotal, impmade, clicks, imageurl, clickurl, date from ' . $xoopsDB->prefix(
'banner') .
" where bid=$bid and cid=$cid")) {
205 list($bid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date) = $xoopsDB->fetchRow($result);
209 $percent = substr(100 * $clicks / $impmade, 0, 5);
211 if (0 == $imptotal) {
213 $imptotal =
'Unlimited';
215 $left = $imptotal-$impmade;
217 $fecha = date(
'F jS Y, h:iA.');
218 $subject =
'Your Banner Statistics at ' . $xoopsConfig[
'sitename'];
219 $message =
'Following are the complete stats for your advertising investment at '
220 . $xoopsConfig[
'sitename'] .
" :\n\n\nClient Name: $name\nBanner ID: $bid\nBanner Image: $imageurl\nBanner URL: $clickurl\n\nImpressions Purchased: $imptotal\nImpressions Made: $impmade\nImpressions Left: $left\nClicks Received: $clicks\nClicks Percent: $percent%\n\n\nReport Generated on: $fecha";
221 $xoopsMailer =& getMailer();
222 $xoopsMailer->useMail();
223 $xoopsMailer->setToEmails($email);
224 $xoopsMailer->setFromEmail($xoopsConfig[
'adminmail']);
225 $xoopsMailer->setFromName($xoopsConfig[
'sitename']);
226 $xoopsMailer->setSubject($subject);
227 $xoopsMailer->setBody($message);
228 $xoopsMailer->send();
230 redirect_header(
"banners.php?op=Ok&login=$login&pass=$pass&".$token->getUrl(), 2,
'Statistics for your banner has been sent to your email address.');
237 redirect_header(
'banners.php', 2);
245function change_banner_url_by_client($login, $pass, $cid, $bid, $url)
248 if (
'' != $login &&
'' != $pass &&
'' != $url) {
251 $sql = sprintf(
'select passwd from %s where cid=%u and login=%s', $xoopsDB->prefix(
'bannerclient'), $cid, $xoopsDB->quoteString($login));
252 if ($result = $xoopsDB->query($sql)) {
253 list($passwd) = $xoopsDB->fetchRow($result);
254 if ($pass == $passwd) {
255 $sql = sprintf(
'update %s set clickurl=%s where bid=%u AND cid=%u', $xoopsDB->prefix(
'banner'), $xoopsDB->quoteString($url), $bid, $cid);
256 if ($xoopsDB->query($sql)) {
258 redirect_header(
"banners.php?op=Ok&login=$login&pass=$pass&".$token->getUrl(), 2,
'URL has been changed.');
264 redirect_header(
'banners.php', 2);
268function clickbanner($bid)
271 if (is_int($bid) && $bid > 0) {
272 if (xoops_refcheck()) {
273 if ($bresult = $xoopsDB->query(
'select clickurl from ' . $xoopsDB->prefix(
'banner') .
" where bid=$bid")) {
274 list($clickurl) = $xoopsDB->fetchRow($bresult);
275 $xoopsDB->queryF(
'update ' . $xoopsDB->prefix(
'banner') .
" set clicks=clicks+1 where bid=$bid");
276 header(
'Location: '.$clickurl);
284if (!empty($_POST[
'op'])) {
286} elseif (!empty($_GET[
'op'])) {
295 if (!empty($_GET[
'bid'])) {
296 $bid = (int)$_GET[
'bid'];
305 redirect_header(
'banners.php');
309 if (!empty($_GET[
'login'])) {
310 $login = $myts->stripslashesGPC(trim($_GET[
'login']));
312 if (!empty($_GET[
'pass'])) {
313 $pass = $myts->stripslashesGPC(trim($_GET[
'pass']));
315 if (!empty($_POST[
'login'])) {
316 $login = $myts->stripslashesGPC(trim($_POST[
'login']));
318 if (!empty($_POST[
'pass'])) {
319 $pass = $myts->stripslashesGPC(trim($_POST[
'pass']));
321 bannerstats($login, $pass);
325 redirect_header(
'banners.php');
328 $login = $pass = $url =
'';
330 if (!empty($_POST[
'login'])) {
331 $login = $myts->stripslashesGPC(trim($_POST[
'login']));
333 if (!empty($_POST[
'pass'])) {
334 $pass = $myts->stripslashesGPC(trim($_POST[
'pass']));
336 if (!empty($_POST[
'url'])) {
337 $url = $myts->stripslashesGPC(trim($_POST[
'url']));
339 if (!empty($_POST[
'bid'])) {
340 $bid = (int)$_POST[
'bid'];
342 if (!empty($_POST[
'cid'])) {
343 $cid = (int)$_POST[
'cid'];
345 change_banner_url_by_client($login, $pass, $cid, $bid, $url);
349 redirect_header(
'banners.php');
354 if (!empty($_GET[
'login'])) {
355 $login = $myts->stripslashesGPC(trim($_GET[
'login']));
357 if (!empty($_GET[
'pass'])) {
358 $pass = $myts->stripslashesGPC(trim($_GET[
'pass']));
360 if (!empty($_GET[
'bid'])) {
361 $bid = (int)$_GET[
'bid'];
363 if (!empty($_GET[
'cid'])) {
364 $cid = (int)$_GET[
'cid'];
366 EmailStats($login, $cid, $bid, $pass);
static quickValidate($name, $clearIfValid=true)
static & quickCreate($name, $timeout=XOOPS_TOKEN_TIMEOUT)