Webmaster Forum

Ezilon Directory   Keyword Research Tool   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-20-2006, 04:40 PM   #1 (permalink)
Inactive
 
Join Date: 08-02-06
Posts: 40
iTrader: 0 / 0%
Latest Blog:
None

tosaha is liked by many
Random Link Script

Would anyone know of a script that would allow a link/button to follow a certain URL randomly chosen from a .txt or .js file? I'd like to avoid using databases.

I'd appreciate even a point in the right direction.

Thank you,

Tosaha
tosaha is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 08-20-2006, 05:37 PM   #2 (permalink)
Contributing Member
 
Will.Spencer's Avatar
 
Join Date: 01-05-05
Posts: 316
iTrader: 0 / 0%
Latest Blog:
None

Will.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web pro
Here is a PERL script which I use:
Code:
#!/usr/bin/perl #====================== Edit ============================ $basedir=""; @question = ( "<a href=\"example-1.html\">Example One</a>", "<a href=\"example-2.html\">Example Two</a>", "<a href=\"example-3.html\">Example Three</a>", ); #====================== Done ============================ srand($$ & time ^ $$); $qnum = rand(@question); print "Content-type: text/html\n\n"; print "@question[$qnum]"; $qnum = "";
__________________
Political Humor | Famous Quote
Will.Spencer is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-21-2006, 01:45 PM   #3 (permalink)
Inactive
 
Join Date: 08-02-06
Posts: 40
iTrader: 0 / 0%
Latest Blog:
None

tosaha is liked by many
Thank you Will.Spencer. It might just be the fact that I've never used Perl before, but would the first section be in another file or on the same page with the rest of the code?
tosaha is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-21-2006, 02:31 PM   #4 (permalink)
Contributing Member
 
Will.Spencer's Avatar
 
Join Date: 01-05-05
Posts: 316
iTrader: 0 / 0%
Latest Blog:
None

Will.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web proWill.Spencer is a highly respected web pro
It's all stored in one file.

To add pages, you just put their filenames and descriptions where the example-1.html and Example One data currently is.
__________________
Political Humor | Famous Quote
Will.Spencer is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-22-2006, 08:58 AM   #5 (permalink)
Contributing Member
 
helloworld's Avatar
 
Join Date: 06-29-06
Posts: 72
iTrader: 0 / 0%
Latest Blog:
None

helloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebody
Save as: link.php
Code:
<? $links= array( 'http://yahoo.com', 'http://google.com', 'http://www.ebay.com' ); $random = rand(0,count($links)-1); ?>
include in the page conatining the link. "this makes it less hassle to include in multiple pages"
Code:
include ('link.php');
call the url from a link:
Code:
<a href='<?echo $links[$random];?>'>some name</a>
or

call it from a button:
Code:
<FORM METHOD="LINK" ACTION="<?echo $links[$random];?>"> <INPUT TYPE="submit" VALUE="Go to link"> </FORM>
modified version of my banner rotation script
helloworld is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-22-2006, 11:00 AM   #6 (permalink)
Inactive
 
Join Date: 08-02-06
Posts: 40
iTrader: 0 / 0%
Latest Blog:
None

tosaha is liked by many
Thanks again helloworld, I was a little wary with the Perl script (though I've finally gotten it to work) but I'm a lot more comfortable with php (especially when spoon-fed to me like you just did!).

Thank you both,

Tosaha
tosaha is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-22-2006, 11:43 AM   #7 (permalink)
Empress™
 
chicgeek's Avatar
 
Join Date: 08-19-04
Location: York, UK
Posts: 17,964
iTrader: 0 / 0%
Latest Blog:
My Favourite Poem

chicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest orderchicgeek is a web professional of the highest order
<removed>
__________________
laura / chicgeek
soprano & web designer
laurakishimoto.ca
chıcgeeĸ @ flickr

Last edited by chicgeek : 08-22-2006 at 11:55 AM.
chicgeek is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-22-2006, 01:08 PM   #8 (permalink)
Contributing Member
 
helloworld's Avatar
 
Join Date: 06-29-06
Posts: 72
iTrader: 0 / 0%
Latest Blog:
None

helloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebodyhelloworld is liked by somebody
Your welcome, glad I could help.
If it's helpful don't forget to add to my rep

Last edited by helloworld : 08-22-2006 at 01:22 PM.
helloworld is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help for random banner rotator script googlesuccess Coding Forum 2 11-17-2006 01:22 PM
random image script Julie Coding Forum 1 03-06-2006 04:20 PM
I need a random script wbstein Coding Forum 6 06-16-2004 11:16 AM
updating every row with random password script SVB Coding Forum 7 05-08-2004 12:07 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 11:13 AM.
© Copyright 2008 V7 Inc


Search Engine Optimization by vBSEO 3.1.0 ©2007, Crawlability, Inc.