
| PHP Text-Based Article System | Is Windows 7 the new XP? |
| Submitted On: Friday, October 30, 2009 at 6:28:13 PM |
Toasty Please login to rate this submission. Link to this Submission Blog and Forum Link HTML link Facebook / Pagereaders
|
DO NOT ATTEMPT: Articles provided here are for INFORMATIONAL PURPOSES ONLY. DO NOT undertake any project based upon any information obtained on the internet, including this website. We are not responsible for, nor do we assume any liability for, damages resulting from the use of any information on this site. Please read the Legal page for more information. Automatic Theme Changer in PHP The below code allows you to specify a logo, alternate text for the logo (or a Theme Name), and a cascading style sheet by a range of days in a month. This system CANNOT handle days that are not in the same month. Syntax of the theme specification array: AABBCC,D,E,F AA - Two digit month of activity. BB - Two digit day BEFORE event starts in month. CC - Two digit day AFTER event ends in month. D - Logo E - ALT text of logo F - Custom CSS to apply NOTE: You must start the array at zero (0) and increment in amounts of one (1) so that the default selector can operate properly. The dates do not need to be legal. I.E. For leap year, I specified February 28 as the day BEFORE and February 30 as the day AFTER...Obviously the 30th isn't a legit date. If you do not specify an Image, CSS, or ALT text for a theme, the code will default to the values contained in the last few lines -- This will also be the default used when there are no themes needed (i.e. The date isn't specified in the theme selector, and the highest array value does not declare any theme specifications. You'll notice in the provided theme arrays that most of them do not contain alternate CSS files -- this is because I never made one up for these events, so it will default to the one specified. <?PHP //Themes $ThemeDate[0] = "102032,yn_halloween,YouN00b Halloween,style-hallo"; $ThemeDate[1] = "111230,yn_thanksgiving,YouN00b Thanksgiving,"; $ThemeDate[2] = "040002,yn_aprilfools,YouN00b April Fools,"; $ThemeDate[3] = "121226,yn_christmas,YouN00b Christmas,"; $ThemeDate[4] = "050406,yn_cincodemayo,YouN00b CincoDeMayo,"; $ThemeDate[5] = "041530,yn_easter,YouN00b Easter,"; $ThemeDate[6] = "070305,yn_independance,YouN00b Independance Day,"; $ThemeDate[7] = "122532,yn_newyears,YouN00b New Years,"; $ThemeDate[8] = "010002,yn_newyears,YouN00b New Years,"; $ThemeDate[9] = "021320,yn_racing,YouN00b NASCAR,"; $ThemeDate[10] = "031618,yn_stpatty,YouN00b St. Patricks Day,"; $ThemeDate[11] = "061315,yn_flagday,YouN00b Flag Day,"; $ThemeDate[12] = "052531,yn_memorial,YouN00b Memorial Day,"; $ThemeDate[13] = "090210,yn_labor,YouN00b Labor Day,"; $ThemeDate[14] = "022830,yn_leapyear,YouN00b Leap Year,"; //Last Array Item -- Forces Default if no results. $ThemeDate[count($ThemeDate)] = "000000,,,"; //Process Theme...
|
||||
| Tags: Automatic, Theme, Changer, in, PHP |
| Sunday, November 1st, 2009 at 12:38:39 AM #23346 |
|
Toasty SysOp Level 40 Posts: 7,388 Submissions: 227 ![]() | A little bug in it -- if ($ThemeCSS=="") $ThemeCSS = "style.css"; Should be: if ($ThemeCSS=="") $ThemeCSS = "style"; |
![]() |
| Tuesday, November 3rd, 2009 at 1:37:00 AM #23380 |
|
Toasty SysOp Level 40 Posts: 7,388 Submissions: 227 ![]() | Security Update <?PHP $ThemeDate = ""; //Themes $ThemeDate[0] = "102032,yn_halloween,YouN00b Halloween,style-hallo"; Although unlikely, if somebody uses this code on a server with register_globals=on;, the stylesheet could possibly be changed -- or even hijacked, if somebody comes up with a file inclusion hole in your site. Make sure to include the BOLD line above. |
![]() |
| Tuesday, November 10th, 2009 at 4:51:46 AM #23586 |
|
teh1337 Member Level 10 Posts: 2,358 ![]() | ';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//-->">'>alert(String.fromCharCode(88,83,83)) |
I love men. |