View Full Version : PHP Problem
kirxklox
February 13th, 2006, 05:08
<?
{
$files = glob($_SERVER['DOCUMENT_ROOT'].'/sponsors/*');
include $files[array_rand($files)];
}
?>
I have placed this on;
http://www.webhorology.com/index.html
I have made a file called /sponsors/ and and /banners/;
http://www.webhorology.com/sponsors/
http://www.webhorology.com/banners/
In /sponsors/ file I have placed;
banners1.php
banners2.php
In /banners/ file I have placed two images .GIF.
In the Code Box how do I make it recognize /sponsors/ ?????
kirxklox
February 13th, 2006, 05:28
It looks like I have a server problem, also. UNUSUAL and WEIRD
the_pm
February 13th, 2006, 05:45
Sam, I can't see the problem with it, but I can assure you the method works, and it's working right now.
http://www.paulhirsch.com/ex/random_rotation/
http://www.paulhirsch.com/ex/random_rotation/rotator.php
http://www.paulhirsch.com/ex/random_rotation/random_rotation.zip
kirxklox
February 13th, 2006, 05:54
I realized that when I tried to click on the two links and get nothing. These two files act like they are corupted or not entered correctly.
http://www.webhorology.com/sponsors/
http://www.webhorology.com/banners/
Cameron
February 13th, 2006, 10:29
html files by default are not parse by the PHP interpreter, you need to either use files with a php extension or add the following to an .htaccess file: <Files "*.html">
AddType application/x-httpd-php .html
</Files>
the_pm
February 13th, 2006, 13:01
Ah! It didn't occur to me that the page in question wasn't a .php page (should have looked harder at the file extension). That's the domain with your forums, and I figured everything was dynamic, like the boards themselves :)
kirxklox
February 13th, 2006, 14:59
Cameron: I added your code to the .htaccess. It now reads the php, but does not get all of it.
<a href="http://www.pocketwatchclub.org/"><img src="../banners/vending_171.gif" alt="The true story about Parting Out Watches" /></a>
Here is what the sourse code looks like now;
<div id="sidearea">
<p> </p>
<div id="nav2">
<h2>
<a href="http://www.pocketwatchclub.org/"></a> </h2>
<br />
Cameron
February 13th, 2006, 15:02
Seems to be working for me, I see the two ads.
kirxklox
February 13th, 2006, 15:14
Thank YOU. By your answer I was able to determine the problem.
I had Norton blocking Pop-ups and ads. Seems that blocked the presentation.
kirxklox
February 13th, 2006, 15:40
the_pm: I want to complement you on that piece of CODE you wrote. I can see several applications for it.
One of the more intriguing ones is to be able to rotate images for a Header on a Web Site or even the entire Header. I can change the HTML coding of a web page by the rotator script.
the_pm
February 13th, 2006, 15:57
Actually, that code is lifted directly from Sea Otter, in another thread on IWDN. All I did was shake it out for you and give you a working example to use :)
Thank him! I never would have come up with that on my own.
There's a highly advanced form of this from IWDN member Legend2 - http://www.iwdn.net/showthread.php?t=3414 - this version makes it so banner rotation is guaranteed to be even, if this is a concern for you.
kirxklox
February 13th, 2006, 16:07
Sea Otter; Nice piece. I can see all sorts of mischievious uses for this.
the_pm
February 13th, 2006, 16:16
It's powering "Tip of the Day" and "Our Customers" on Pinnacle Chiro (http://www.pinnaclechiro.com/) right now :)
Very handy script!
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.