Stop data retention! Click here & act! Are you a webmaster and want to participate? Here you can find all necessary material for your website - Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Chris Karakas Online Forum Index Karakas Online
 FAQFAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
How to adjust server time in PHP-Nuke


Goto page 1, 2, 3, 4  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP-Nuke Forum RSS Feed of this Forum
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea  View previous topic :: View next topic  
Author Message
glock
Corporal
Corporal


Joined: 15 Sep 2003
Posts: 18

PostPosted: Sat Feb 07, 2004 7:18 am    Post subject: How to adjust server time in PHP-Nuke
Reply with quote

What file and how do I change the server time for adjustments? It seems I am running about 8 hours behind the server.
Back to top
View user's profile Send private message
arnoldkrg
President
President


Joined: 29 Jun 2003
Posts: 1578
Location: United Kingdom

PostPosted: Sat Feb 07, 2004 8:52 pm    Post subject: time
Reply with quote

This issue is discussed extensively in the following thread:http://nukecops.com/postx3321-0-0.html. I've read through it and I am not sure whether there is a satisfactory explanation there. On my own site I changed the two locales in preferences to en_GB and en_gb respectively. This formats the time in UK format but doesnt alter the server time. Luckily my server is in the UK so my times are correct. I presume you will have to include an offset in any code where the time is displayed in order to modify the server time to your own time.
_________________
Image
Back to top
View user's profile Send private message Send e-mail
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Sat Feb 07, 2004 10:19 pm    Post subject:
Reply with quote

The problem arises if your server is located in a different timezone than your geographic location - say you are located in Japan, but your hosting company is in Canada. The article on phpbuilder.com On User-Defined Timezones in PHP might be useful in explaining the problem. Quoting:
Quote:
Open quotePHP's 'mktime' and 'date' functions work well as a pair without the help of any other timestamp manipulation routines, but only if the application in which they are used is concerned solely with display and entry of time in the servers timezone. If an application needs to handle entry from a timezone other than that in which the server is located something more than 'mktime' and 'date' is required.

Two things are required to accomplish this: a location independent format for storing time in the database, and methods to translate to and from that format into the user's local time. Close quote


Read the original article for a solution. To apply it to PHP-Nuke, you would need to replace the time functions with the new ones, read the time offset from the user's profile and display the result.
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Sat Feb 07, 2004 10:29 pm    Post subject:
Reply with quote

You can offset the time by tweaking the following line in the mainfile.php in the function formatTimeStamp:

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],
$datetime[2],$datetime[3],$datetime[1]));


For example to add one hour (3600 seconds), you would simply add 3600:

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],
datetime[2],$datetime[3],$datetime[1]) + 3600);


or, to subtract two hours:

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],
$datetime[2],$datetime[3],$datetime[1]) - 7200);


To reflect the new time zone that may be implied by the hardcoded time offset, you would also want to change the _DATESTRING definition in your language file, e.g. language/lang-english.php:

Code:

define("_DATESTRING","%A, %B %d @ %T %Z");


You can change the "%A, %B %d @ %T %Z" string to whatever you deem appropriate. PHP gives to some placeholders a special meaning, see the PHP manual page for strftime.
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nikits72
Staff Sergeant
Staff Sergeant


Joined: 01 Feb 2005
Posts: 45
Location: Athens/Greece

PostPosted: Sun Feb 06, 2005 12:33 pm    Post subject:
Reply with quote

Hi all,

i have a problem with time settings in phpnuke.My server is in canada.
First question is here.Is there any little script which i can run so i will see the time which my server has. (Right now i see my server is about 7 hours back you will read below how)

I go as a user and enter a new in the submit news area of phpnuke.
Then ,right after,i go as admin to check the new submission.
In the program new story it says that :

Code:

Now is: February 06, 2005 @ 07:14:41


So i see my server time is back about 7 hours.

I go read karakas phpnuke manual section: 27.13.2 How to adjust server time and i read what is written above by chris.
So i change the relative line of my mainfile.php to this :

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]) + 25800);


The +25800 represents approximatelly my time difference with the server.I assume this should correct the time.
I upload the new mainfile.php to the server and i repeat the test by submiting another new as a user ,right after login as admin e.t.c.

No changes.It still says the server time which is back of my time about 7 hours.

Well of course this is a minor problem which i could anticipate by just adding 7 hours to the program new story time.Although by reading the manual and posts dealing with this issue it seems that the change in the code -which is described above by chris- should correct the problem.

