Jump to content

Need assistance with a script


sdpullen

Recommended Posts

I am looking to make this script show a specific picture at a specific time. Picture one would show from midnight - 5am, picture 2 would show from 5am - 9am, picture 3 would be from 9am-2pm, picture 4 from 2pm-7pm, and picture 5 would be from 7pm-midnight. These would be monday - friday. I just need one picture to show on the weekends (sat and sun)

Anybody able to help me out?? I'd appreciate it!!!!!!!

<?php
// Forum signature rotator
// Written by kmkz
// Use it however you like, just tell people that I wrote it :)
// As you can blatantly see I have too much time on my hands. Please don't make fun of me for it ;)
// http://www.pointofexistence.com/forums/index.php?showtopic=6092

// Read the signature data into the buffer, count the number of sigs, and save the current time
$Sigs = file("banners.txt");
$NumSigs = count($Sigs);
$Time = time();

// Loop through each image
for($I = 0; $I < $NumSigs; $I++)
{
// If this is the random one we want...
if($Time % $NumSigs == $I)
{
// Figure out it's file extension and send some anti-caching headers
$Sigs[$I] = rtrim($Sigs[$I]);
$FileExtension = explode(".", $Sigs[$I]);
$FileExtension = count($FileExtension);
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: Tuesday, 1 Jan 1980 00:00:00 GMT");
header("Pragma: no-cache");
switch($FileExtension)
{
case "jpg":
$MIME = "image/jpeg";
break;
case "jpeg":
$MIME = "image/jpeg";
break;
case "gif":
$MIME = "image/gif";
break;
case "bmp":
$MIME = "image/bmp";
break;
case "png":
$MIME = "image/png";
break;
case "tif":
$MIME = "image/tiff";
break;
case "tiff":
$MIME = "image/tiff";
break;
default:
$MIME = "";
break;
}
// Send the final MIME header and print out the final image
header("Content-Type: $MIME");
readfile($Sigs[$I]);
}
}
?>
Link to comment
https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/
Share on other sites

Thanks. Is this a separate script or will this go along with the script that i posted? I am wanting to use this script as a NOW ON AIR script for our radio station website to show what dj is on the air at a certain time. Where do the picture names come in?

Thanks again!!!
[code]<?php
$Sigs=array('weekend.jpeg','url for first picture','2ndpicture','3rd_picture',etc);
$times = array(0,5,9,14,19,24);
$time = date('H');
$day = date('D');
$w_days = array('Sun','Sat');
if (in_array($day,$w_days)) $i=0;
else {
$i = 0;
while ($time >= $times[$i]) $i++;
}
echo '<img src="',$Sigs[$i],'" >';
?>[code][/code][/code]
Thank you. Will this script work with my other script?

Right now my images are stored in the folder specifically named "banners.jpg" on my server. I activate the php script with an <img src="banners.jpg"> tag. Is this how this script will work. I'm new to php so i'm sorry if i seem stupid. Thanks for all your help.

Anybody else able to help with this script? I am wanting to have a "ON AIR NOW" type thing for our radio station website. I want it to show each dj's picture. Here are some sample websites:

http://www.k103fm.com

http://www.magic1071.com

http://www.z1077.com

Any help would be greatly appreciated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.