Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
I run a javascript ad banner rotator on my site, (and it's been there for years) and I have been recently been getting emails and messages from a few members saying my site is infected, as they have received warnings from MacAfee, and AVG reports. I have told them over and over again, that it's just a false positive and that the javascript is safe, and only a website redirect, but they insist that there is a security issue. Isn't this just an issue due to those program's new overly anal definitions? Should I just ignore them, or are they correct, and I should change the way I do it? AVG says it's dangerous as a .js obfuscator. I am using:

Banner Ad Rotater v3.02
Author: Anarchos > [email protected] http://anarchos.xs.mw/bannerad.phtml
Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/

Joined: Jun 2006
Posts: 1,344
G
veteran
veteran
G Offline
Joined: Jun 2006
Posts: 1,344
I switched to using a php rotator instead of javascript. I created a file banner.php and added below and wherever I want it to be displayed did a php include to that file.

PHP Code


<?php
$banner_src[0]="http://www.linktoimage.jpg";
$banner_link[0]="http://www.linktosite.com";

$banner_src[1]="http://www.linktoimage.jpg";
$banner_link[1]="http://www.linktosite.com";

$banner_src[2]="http://www.linktoimage.jpg";
$banner_link[2]="http://www.linktosite.com";

$banner_src[3]="http://www.linktoimage.jpg";
$banner_link[3]="http://www.linktosite.com";



/*The above code has created 2 arrays, one array of image
 urls and another array for the  links  that go with them. You can
 add as many as you like, increasing the number  in the 
[square brackets] by 1 as you do. */

$banner_count=((count($banner_src))-1);
/*this line counts how many banners you have in your arrays,
 but since arrays start at number 0, we minus 1 from the count*/

$which_banner=(rand(0, $banner_count));
/*this line picks a random number between 0(the start of our array) 
and the current  banner count */


/*this next bit of code displays the chosen banner as a link */
print "<center><a href=\"$banner_link[$which_banner]\" target=\"_blank\">
<img src=\"$banner_src[$which_banner]\" border=\"0\"></a></center>";

?> 


Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Thanks, I tried this and put the php include in the "HTML includes" section of Control Panel/General Display Options, but it didn't work. Am I missing something here?

Joined: Dec 2003
Posts: 6,649
Likes: 88
Joined: Dec 2003
Posts: 6,649
Likes: 88
You do realize that the example shows generic paths to images?
http://www.linktoimage.jpg
http://www.linktosite.com

They don't exist. So you need to edit them and add a valid path to a image.
Also since it is random, if you don't have a valid path for each one then you may not get something on each refresh.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Yes sir, I made a .php file called banner.php, I copied and pasted the info given, then edited it for the image path for my site, and external urls. I then put a php include into HTML includes section of Control Panel (forum admin), Display Options, General, but nothing. I used

Code
<?php include ("banner.php"); ?>

for the HTML include section. I am supposed to use the parenthesis correct? Did I miss something? Should I have used some echo tags somewhere? I think my issue is that I didn't add the correct info into the control panel section? Since there is no other .php in there should I have created a style text/php tag?

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Ah ok, I sort of have it working now but got this error...

Code
Message: 'Banner' is undefined
Line: 1177
Char: 3
Code: 0
URI: http://www.mydomain.com/members/forum/ubbthreads.php?ubb=cfrm


Joined: Dec 2003
Posts: 6,649
Likes: 88
Joined: Dec 2003
Posts: 6,649
Likes: 88
Well I see Gliderdad is here. but has not responded But maybe he is on a coffee break.
But anyway.
Since I have never tried a include using the html includes from the control panel.
It looks correct but there is not a path to the file. Meaning it needs to reside in the same location as the ubbscript if you don't have a path.

First thing I would do is test the page with a browser directly.
http://www.YourUrl.com/includes/banner.php
Then where ever it is located you need to edit it to something like.
Quote
<?php
include("http://www.YourUrl.com/includes/banner.php");

?>


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
It tests fine, when I go directly to the .php page, and the complete url is not needed, but I still get the error. When I add the complete url, it vanishes.

Joined: Jun 2006
Posts: 1,344
G
veteran
veteran
G Offline
Joined: Jun 2006
Posts: 1,344
Try using a the path not the http

Code
<?php include("/home/path/to/ubbthreads/includes/banner.php"); ?>

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Nope, same error. Which file has a Line: 1177?
ubbthreads.inc?

Joined: Jun 2006
Posts: 1,344
G
veteran
veteran
G Offline
Joined: Jun 2006
Posts: 1,344
Where in the cp html includes you adding this? The header section?

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Duh! Never mind I fixed it. I had the old javascript banner rotator code in the footer. Now, the old one would rotate all my banners every few seconds. This one rotates on refresh. Can I add the rotate all the banners every few seconds function to this?

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Display Options/General/html includes, it works fine now but I would like to add the other feature if possible? Can someone help me do that?

Joined: Dec 2003
Posts: 6,649
Likes: 88
Joined: Dec 2003
Posts: 6,649
Likes: 88
I think you are going to find that the script is not refreshed until the internal cache runs again. Or using the refresh option on the browser.

Somebody here posted a workaround for a similar issue with banner rotators. Can't find it now but I think it was Sirdude.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
I wish I could find that...


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
After server reboot
by Morgan - 09/02/2026 8:27 AM
Email Settings
by Outdoorking - 05/13/2026 2:44 AM
Who's Online Now
0 members (), 206 guests, and 158 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)