Logo
Display Image/URL on Specific Days
Online Now: 2
Snippet Code
Take a text file and display an image on certain days (such as a holiday logo).
This text file contains all the dates you want to display a particular
URL, directory, directory to image, or what ever, as long as each line
only has one space. The format of each line is YYYY-MM-DD URL/Link
if your URL/Link requires a space, use %20 instead of a space.
Default is the default image to use if none match, it MUST be first
in the list in order for this to work.

dateText.txt


default /logo/logo.gif
2007-04-01 /images/logo1.gif
2007-06-05 /images/logo2.gif
2007-08-10 /images/logo3.gif
2007-09-30 /images/logo4.gif
2007-12-25 /images/logo5.gif

displayURL.php


<?php
    
function imagedate(){
        
$filename "dateText.txt";
        
$handle fopen($filename"r");
        
$contents fread($handlefilesize($filename));
        
fclose($handle);
        
$array explode("n",$contents);
        foreach(
$array as $item){
            
$arr explode(" ",$item);
            if(
date("Y-m-d") == $arr[0]){
                
$val $arr[1];
                
$rtur TRUE;
                break;
            }else{
                
$rtur FALSE;
            }
        }
        if(
$rtur){
            return 
$val;
        }else{
            
$def explode(" ",$array[0]);
            return 
$def[1];
        }
    }
    
    
$url imagedate();
    echo 
'<a href="'.$url.'">'.$url.'</a>';
?>
 
Snippet Comments

Add Your Comment

All Inclusive Vacation Packages
2011-06-22 20:18:34
Being able to display an image from this text file is so good. I will using this to display images on my site at certain times.
orlando network company
2011-06-21 18:57:40
Being able to display this is so good. There is so much that you can get from this.
gold coins prices
2011-05-18 03:30:22
The mashed potatoes are boiled potatoes mashed up with a fork or potato masher, with bit of milk, butter, salt and pepper.Thanks for sharing the informative post. Regards. benny -
debtask
2011-03-13 01:13:36
Yes that is excellent work and a snip which I will most certainly use.
Candice
2007-07-17 00:00:00
Great work!

Add Your Comment

 
Snippet Tools
Rate this Snippet:

Rate the difficulty level:

Request Snippet Update


Suggested Difficulty Level: Professional
Current Score: 2.97
Total votes: 283
Total Views: 5767

Other top snippets by admin:

1. JPEG to ASCII Converter
2. Add (th, st, nd, rd, th) to the end of a number
3. Dynamic Page Content From Links
4. AJAX Quickie
5. Simple Image CAPTCHA

Search
Search for:







User Panel

User name:

Password:

Register And Post Your Own Snippets

New Snippets

1.  Shorten text and (4 of 1)

2.  file-based simple guest (0 of 0)

3.  adding an entry (0 of 0)

4.  integer to currency (1.33 of 3)

5.  Aggregate IP addresses (0 of 0)

6.  file handling (0 of 0)

7.  testing system with (0 of 0)

8.  Make an php (1 of 1)

9.  allow download in (5 of 1)

10.  redirect in 3 (0 of 0)

11.  live clock with (0 of 0)

12.  visit counter (3.5 of 2)

13.  contact form with (4 of 1)

14.  show a specific (0 of 0)

15.  The & sign (0 of 0)

16.  static variable in (0 of 0)

17.  multiplication table with (0 of 0)

18.  function with multiplicationt (0 of 0)

19.  php generated menu (0 of 0)

20.  drawing a table (0 of 0)

21.  embedded array (one (0 of 0)

22.  checks the week (0 of 0)

23.  put links on (4.5 of 2)

24.  Directory Image Gallery (0 of 0)

25.  TOS (4 of 1)

Home | Forum | Free PHP Web Hosting | Contact | Terms & Conditions |  
Donate
PHPSnips.com - ©2012 Amethyst Creative