Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Is there a way to use Javascript in the Forum Introduction Announcements? Or whereabouts to turn it off? I know it may be a security threat, well, maybe not as much because its in a part where noone can really touch.

Reason is: I want to display certain images according to the day of the week in a forum. Only way to do a ad/banner rotator is with javascript.

Any ideas on this one?

Sponsored Links
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
why not add the javascript as an onload to the header, and use an id for the image?

or, an easier thing would be using a php script to serve the image.

something like
Code
<img src="/image_of_the_day.php" alt="Image of the Day" />
and have the PHP script know which day it is. heck, then it can even be used in sigs and posts

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Hmmmm. I could use the javascript as an onload, but I'd have to manipulate the code probably. Here is one I found from dynamic drive i believe

Code
<script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var mondayimg="form_button.gif"
var tuesdayimg="../m2.gif"
var wednesdayimg="../m3.gif"
var thursdayimg="../m4.gif"
var fridayimg="../m5.gif"
var saturdayimg="../m6.gif"
var sundayimg="../m7.gif"
var mydate=new Date()
var today=mydate.getDay()
if (today==1)
document.write('<a href="http://www.google.com"><img src="'+mondayimg+'" border="0"></a>')
else if (today==2)
document.write('<img src="'+tuesdayimg+'">')
else if (today==3)
document.write('<img src="'+wednesdayimg+'">')
else if (today==4)
document.write('<img src="'+thursdayimg+'">')
else if (today==5)
document.write('<img src="'+fridayimg+'">')
else if (today==6)
document.write('<img src="'+saturdayimg+'">')
else
document.write('<img src="'+sundayimg+'">')
//-->
</script>
I wasnt aware of the PHP thing. I guess I'll poke around hotscripts in their PHP section for such a script. Thanks Ian. Any more advice, or help, feel free.

Joined: Jun 2001
Posts: 729
Coder
Coder
Offline
Joined: Jun 2001
Posts: 729
I highly suggest using phpAdsNew I ahve it placed in the "Message Board Intro Text:" section and I can add remove banners in minutes as well as track them and build reports.

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ya I've tried that software, how do u use it in the forum intro part if it only accepts HTML?

I have it installed and ready to go, how do u use it in the CP?

Sponsored Links
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
ok, is it that you can't put javascript in the page, or is it that it won't work due to all the line breaks?

if the latter, just copy
Code
	var mondayimg = "form_button.gif"
var tuesdayimg="../m2.gif"
var wednesdayimg="../m3.gif"
var thursdayimg="../m4.gif"
var fridayimg="../m5.gif"
var saturdayimg="../m6.gif"
var sundayimg="../m7.gif"
var mydate=new Date()
var today=mydate.getDay()
switch(today)
{
case 1: document.write('<a href="http://www.google.com"><img src="'+mondayimg+'" border="0"></a>'); break;
case 2: document.write('<img src="'+tuesdayimg+'">'); break;
case 3: document.write('<img src="'+wednesdayimg+'">'); break;
case 4: document.write('<img src="'+thursdayimg+'">'); break;
case 5: document.write('<img src="'+fridayimg+'">'); break;
case 6: document.write('<img src="'+saturdayimg+'">'); break;
default: document.write('<img src="'+sundayimg+'">');
}
into a .js file and call it in the same fashion of datelib.js

Joined: Jun 2001
Posts: 729
Coder
Coder
Offline
Joined: Jun 2001
Posts: 729
There is no javascript used. Here is the code I use to pull phpAdsNew's stuff into my system. Now that is weird trying to post code within the code tags and it does not allow the iframe to be shown...

[CODE]

[CODE]

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ian:

Ok I'll try throwing the code into a JS file. Then just use the script tag I guess in the announcement part. See if that works. I just didn't know you could script tags in the forum announcement part and I'm still convinced you can't unless Im of course doing it wrong. tipsy

The problem was, it wasnt showing up with the code I showed you. Your right though, it may have been because of the line breaks? I dunno. I just thought the &pipecleaner and &convertreturns fixed that part.


QuickSI: So i use an iframe eh? I'll try that method I guess, and get back to you. I think I prefer AdsNews because of the benefits, so I might need further help from you maybe.

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ya well, Ian I dont think you can use script tags in that part. I've tried both methods without success

QuickSi: How did you generate your code? "Remote Invocation for javascript" ?

What HREF urls do u use from the generated code?

Joined: Jun 2001
Posts: 729
Coder
Coder
Offline
Joined: Jun 2001
Posts: 729
I am at work but will give you a step by step from entering the info into phpAsNew to having it generate the code for you latter on tongiht when I get home.

Sponsored Links
Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ok, thanks

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Any update on this yet SI?

Joined: Jun 2001
Posts: 729
Coder
Coder
Offline
Joined: Jun 2001
Posts: 729
Ok finally got back in, thanx for the PM smile

1. Create a ne advertiser by clicking on "Add New Advertiser" under "Advertisers & Campaigns"

I generaly set the name to the physcal name of the banner (i.e. the affilates name) Fill in everything except the user name and password at the bottom unless you want someone else to be able to adust this particular campaign. Click on Next...

2. Under name I also use the same physical name. Unless you need to adjust when the banner is to be displayed you can leave everything else alone. What you might want to do however is figure out how you want to prioritize your displaying of banners. This is done by assigning a "weight" This way you can force certain banners to show more often then others.
After click on save changes.

3. Check off both boxes and click on save changes. You will receive a message that no banner has yet to be defined.

4. Click on "Add New Banner"

5. In the drop down select HTML banner.

6. Now enter the code you wish to use. This can be the supplied code most affilaite programs give you. Destination URL is your domain (i.e. www.hostboard.com) Target is the same. Size height and width is the size of the image. I try to use an industry standard of 468x60. keywords and description can be anything you want. This is generaly used for sites running many campaigns. I generaly fill int he basics. Weight is the same as the wright you assigned on the prior page. Click on save changes...

7. Delivery capping is up to you on how to set. This page is self explanitory with the dewcription they give. Click on save changes

8. Your next page should show 2 line items. Click on save changes

9. You now can click on the show banner link in the upper right cornor to review. A new window will appear in the upper left. Close when you are done looking at it.

10. Next click on Generate bannercode.

11. In the drop down select Remote Invocation for Frames.

12. Fill in the rest tho I never fill out the target frame or source.

13 Cut and past the code.

Now any time you add a new campaign or banner it should appear. You can create as many as you want define when they appear, how often they appear. You can define as many banners per campaign as you want tho I recommend 1 for 1 as it will be easier to trakc over all unless you have advertisers logging in and managing their own banners.

VERY IMPORTANT that you CHMOD the config.inc.php file after you are 100% done installing the software as to lock the base configuration. This is a security measure as well a safeguard from.

Other then that I think that is about it for setting up a basic banner. Any questions let me know smile


11.

Joined: Sep 2001
Posts: 672
Member
Member
Offline
Joined: Sep 2001
Posts: 672
Ok I'll try it out when I get a chance here and let u know how it goes. Thanks bud wink


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,156
Joined: July 2001
Forum Statistics
Forums63
Topics37,583
Posts293,957
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 2063
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 1
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261026)