sdpullen Posted January 16, 2007 Share Posted January 16, 2007 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 imagefor($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]); }}?> Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/ Share on other sites More sharing options...
sasa Posted January 16, 2007 Share Posted January 16, 2007 try[code]<?php$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)) echo 'Pisture for weekends';else { $i = 0; while ($time > $times[$i]) $i++; echo 'Picture no ',$i;}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/#findComment-162402 Share on other sites More sharing options...
sdpullen Posted January 17, 2007 Author Share Posted January 17, 2007 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!!! Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/#findComment-162499 Share on other sites More sharing options...
sasa Posted January 17, 2007 Share Posted January 17, 2007 [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] Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/#findComment-162669 Share on other sites More sharing options...
sdpullen Posted January 17, 2007 Author Share Posted January 17, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/#findComment-163124 Share on other sites More sharing options...
sdpullen Posted January 19, 2007 Author Share Posted January 19, 2007 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.comhttp://www.magic1071.comhttp://www.z1077.comAny help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/#findComment-164199 Share on other sites More sharing options...
sdpullen Posted January 19, 2007 Author Share Posted January 19, 2007 Me again, I used the script that was listed above and tested it on my server and it worked. Now, how to i access that script on my homepage? Is there some way to link to it? Like an <img src> tag? I want to put it in a specific spot on my page. Any advise? Quote Link to comment https://forums.phpfreaks.com/topic/34435-need-assistance-with-a-script/#findComment-164211 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.