Obviously i am doing something wrong.

Any suggestions?

Thx...

[edit] Included code in code tags. Chris [/edit]
_________________
nikits72 with the unexploding grenade...
Back to top
View user's profile Send private message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue Feb 08, 2005 11:13 am    Post subject:
Reply with quote

nikits72 wrote:
Open quoteNo changes.It still says the server time which is back of my time about 7 hours. Close quote


I find it a bit hard to believe. Could you please recheck? For example, are you sure you uploaded the updated mainfile.php and not the old one?
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nikits72
Staff Sergeant
Staff Sergeant


Joined: 01 Feb 2005
Posts: 45
Location: Athens/Greece

PostPosted: Tue Feb 08, 2005 11:22 am    Post subject:
Reply with quote

Quote:
Open quoteI find it a bit hard to believe. Could you please recheck? For example, are you sure you uploaded the updated mainfile.php and not the old one?Close quote


Although i am sure i did everything fine this is great news cause it seems that what we discuss here corrects the problem.
So i will repeat the process and let you know (but this will take a couple days cause my host informed me that is upgrading the server and i wont be able to make changes)

Thx...
_________________
nikits72 with the unexploding grenade...
Back to top
View user's profile Send private message
ErisDS
Corporal
Corporal


Joined: 17 Mar 2005
Posts: 18

PostPosted: Thu Mar 17, 2005 9:44 am    Post subject:
Reply with quote

Hi,

Im pretty sure i have the same problem, but its a little more complex than explained here. I hope i can explain it better.

I made the modification to the $datetime variable as explained here and in the phpnuke HOWTO by adding 5 hours on as my server time is EST and i am in GMT. I also changed my %Z to GMT.
This works a treat on the news page, even the news submitted previously all displays correctly as being GMT.

The problem, is with adding new news articles. At the bottom of the add new page, the date/time is still 5 hours behind and neither EST or GMT is displayed.
I also find that when i post the news, nothing happens. Im guessing that my news stories will magically appear in 5 hours time.

I will continue to try and fix this problem myself, but if anyone knows the fix for it, I would appreciate the help.
Back to top
View user's profile Send private message
ErisDS
Corporal
Corporal


Joined: 17 Mar 2005
Posts: 18

PostPosted: Sat Mar 19, 2005 4:18 pm    Post subject:
Reply with quote

Hi, Me again.

I realise this is an old thread, and old topic, and a problem that has been much discussed.
My News Administration stopped working after i made the modifcation to the server time.

The news admin page doesnt use the mainfile's formatTimestamp function, it creates the date itself.
Ive been working on this for many hours, trying to figure out how to either change the date in the admin index or how to make it use the formatTimestamp function.
Nothing seems to work.

Could someone please tell me, where does the $datetime array come from?
Has anyone else had this problem? Is it because of the change in the admin system in 7.5?

I really could use some help, i need to fix the news as a priority.
Back to top
View user's profile Send private message
An.DRE
Private
Private


Joined: 12 Apr 2005
Posts: 2

PostPosted: Tue Apr 12, 2005 11:29 am    Post subject:
Reply with quote

chris wrote:
Open quoteYou can offset the time by tweaking the following line in the mainfile.php in the function formatTimeStamp:

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],
$datetime[2],$datetime[3],$datetime[1]));


For example to add one hour (3600 seconds), you would simply add 3600:

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],
datetime[2],$datetime[3],$datetime[1]) + 3600);


.........Close quote


Chris I really need Your help.
I have php nuke http://usasports.pl Serwer is located here (USA) but that sport service is for people in Poland.
My serwer have V-deck and I'm not familiar with PHP Sad

I add + 32400 (seconds) extacly like is explain and after update mainfile.php my service dissappear and now I have message on the main page www.usasports.pl

Code:
Parse error: parse error, unexpected ';' in /home/usasport/.panel/web/portal/73/mainfile.php on line 24


I did'n save that file before i add that correction + 32400 and after i rewrote to the previous

Code:

$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],
$datetime[2],$datetime[3],$datetime[1]));


..i still have that error.!!! Sad Sad Sad

PLEASE HELP !!!!!!

If You want my acces password to my V-Deck I will give to You.

Best Regards
An.DRE
Back to top
View user's profile Send private message Send e-mail
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea 
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP-Nuke Forum
Page 1 of 4
This page contains valid HTML 4.01 Transitional - click here to check it!
This page contains a valid CSS - click here to check it!

 

Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group