• Contact Editorial Team
  • Advertise on YNOT
  • Submit PR
Friday, March 27, 2026
  • Login
  • Register
YNOT
  • Home
  • Industry News
    • Porn Star & Adult Talent News
    • Adult Business News
    • Adult Novelty News
    • Adult Industry Legal News
    • Tech News for Adult Webmasters
    • Video Game News for Adults
    • EU News
  • PR Wire
  • Podcasts
  • Industry Guides
  • Newsletters
No Result
View All Result
  • Home
  • Industry News
    • Porn Star & Adult Talent News
    • Adult Business News
    • Adult Novelty News
    • Adult Industry Legal News
    • Tech News for Adult Webmasters
    • Video Game News for Adults
    • EU News
  • PR Wire
  • Podcasts
  • Industry Guides
  • Newsletters
No Result
View All Result
YNOT
No Result
View All Result
Home YNOT Features YNOT University

Auto Changing Holiday Logos using PHP

admin by admin
February 28, 2003
in YNOT University
491
SHARES
Share on FacebookShare on Twitter

I’ve noticed more and more sites changing their site’s logo during holidays. Some even change the theme of the entire website. Sure, you could manually do this, but there is no need to do this when you can use scripting to do it.I’ve noticed more and more sites changing their site’s logo during holidays. Some even change the theme of the entire website. Sure, you could manually do this, but there is no need to do this when you can use scripting to do it. So let’s learn how to change your logo dynamically through scripting so that when it is Christmas, for example, you would have a Christmas-oriented logo displayed on your website.

You’ll need to make on your own (or with the help of your favorite designer) a logo made for each holiday upon which you want to change your logo, but I’m going to show you the scripting part so that can make this happen for you behind the scenes automatically. For this I’m going to use PHP scripting.

It’s just a matter of time – server time.

When surfers come to your website they very possibly could be in a different time zone than where your server is located. Let’s say your server is located in New York, USA and I’m surfing from Seattle, USA. There is a 3 hours difference less than what the server time is. All scripts inherently work off the server time unless you create what’s known as an offset. If you know what the surfer’s time zone is, say because you asked for it in advance, you can easily put an offset into the script and then make sure that if Christmas day was in fact yesterday for the surfer that you were showing them the default (non-holiday) logo.

I will save (for another day) grabbing surfer time and comparing to server time to automatically create an offset but you should realize that this is one aspect of the script herein which in a sense remains a design issue.

In the interest of brevity and simplicity I am not providing the solution to this issue in this particular column. In layman’s terms: the worst case is that you won’t be any more than 23 hours and 59 minutes (23:59) off on any surfer that comes to your page. I’m sure they can live with seeing a Christmas logo up to 23:59 earlier (than they actually should) and up to 23:59 after they should. If enough people write me and request that I show you how to create this offset so there would be real-time holiday logo automation anywhere in the world for every surfer, I will be happy to do so in a future article.

STEP 1. Define the path to where the logo images are stored and dates in the format of:

date of event | alt description | logo filename (remember UNIX is case seNsItiVe)

The pipe symbol delineates the data.

<?
$image_path = \’http://www.yourdomain.com/images\’; // you can use relative paths instead if you want
$toshow = \"default_logo.jpg\"; // when no dates match
$alt = \"My default logo alt tag description\"; // when no dates match
$events = array(\"1-1-2002|New Year\’s Day |newyears_logo.jpg\",
\"2-2-2002|Groundhog Day |groundhog_logo.jpg\",
\"2-14-2002|Valentine\’s Day |valentines_logo.jpg\",
\"3-17-2002|St Patrick\’s Day |stpattys_logo.jpg\",
\"4-1-2002|April Fool\’s Day |aprilfools_logo.jpg\",
\"4-15-2002|Easter |easter_logo.jpg\",
\"5-5-2002|Cinco de Mayo |cinco_logo.jpg\",
\"5-13-2002|Mother\’s Day |mothers_logo.jpg\",
\"5-28-2002|Memorial Day |memorial.jpg\",
\"6-17-2002|Father\’s Day |fathersday_logo.jpg\",
\"7-1-2002|Canada Day |canadaday_logo.jpg\",
\"7-4-2002|4th of July |july4th_logo.jpg\",
\"9-3-2002|Labor Day |labor_logo.jpg\",
\"10-31-2002|Halloween |halloween_logo.jpg\",
\"11-22-2002|Thanksgiving |thanksgiving_logo.jpg\",
\"12-25-2001|Christmas |christmas_logo.jpg\"
);

STEP 2. Get the current server date using the PHP getdate() function. The getdate() function gives us the following associative array elements:

hours, mday, minutes, mon, month, seconds, wday, weekday, yday, year, 0

