code_junkie

How can I cycle through pages?

Nov 10th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html lang="en">
  3. <head>
  4. <title>Dashboard Example</title>
  5. <style type="text/css">
  6. body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
  7. iframe { border: none; }
  8. </style>
  9. <script type="text/javascript">
  10. var Dash = {
  11. nextIndex: 0,
  12.  
  13. dashboards: [
  14. {url: "http://www.google.com", time: 5},
  15. {url: "http://www.yahoo.com", time: 10},
  16. {url: "http://www.stackoverflow.com", time: 15}
  17. ],
  18.  
  19. display: function()
  20. {
  21. var dashboard = Dash.dashboards[Dash.nextIndex];
  22. frames["displayArea"].location.href = dashboard.url;
  23. Dash.nextIndex = (Dash.nextIndex + 1) % Dash.dashboards.length;
  24. setTimeout(Dash.display, dashboard.time * 1000);
  25. }
  26. };
  27.  
  28. window.onload = Dash.display;
  29. </script>
  30. </head>
  31. <body>
  32. <iframe name="displayArea" width="100%" height="100%"></iframe>
  33. </body>
  34. </html>
  35.  
  36. <meta HTTP-EQUIV="REFRESH" content="15; url=http://www.thepagecycler.com/nextpage.html">
  37.  
  38. function RefreshFrame()
  39. {
  40. parent.VisibleFrame.location.href = urlArray[i];
  41. i++;
  42.  
  43. if(i < urlArray.length) SetTimeout("RefreshFrame()", 20000);
  44. }
  45.  
  46. var i = 0;
  47. var urlArray = ['http://google.com','http://yahoo.com', 'http://www.search.com'];
  48. RefreshFrame();
  49.  
  50. <?php
  51. # Path the config file, full or relative.
  52. $configfile="config.conf";
  53. $tempfile="tmp.html";
  54. # Read the file into an array
  55. $farray=file($configfile);
  56. # Count array elements
  57. $count=count($farray);
  58. if(!isset($_GET['s'])){
  59. $s=0;
  60. }else{
  61. $s=$_GET['s'];
  62. if($s==($count-1)){ # -1 because of the offset in starting our loop at 0 instead of 1
  63. $s=0;
  64. }else{
  65. $s=$_GET['s']+1; # Increment the counter
  66. }
  67. }
  68. # Get the line from the array
  69. $entry=$farray[$s];
  70. # Break the line on the comma into 2 entries
  71. $arr=explode(",",$entry);
  72. # Now each line is in 2 pieces - URL and TimeDelay
  73. $url=strtolower($arr[0]);
  74. # Check our url to see if it has an HTTP prepended, if it doesn't, give it one.
  75. $check=strstr($url,"http://");
  76. if($check==FALSE){
  77. $url="http://".$url;
  78. }
  79. # Trim unwanted crap from the time
  80. $time=rtrim($arr[1]);
  81. # Get a handle to the temp file
  82. $tmphandle=fopen($tempfile,"w");
  83. # What does our meta refresh look like?
  84. $meta="<meta http-equiv="refresh" content="".$time.";url=index.php?s=".$s."">n";
  85. # The iframe to display
  86. $content="<iframe src ="".$url."" height="100%" width="100%"></iframe>";
  87. # roll up the meta and content to be written
  88. $str=$meta.$content;
  89. # Write it
  90. fwrite($tmphandle,$str);
  91. # Close the handle
  92. fclose($tmphandle);
  93. # Load the page
  94. die(header("Location:tmp.html"));
  95. ?>
Add Comment
Please, Sign In to add comment