Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.7
Author Message
hireamerica
Client



Joined: Sep 30, 2004
Posts: 103
Location: New Jersey

PostPosted: Tue Aug 02, 2005 11:00 am Reply with quote

Noticing my banner in my footer disappears when I log in as a user. Logging in/out as Admin doesn't change it.

This is very annoying as clearly banners are for users, not just me as admin.

Here goes:

Admin: Preferences: Banners: OFF (so it doesn't appear at header).

Custom include module footer_banner.php (near-copy of banners.php):

Code:
function footer_banner() {

   global $prefix, $db, $admin, $sitename, $adminmail, $nukeurl;
   if (paid()) {
      return;
   }
   $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner WHERE type='0' AND active='1'"));

   /* Get a random banner if exist any. */
   /* More efficient random stuff, thanks to Cristian Arroyo from http://www.planetalinux.com.ar */

   if ($numrows>1) {
      $numrows = $numrows-1;
      mt_srand((double)microtime()*1000000);
      $bannum = mt_rand(0, $numrows);
   } else {
      $bannum = 0;
   }
    $row = $db->sql_fetchrow($db->sql_query("SELECT bid, imageurl, clickurl, alttext FROM " . $prefix . "_banner WHERE type='0' AND active='1' LIMIT $bannum,1"));
    $bid = intval($row['bid']);
   $imageurl = $row[imageurl];
   $clickurl = $row[clickurl];
   $alttext = $row[alttext];
   if (!is_admin($admin)) {
      $db->sql_query("UPDATE ".$prefix."_banner SET impmade=impmade+1 WHERE bid='$bid'");
   }
   if($numrows>0) {
   $row2 = $db->sql_fetchrow($db->sql_query("SELECT cid, imptotal, impmade, clicks, date FROM " . $prefix . "_banner WHERE bid='$bid'"));
   $cid = intval($row2['cid']);
   $imptotal = intval($row2['imptotal']);
   $impmade = intval($row2['impmade']);
   $clicks = intval($row2['clicks']);
   $date = $row2['date'];

      /* Check if this impression is the last one and print the banner */

      if (($imptotal <= $impmade) AND ($imptotal != 0)) {
         $db->sql_query("UPDATE ".$prefix."_banner SET active='0' WHERE bid='$bid'");
       $row3 = $db->sql_fetchrow($db->sql_query("SELECT name, contact, email FROM " . $prefix . "_bannerclient WHERE cid='$cid'"));
         $c_name = $row3[name];
         $c_contact = $row3[contact];
         $c_email = $row3[email];
         if ($c_email != "") {
            $from = "$sitename <$adminmail>";
            $to = "$c_contact <$c_email>";
            $message = ""._HELLO." $c_contact:\n\n";
            $message .= ""._THISISAUTOMATED."\n\n";
            $message .= ""._THERESULTS."\n\n";
            $message .= ""._TOTALIMPRESSIONS." $imptotal\n";
            $message .= ""._CLICKSRECEIVED." $clicks\n";
            $message .= ""._IMAGEURL." $imageurl\n";
            $message .= ""._CLICKURL." $clickurl\n";
            $message .= ""._ALTERNATETEXT." $alttext\n\n";
            $message .= ""._HOPEYOULIKED."\n\n";
            $message .= ""._THANKSUPPORT."\n\n";
            $message .= "- $sitename "._TEAM."\n";
            $message .= "$nukeurl";
            $subject = "$sitename: "._BANNERSFINNISHED."";
            mail($to, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
         }
      }
      return ("<center><a href=\"banners.php?op=click&amp;bid=$bid\" target=\"_blank\"><img src=\"$imageurl\" border=\"0\" width=\"460\" height=\"55\" alt='$alttext' title='$alttext'></a></center>");
   }
}


I then edited theme.php for the footer section:

Code:
function themefooter() {

    global $user, $index, $foot1, $foot2, $foot3, $copyright, $totaltime;
    include ("includes/footer_banner.php");
    if ($index == 1) {
   $tmpl_file = "themes/3516/center_right.html";
   $thefile = implode("", file($tmpl_file));
   $thefile = addslashes($thefile);
   $thefile = "\$r_file=\"".$thefile."\";";
   eval($thefile);
   print $r_file;
   blocks(right);
    }
    $banner_disp = footer_banner();
    $footer_message = "$foot1<br>$foot2<br>$foot3<br>$copyright<br>$totaltime";
    $tmpl_file = "themes/3516/footer.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}


And finally, my footer.html (where you'll see it's using the $banner_disp...

Code:
</td></tr></table></td><td bgcolor="#ffffff"><img src="themes/3516/images/pixel.gif" width=10 height=1 border=0 alt="">

</td></tr><tr valign="top">
<td><div><img src="themes/3516/images/line2.jpg" height="7" width="10" border="0" alt=""></div></td>
<td style="font:11px Tahoma; color:#707171">
<table border="0" cellpadding="0" cellspacing="0"><tr valign="top">
<td><div><img src="themes/3516/images/line2.jpg" height="7" width="465" border="0" alt=""></div>
<center><br>$banner_disp</center></td>
<td><div><img src="themes/3516/images/line2.jpg" height="7" width="10" border="0" alt=""></div></td>
<td align="center"><div><img src="themes/3516/images/line2.jpg" height="7" width="346" border="0" alt=""></div>
<a href="index.php" style="font:11px Tahoma; color:#707171">Main page</a>&nbsp;|&nbsp;
<a href="top.html" style="font:11px Tahoma; color:#707171">Top 10 </a>&nbsp;|&nbsp;
<a href="modules.php?name=Your_Account" style="font:11px Tahoma; color:#707171">Your Account </a>&nbsp;|&nbsp;
<a href="topics.html" style="font:11px Tahoma; color:#707171">Topics</a>&nbsp;|&nbsp;
<a href="submit.html" style="font:11px Tahoma; color:#707171">Submit News </a><br>
<br>
<font style="font:10px Tahoma; color:#000000 ">
HireAmerica.us © 2004,2005 <br>
<a href="modules.php?name=Content&amp;pa=showpage&amp;pid=5" style="font:10px Tahoma; color:#000000 ">Privacy Policy</a></font><br><br>
<img src="/cgi-sys/Count.cgi?df=ha.dat|display=Counter|ft=2|md=5|frgb=93;139;226|dd=B|srgb=0;0;13|prgb=0;0;0" alt="Visitors" title="Visitors">
</td>
</tr></table>
<td><div><img src="themes/3516/images/line2.jpg" height="7" width="10" border="0" alt=""></div></td>
</tr></table>


So problem is when I delete the user cookie, I see the banner! When I then login as a user it's gone! (so is one at header if I had Admin: Prefs: Banners as Yes).

I'm at a loss as user by user there is no show banners attrib, right?

So the cookie would not even have a banner show as 1 or 0 or anything in it.

Note: Banner is for this site (Raven's) so plrease get it to work!!!
 
View user's profile Send private message Visit poster's website Yahoo Messenger
hireamerica







PostPosted: Tue Aug 02, 2005 11:17 am Reply with quote

Ah...nmind... go it!

In my haste to re-create the include, I forgot to remove

Code:
if (paid()) { return; } 


Now, exactly what is this paid() function? I see it in mainfile.php and it was probably tripping a return 0 on if is_user($user)... but how is it intended to be used?
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Wed Aug 03, 2005 5:23 am Reply with quote

if (paid) belongs to the onboard single subscription facility in nuke. The if paid function is used to check the users subscription status and if it returns a 1, then banners ads are prevented from showing.
I would have liked to have pointed you to the appropriate file(s) but I removed all trace of it on my site due to having custom subscription software installed.
 
View user's profile Send private message Send e-mail
hireamerica







PostPosted: Wed Aug 03, 2005 7:23 am Reply with quote

Yeah, but wow am I glad I removed it...seems that when paid() is fired, mainfile.php (where it lies) will always return true (for my site at least).

Hence it's moot if I have allow banners Y or N.

Thanks though!
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.7

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©