Archive for the 'Coding' Category

Changing Header Images Based on Date

Monday, December 25th, 2006

I wanted to “Christmas Up” my forums by changing my header image to something a bit more seasonal. I created a new logo and was curious about automating this change. Maybe I can have different logos for the different seasons, etc.

I looked to the Digital Point Forums and found my answer. A big thanks to JEET who answered my dilemma with the following:

Try this code:
(Assuming your images are stored in a folder called “images”, 1 directory below where the code is executed.)
$mdarr= "18-25/12,13-20/05";
$miarr= "christmas.jpg,happy_birthday_jeet.jpg";

// Format explained below and why use this.

$jtd= date("d");
$jtd= $jtd-7;// Minus 7 days to match above format.
$jtd= $jtd . '-'. date("d"). '/' . date("m");
$jc=0;
$r= explode(",",$mdarr);
foreach($r as $v)
{
if($jtd==$v)
{
++$jc;
}
}
if($jc>0)
{
--$jc;
$img= explode(",", $miarr);
$img= $img[$jc];
print '
'. $img. '
';
}
else
{
print '
default logo
';
}
?>

About the date format.

$mdarr= "18-25/12,13-20/05";
Here you can fit an array for all the dates you wish to change your image on.
For example 25/12 (25 December.) Minus 7 days makes it:
18-25/12, so your image starts appearing 7 days before the actual festival.
Add a "," sign and enter another date in same format.
(Minus 7 days)-(Actual date)/(month)
Add as many as you like.

Which Image to use:
$miarr= "christmas.jpg,happy_birthday_jeet.jpg";

Just enter the full image file name for each date at the same "number" position as it appears in date array.
Seperated by "," sign.

18-25/12 was first item, so "christmas.jpg" is first in this array.
and so on.

Then replace the img tag for your logo with this code above.
Fill the array once, and probably will never have to touch it again...

Hacked Again!

Saturday, December 2nd, 2006

It seems as though my Blog-hints.com article site was hacked again. Several weeks ago, my database was hacked, and data was added so that visitors were redirected to another site. Now it seems as though it has happened again.

Here is a screenshot of a popup that occurs before redirect.

blog-hints hacked

I am in the process of restoring the database and making some more security attempts.



maison ecologique | forex signals