We’ll only need the date characteristics: mon, mday, year which would be the date in the format (12 25 2001) which is Christmas day (change the year based on the year you read this article). $target below will equal 12-25-2001 which would match the Christmas day date in the $events array in Step 1.

$datearray = getdate();

$target = $datearray[\"mon\"] . \’-\’ . $datearray[\"mday\"] . \’-\’ . $datearray[\"year\"];

STEP 3. Split the array by the pipe delimiter and then look for a matching date. If there is no match $toshow still equals the default logo with the default $alt tag description, but if there is a match then we break the loop so we don’t cycle through the rest of the array needlessly. This is the meat of the routine and closes out the code.

$sizeof = count($events);
$i = 0;
while($i<$sizeof) {
$esplit = explode(\"|\", $events[$i]);
if($target == $esplit[0]) {
$toshow = $esplit[2];
$alt= $esplit[1];
break;
}
$i++;
}
?>

STEP 4. Insert the logo in the html body portion of your webpage at the desired place escaping briefly to PHP to grab and print the code.

<BODY>
<?
print(\"< IMG SRC=\"$image_path/$toshow\" alt=\"$alt\" border=0 width=468 height=80\">\");
?>

STEP 5. Test the code by changing the date of Father’s Day (or some other holiday) in the $events array to today’s server date and then call your webpage from your browser. You should see the logo for Father’s Day. Change the date back and you should see your default logo. Now all you need to do is change the dates where appropriate inside the $events array and you’re all set to have your logo change every time there’s a new holiday 🙂

Have a great holiday, whichever one is close to the date you read this article!

TDavid is co-owner, programmer and webmaster for several sites devoted to programming including his own http://www.tdscripts.com/. He has done custom programming in various programming languages for companies all over the world. Every Friday at 2pm PST you can catch his weekly radio show dedicated to the technical side of webmastering and programming at http://www.scriptschool.com/radio.

Share196Tweet123
admin

admin

YNOT Admin wields his absolute power without mercy. When he's not busy banning spam comments to hell he enjoys petting bunnies and eating peanut butter. He recommends everyone try the YNOT Mail (ynotmail.com) email marketing platform and avoid giving their money to mainstream services that hate adult companies.

Related Posts

Adult Business News

UK Online Safety Act Cuts Pornhub Traffic 36% as Age Verification Takes Effect

December 13, 2025
Adult Business News

The Cambassador: Lindsey Banks, Flirt4Free and Brand Representation

September 5, 2018
Adult Business News

ImLive’s Mere Menezes Siqueira Manages Models, Makes the Machine Work

August 23, 2018
Corey Silverstein of Adult.law
Adult Business News

Silverstein Says: 3 Legal Issues Cam Companies, Models Must Pay Attention To

August 22, 2018
Load More

SPONSOR

INDUSTRY EVENTS

Currently Playing

YNOT Summit Model Track: Nerds Dig Sexy Gamers

YNOT Summit Model Track: Nerds Dig Sexy Gamers

01:05:46

YNOT Summit Webmaster Track: Understanding Webcam Business Models

00:51:11

YNOT Summit Model Track: Cam Law 101

01:26:24

SPONSOR

POPULAR NEWS

Chelsea Poe Continues Re-release Campaign with “The Dinner Party”

March 26, 2026
Tech Savy Crew Expands Adult SEO Services With 'AI-First Strategy'

Tech Savy Crew Expands Adult SEO Services With ‘AI-First Strategy’

March 26, 2026
Honey Play Box Officially Launches the “Vibrosa Mini”

Honey Play Box Officially Launches the “Vibrosa Mini”

March 26, 2026

Sponsor

YNOT YNOT

QUICK LINKS:

  • About YNOT
  • Terms of Use
  • Privacy Policy
  • Editorial Team
  • Advertise on YNOT
  • Sitemap

FRIENDS OF YNOT:

  • Best Adult Cams
  • Live Porn
  • Adult Reviews
  • Adult Email Marketing
  • Discounted Porn
  • vr porn sites
  • European Adult Biz Magazine

FRIENDS OF YNOT:

  • Rabbits Reviews
  • XXX Job Interviews
  • Adult Site Broker
  • Femdom
  • Paid Porn Sites
  • Live Sex
  • Cam girl sites
  • AI Girlfriend
  • live porn Vibra Game

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Home
  • Adult Business News
  • Adult Industry Legal News
  • Adult Novelty News
  • Porn Star & Adult Talent News
  • Tech News for Adult Webmasters
  • Video Game News for Adults
  • Interviews
  • Opinions
  • YNOT Industry Wire
  • Newsletters

Copyright © 2026 YNOT Group LLC.

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.