|
-
Sep 5th, 2003, 03:02 PM
#1
Thread Starter
Frenzied Member
PHP link exchange script... [resolved]
Well is it possible to create an exchange script that basically shows a link every five mins say it loads the page inside of a frame then reloads the frame using a different url to show by only the use of php,
Say if i used a link.php file would it be possible to create a script in php thast submitted this info into the file say like Http://www.clicksilo.com ,
Only without the clicking of a button, a refresh every 5 mins and 10secs.
Any ideas?
Any sites that give out this type of script? WEll...
Last edited by thegreatone; May 20th, 2005 at 01:23 PM.
Zeegnahtuer?
-
Sep 6th, 2003, 09:50 PM
#2
Stuck in the 80s
I have no idea what you're asking for.
Not to be rude, but is English your first language? If so, then you have to work on your communication skills a lot. If not, then ignore me.
-
Sep 7th, 2003, 07:17 AM
#3
Thread Starter
Frenzied Member
...
Sorry if you can't understand it MR/MRS Hobo Here it is again...
I would like to create a system that basically calls a page to load every 310 seconds... The problem is i need to call it from another frame [Say the one above it]
> My page is split up into two frames Topframe and Bottomframe
>The top frame should always be visible
>The top frame should tell the bottom frame what to do
>Every 310 seconds i would like the top frame to choose an url from a list and display it in the Bottom Frame
>i have had an example that DOESN'T WORK ...
>The un-working example was using C++ (I think) and i have now deleted it.
Any ideas on how to get it to work?
-
Sep 7th, 2003, 07:51 AM
#4
Stuck in the 80s
Put this code in the <head></head> section of the frame that you want to do the refresh:
Code:
<script type="text/javascript">
time = 310000; //310 seconds
link = 'topframe.html'; //page you want to go to
setTimeout('refreshtop()', time);
function refreshtop() {
parent.document.frames('topFrame').location.href = link;
setTimeout('refreshtop()', time);
}
</script>
The two items in bold must be changed. The first one to the page you want to be loaded, the second one to the name you gave the frame.
However, this should really be posted in the JavaScript forums.
-
Sep 7th, 2003, 09:41 AM
#5
Thread Starter
Frenzied Member
now...
Is their anyway to make it so it picks a random url from a list?
Code:
<script type="text/javascript">
time = 310000; //310 seconds
link = 'topframe.html'; //page you want to go to
//additional link
setTimeout('refreshtop()', time);
function refreshtop() {
parent.document.frames('topFrame').location.href = link;
setTimeout('refreshtop()', time);
}
</script>
Well is it possible?
-
Sep 7th, 2003, 01:20 PM
#6
Stuck in the 80s
You should really ask this in the HTML and JavaScript forum. I've never done random stuff in JS, so I'm not sure.
Code:
<script type="text/javascript">
time = 310000; //310 seconds
links[0] = 'page0.html';
links[1] = 'page1.html';
links[2] = 'page2.html';
links[3] = 'page3.html';
setTimeout('refreshtop()', time);
function refreshtop() {
//code to get random number between
//0 and 3 (or whatever the upperbound is)
//iRand = etc...
parent.document.frames('topFrame').location.href = links[iRand];
setTimeout('refreshtop()', time);
}
</script>
I just don't know how to generate the random number. Either search the JS forum or ask in there, or just wait and hope someone here will know.
-
Sep 7th, 2003, 07:49 PM
#7
using the previous javascript, you can add some php in there to help it..
Code:
<script type="text/javascript">
time = 310000; //310 seconds
link = 'link.php';
setTimeout('refreshtop()', time);
function refreshtop() {
parent.document.frames('topFrame').location.href = link;
setTimeout('refreshtop()', time);
}
</script>
now just make link.php:
Code:
<?
//script : link.php
//author : david miles
//email : [email protected]
//aim : l33tkows
$links = array(
"http://vbforums.com",
"http://microsoft.com",
"http://php.net",
"http://mysql.com",
"http://david.complex-sys.com"
);
$link = rand(0, (count($links) - 1));
echo $links[$link];
?>
my demonstration of link.php and the javascript is here:
http://blast.complex-sys.com/php/link/index.htm
of course, i've lowered the generation of the page to 5 seconds because 310 is way too long for a demo. i've also used an iframe instead of an actual frame, because well, damn i'm too lazy to make different frames.
if you're going to use my link.php; i'd appreciate it if you kept my credits in there. to install it all you're going to have to do is create the files, add the javascript to your frame page, and then change the frame name highlighted in the javascript to whatever you named your frame. oh, and if it wasn't obvious, you're going to have to add your own links in there too. if you know nothing about php, add them like the way they are. the last link has no comma because there is no links after it; so the links before it all need a comma.
edit: an easier way to do all of that is to just make your frame as "link.php" and add a meta tag to the script to constantly refresh, like:
Code:
<META HTTP-EQUIV="refresh" content="310; url=link.php">
Last edited by kows; Sep 17th, 2003 at 06:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|