First create a folder named "files" in your root folder and incer 31 images into it naming phpto1, phpto2....etc.. Then create the the fallowing php file. You don't have to change image everyday The images are automatically changed in each day.
<?php $totalPics="31"; $photoOfTheDay = Array ( '1' => 'files/photo1.jpg' , '2' => 'files/photo2.jpg' , '3' => 'files/photo3.jpg' , '4' => 'files/photo4.jpg' , '5' => 'files/photo5.jpg' , '6' => 'files/photo6.jpg' , '7' => 'files/photo7.jpg' , '8' => 'files/photo1.jpg' , '9' => 'files/photo2.jpg' , '10' => 'files/photo3.jpg' , '11' => 'files/photo4.jpg' , '12' => 'files/photo5.jpg' , '13' => 'files/photo6.jpg' , '14' => 'files/photo7.jpg' , '15' => 'files/photo1.jpg' , '16' => 'files/photo2.jpg' , '17' => 'files/photo3.jpg' , '18' => 'files/photo4.jpg' , '19' => 'files/photo5.jpg' , '20' => 'files/photo6.jpg' , '21' => 'files/photo7.jpg' , '22' => 'files/photo4.jpg' , '23' => 'files/photo5.jpg' , '24' => 'files/photo6.jpg' , '25' => 'files/photo7.jpg' , '26' => 'files/photo1.jpg' , '27' => 'files/photo2.jpg' , '28' => 'files/photo3.jpg' , '29' => 'files/photo4.jpg' , '30' => 'files/photo5.jpg' , '31' => 'files/photo6.jpg' , ); $x=date("j"); if($x > $totalPics) { $x=rand(1,$totalPics); } echo <<<EOC <center><img src="$photoOfTheDay[$x]"></center> EOC; ?> |
No comments:
Post a Comment