View Single Post
Old 09-03-2007, 09:11 PM  
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Simple Gallery, Pic, & Video of the day all in one. (tutorial)

This script will let you make a simple gallery , video and picture of the day all in one. Or it can be used to do "niche of the day" like " asian of the day " , "blonde of the day" etc

Step #1
Create a new directory

Step #2
Save the following code as index.php and place in the folder you created

Code:
<?php
// gets type from url t=gallery t=video or t=picture
$t = $_GET['t'];

// default type
$type = "gallery";

// detect what type is requested

if ($t == "video"){
$type = "video";
}
if ($t == "picture"){
$type = "picture";
}

// gets day of the year
$doy = date("z");

// opens txt file
$list = file_get_contents("$type.txt");

// splits file based on new line
$eli = explode("\n",$list);

// picks line based on day of the year - jan 1 would be the first line
$out = $eli[$doy];

// goes to the url
header("Location: $out");
?>
Step #3
create 3 files
gallery.txt
video.txt
picture.txt

in each of these files you will place a gallery , video , or picture on a new line

example gallery.txt
http://gallery.com/gallery1.html
http://gallery.com/gallery2.html
http://gallery.com/gallery3.html

example video.txt
http://gallery.com/video1.wmv
http://gallery.com/video2.wmv
http://gallery.com/video3.wmv

there should be 366 lines total in each file for every day of the year

Step#4

Your done .
simply visit
yoursite.com/folder/?t=gallery for gallery of the day
yoursite.com/folder/?t=video for video of the day
yoursite.com/folder/?t=picture for picture of the day
__________________
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