View Single Post
Old 01-10-2006, 07:24 PM  
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by Tempest
Javascript is ok but I don't like to have all that stuff on my pages... I actually have a php script I use that grabs galleries from files. So I can use any sponsors FHGs and have them rotate daily, hourly or be random for the moment. Pretty simple to write yet really powerful for traffic pumps etc.

<?php
$errorurl='http://www.yourdomain.com/errorpage.html';
$sitename=strtolower(trim($HTTP_SERVER_VARS['QUERY_STRING']));
$filename="../galfiles/".$sitename.".txt";
$utime=time()-(8*3600);
$updatetime=intval($utime/86400);
if($sitenamehahahaha"" || !file_exists($filename)){@header("Location: $errorurl");exit;}
$g='';$gal=array();$tmp=@file($filename);
for($i=0;$i<count($tmp);$i++){$t=trim(chop($tmp[$i]));if($t!=""&&strtolower(substr($t,0,7))hahahaha'h ttp://'){$gal[]=$t;}}
if(count($gal)<=0){@header("Location: $errorurl");exit;}
$g=$gal[($updatetime%count($gal))];
@header("Location: $g");
?>

This one rotates once a day around midnight PST.. Change the hahahaha to 2 equal signs, i.e. = = but without the space between them.

The files are stored in a directory ../galfiles/<filename>.txt

on your page you would put /gallery.php?filename

if you want it every hour, change this line to

$updatetime=intval($utime/3600);
now add some matching descriptions please
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote