?
Solved

popup url-rotation (links in CLEAN textfile)

Posted on 2003-03-12
4
Medium Priority
?
214 Views
Last Modified: 2013-12-25
Hey experts

Is there an easy way to rotate a list of url's in popups (automatic), with the following 4 demands:
1) The script must read the Url-list from a seperate textfile

2) The Urls can be both locale and global ones

3) The popups should stop after running the last Url from the textfile

4) Url-textfile should be easy the config., and should ONLY CONSIST of the links like:  
http://www.link1.html
http://www.link1.html
http://www.link1.html
...

And therefore NOT like (ex. Array style):
Url[1]=4http://www.link1.html4
Url[2]=4http://www.link2.html4
Url[3]=4http://www.link3.html4
....

Can anyone please help!
Carl
0
Comment
Question by:cebh
[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
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
DennisParaguay earned 300 total points
ID: 8140285
************************************
#!/usr/bin/perl

$cnt = 0;
$localpath = 'http://www.mywebsite.com/myfolder/';

open(LINKS,"<name_of_the_textfile");
while ($link = <LINKS>)
{
      $links[$cnt++] = $link;
}
close(LINKS);

(@time) = gmtime(time);
$rnd = $time[0] / 60 * $cnt;
$url = "$links[$rnd];

$url = $localpath.$url if ($url !~ /\Ahttp\:\/\//i);

print "Location: $url";

die;
************************************

Should work.

I didn´t get what "The popups should stop after running the last Url from the textfile" means, sorry.

-Dennis
0
 
LVL 2

Expert Comment

by:DennisParaguay
ID: 8140298
Sorry for the typo.

Line 15 must be:

******************
$url = $links[$rnd];
******************

-Dennis
0

Featured Post

How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

752 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