Solved

GIG Link Banner

Posted on 1998-11-12
6
230 Views
Last Modified: 2013-12-25
I am experimenting with linkable graphics that will change each time the page is loaded... Many sites use this as banner ads... I uploaded the pl file into my cgi-bin and added <!--#exec cgi="Source/to/cgi-bin/file.pl" --> I also tried the <img src="Source/to/cgi-bin/file.pl"> neither works... But if I go directly to the location through my browser the cgi displays... How do I add it to or get it to run in the html page.  It is on an NT server if that matters?

I have asked a few people and nobody knows how to get it to work!
0
Comment
Question by:joshf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:joshf
ID: 1829549
Title was supposed to be CGI Link Banner??? Typo?
0
 
LVL 5

Accepted Solution

by:
aioudine earned 100 total points
ID: 1829550
First, you should have Perl installed,
+ required perl libraries, like cgi-lib.pl
"Perl for Win32" available from ActiveState
at  http://www.activestate.com/pw32/
Here you also may download PerlScript (IMHO it's for IIS)
For cgi-lib.pl search www.cgi-resourses.com 
or in altavista

Second (for most webservers) youshuld enable SSI for directory where shtml (SSI) files saved

Also html files with SSI command should have appropriate extention (usialy .shtml or .ssi)


Below I post example which work on Netware and Unixes
------ perl script ---
# jmerrill, 4/22/97
#
# Very basic advertisement rotator.  Advertisements are separate files containing HTML code.
# The script is kept very stripped down so you can see how it works and enhance it.
# An advertisement file may be as simple as a single <A> element containing an <IMG> element.
# Links and references should NOT be relative because they would be relative to the Perl script.
# Only the advertisement files should be in the PATH directory.
# Selection of advertisement is not guaranteed to be different every time.
# Almost no errorchecking is done by this script.
# The more ads there are, the better selection you will probably see.
#
# Parameters:
# PATH    The path, relative to the document root, where the advertisement files are stored.
#

require("cgil-ib.pl");
print &PrintHeader;
&ReadParse;

$tmpfile = "LASTADV.TMP";
($path   = ("$in{PATH}/" or "/")) =~ s|//|/|g;            #The path from the CGI data
$host   = "$ENV{SERVER_NAME}:$ENV{SERVER_PORT}";       #The Web Server's host name
($dir   = "$ENV{VSERVER_ROOT}docs$path/") =~ s|//|/|g;      #The real directory (e.g. SYS:WEB...)

# Build a list of advertisements in the directory
opendir(DIR, $dir);
@advers = sort(grep(!/$tmpfile/, readdir(DIR)));
closedir(DIR);

# Read the filename of the last advertisement
open(FILE, "$dir$tmpfile");
$last = <FILE>;
close(FILE);

# Randomly select an advertisement
srand(time);
$adver = $advers[rand($#advers + 1)];

# Second chance to keep it random (if the selection was same as last)
if ($adver eq $last) { $adver = $advers[rand($#advers + 1)]; }

# Write the filename of the last advertisement
open(FILE, ">$dir$tmpfile");
print FILE $adver;
close(FILE);

# Open the selected advertisement and write it
open(FILE, "$dir$adver");
print <FILE>;
close(FILE);

------end script-----

-----  of shtml file ---

<html><head><title>Example usage of advertisement rotator</title></head>
<body bgcolor="#ffffff">
<center><h2>Advertisement Rotator Example</h2></center>
This Server-side include (SSI) document uses the "#EXEC CGI=" command to call the advertisement rotator Perl script.  Click 'reload' to cycle through the advertisements.  There are four advertisements included in this example: IntranetWare, GroupWise, ManageWise and CyberMall.  They are pulled up semi-randomly.</p>
<!--#exec cgi="/perl/adrotate.pl?PATH=/tools/ads" -->
</body></html>
--end of html -----

-- example of add file ---
<a href="http://www.novell.com/groupwise"><img src="/images/gwban.gif"></a>
--end od ads file ----
0
 

Author Comment

by:joshf
ID: 1829551
Is there an easy way to accomplish this?
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 5

Expert Comment

by:aioudine
ID: 1829552
What you mean?
You did'it or not?

Do you have perl instralled?
0
 

Author Comment

by:joshf
ID: 1829553
I accepted your answer because it looks familiar and I belive it is what I was supposed to do... However I have not had the time to implement it... I was Just wondering if there was an easier way to do this without going into such complex measures since I  and am for the first time just getting into programming languages & javascript I seem to make many mistakes...
0
 
LVL 5

Expert Comment

by:aioudine
ID: 1829554
Of course, you may use just a JavaScript
But in this case, when you need change banners,
you must edit every file!!
In other case, when you use CGI you need just edit, replace, delete, add
files in ads directory

See JavaScript example below
--- start----
<script>
    imgs=new Array("first.gif","second.gif","third.gif");
    urls=new Array("http://www.first.com","http://www.second.com","http://www.third.com");
    </script>
then in your code, where you want to put your changing gif do this:
<script>
i=Math.floor(Math.random()*imgs.length);
 document.write("<A HREF=\""+urls[i]+"\"> <img src=\""+imgs[i]+"\" alt=\""+imgs[i]+"\"></A>");
</script>
--- end ---
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
exchange ,script 10 54
Transform normalized CSV to line in powershell 7 50
Adding a countdown to HTA 12 98
Find Files older than 6 months and then ZIP the Files 4 29
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question