Home > Code Snippets, PHP > Script to redirect based on date or time or day of the week

Script to redirect based on date or time or day of the week

Recently made a mistake by accepting a project before the initial milestone was deposited. Though I completed the project, the client did not pay, instead commented SCAM and deleted the project. So I am posting this over here hoping that the beggar will pick from here. Or this will be of use to some one.

This is not much of a magic or php expertise. The configuration area requires a default configuration with the tag ( index ) ‘0’ and then on the indexes have some meanings. A four digit will be treated as time. Eg ‘1200’ will take as 12 noon and any time after that unless another time is configured. But if you put ‘1170’ that will also be taken as 12 noon and continue. If put ‘Tuesday’ any day that falls on Tuesday will use that configuration. Again a blank configuration means not to show anything.

The debug option is put in as always I put it in most of my scripts. So if the script is invoked with ?debug=1 it will show in plain text what will happen in the configuration settings for the current server date and time. With one more tweak, ?debug=1&ondate=[php parseable date time] will prompt the script to use that date and time instead of the current server date and time. Also could not resist on this, being php and confirming to the standards this falls in fully compatible cross browser capability.

This could be used for rotating two versions of a site, showing different pages in an iframe according to the date and time. It may have various other use case. But I am just sad due to the untolerable behaviour of the false buyer.

Date based Redirector in PHP (439)

  1. No comments yet.
  1. No trackbacks yet.

sixteen + = twenty five