I have copied and altered-ish some code that I want to use for my website. It’s basically just a tiny script that detects today’s date on the webserver, and then displays a value from an array that matches that date. I’ve found some other ones I could try, but I like this one as its so incredibly simple. Now, to the part where it breaks:
Ignore how the text in it makes no sense, I’m only interested in the code
- It works on my #1 server: http://folk.ntnu.no/maritkb/test/dquote/demo2.php
- It doesn’t work (exactly the same code) on my #2 server (this is the one I need to use it on): http://aw.soulsrpg.com/test/dquote/demo2.php
- it seems as if it just can’t get the info from the file that holds the array data, to me. No error messages, not in the log either.
- The script was last updated in 04. I’m thinking this could have something to do with PHPv4 versus PHPv5? Here is the phpinfo for both servers:
#1 http://folk.ntnu.no/maritkb/phpinfo.php
#2 http://aw.soulsrpg.com/phpinfo.php
Originally it was three files, which I made into two. I tried to combine the code into one file instead of having two, in case that would help, but I wasn’t able to get it to work as one file. I’m probably pasting somewhere in the wrong place, because I’m in copy-paste-edit level of PHP, though I (think I) can read a bit.
Any ideas would be greatly appreciated
Code:
[QUOTE=demo2.php]<?php echo "
"; echo date("F j, Y"); echo "
"; ?>The idiom for today is <?php function dquotes($qdate) { include "idioms.php"; if ( date("z") > 59 and date("L") == 0 ) { $leap = 1; } if ( date("z") > 59 and date("L") == 1 ) { $leap = 0; } $day = date("z", $qdate + $leap); $dquotes = $quote[$day]; return $dquotes; } print dquotes(date(time())); ?>
[/QUOTE]
[QUOTE=idioms.php (or part of it, it’s long)]<?php
// January 1 to 31
$quote[1] = ‘María, Madre de Dios’;
$quote[2] = ‘Basilio, Gregorio’;
$quote[3] = ‘Genoveva’;
$quote[4] = ‘Yolando, Rigoberto’;
$quote[5] = ‘Emilia’;
$quote[6] = ‘Wilma, Melanio’;
$quote[7] = ‘Raimundo’;
$quote[8] = ‘Luciano, Eladio’;
$quote[9] = ‘Lucrecia’;
$quote[10] = ‘Gonzalo’;
?>
There’s total 369 quotes in the file, so only listing 10
[/QUOTE]