I've tried to get a script together that should explode this page (
Only registered users can see links on this board! Get registered or login to the forums!
), then output the times listed in both PST and GMT format. Unfortunately, when the data is input as 'AM PST', the script just adds 20 hours. I have no idea why this happens (this script isn't mine, and I'm a PHP newbie). Hasn't someone already created a time zone changing function that I could use for this purpose?
Here's the code:
Code:
<?php
if (eregi("block-upcoming_events.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
$boom = explode("<br>", $file);
function file_get_contentss($filename, $use_include_path = 0) {
$data = ""; // just to be safe. Dunno, if this is really needed
$file = @fopen($filename, "rb", $use_include_path);
if ($file) {
while (!feof($file)) $data .= fread($file, 1024);
fclose($file);
}
return $data;
}
function getBetween($getAfter, $getBefore, $array) {
$stepOne = explode($getAfter, $array);
$stepTwo = explode($getBefore, $stepOne[1]);
return $stepTwo[0];
};
Wow... Well spotted... I will upload the changed file soon - my site seems to be down. In the meantime, just a slight clarification - Do you mean to change both of the 'file_get_contentss' in the file (there are two)?
Well, when I took out the extra 's', the block decided not to work at all... O.o
But in the meantime, I was given another piece of code for a block that does work. ^_^
I have asked the original author, but he doesn't seem to be around anymore... Do you know how to make this script display both the GMT and PST times (it displays GMT times fine at the moment)?
Just in case you need to view the block output -
Only registered users can see links on this board! Get registered or login to the forums!
Here's the block's code:
Code:
<?php
if (eregi("block-upcoming_events.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
Posted:
Mon Apr 12, 2004 8:54 pm
I just spent some time on that original code and it suddenly dawned on me why it had the extra 's'. It's because they were rewriting the php function file_get_contents and php does not allow you to name your function the same as a php function; thus the extra 's'. I scaled it down to
Code:
<?php
if (eregi("block-upcoming_events.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
The reason it adds the 20 hours is because the time it is reading appears to always be "" so it adds the 12. Then right after that is a piece of code that adds 8 more. It does exactly what it is told to do. Regardless, that's not your problem anymore as you found another piece of code.
As to the quick reply hack, I installed that quite a while ago and as I remember it, I did have to move 1 or 2 files to a different location but I honestly don't remember. I know that doesn't help you but maybe someone else can help you there. I just don't have time right now to try to back-track.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum