Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 633

PostPosted: Wed Nov 02, 2016 2:21 pm Reply with quote

I am having an issue with RN showing the wrong time. Here is an example: System time is set correctly to 13:00 but the news module and Nuke Sentinel IP tracking are both showing a post at 20:00.

Any idea what is going on and how to fix this?
 
View user's profile Send private message
neralex
The Mouse Is Extension Of Arm


Joined: Aug 22, 2007
Posts: 1325
Location: Germany

PostPosted: Wed Nov 02, 2016 3:19 pm Reply with quote

The php.ini of the websever like apache2 is using another timezone as your system. So you have to change it to your own timezone. If you get access to the php.ini of your webserver, then change it in there. In the php.ini of the webserver you can find a line for the timezone. This is normally the best way, if you get the access to the webserver configs. If not, then you can do it manually in the php-scripts of RN.

Here you will find the defined timezones: Only registered users can see links on this board! Get registered or login!

If you have found your correct timezone than open mainfile.php and find:

php Code:
if (@ini_get('date.timezone') == '') {

date_default_timezone_set("America/New_York");
}


add before something like this:

php Code:
date_default_timezone_set("Europe/Berlin");


This is an example of my timezone, you will have to replace it with your own timezone which you will find it in the list on php.net!

This also possible with a own created php.ini in your web-root folder, if your hosting company is providing this option...

OR you can do it with a htaccess-based rule for the apache2 webserver:

apache Code:
SetEnv TZ Europe/Berlin


Last edited by neralex on Thu Nov 03, 2016 2:39 pm; edited 2 times in total 
View user's profile Send private message
Doulos
PostPosted: Thu Nov 03, 2016 4:29 am Reply with quote

Thank you.
 
Doulos
PostPosted: Fri Nov 04, 2016 4:59 pm Reply with quote

OK, I got the IP tracking to show the correct time now by adding date_default_timezone_set("America/Chicago"); as you suggested , but the Donations module is still not reporting the correct time. Paypal receipts for the donation show the correct date/time.

Example: Today I made a donation:
Paypal shows: Date: Nov 4, 2016 Time: 15:23:29 PDT

This date was put into this date into the transaction database: 22:23

Here is the appropriate code from the ipnppd.php:
php code:
php Code:
$insertSQL = sprintf("INSERT INTO transactions (`txn_id`,`business`,`item_name`, `item_number`, `quantity`, `invoice`, `custom`, `memo`, `tax`, `option_name1`, `option_selection1`, `option_name2`, `option_selection2`, `payment_status`, `payment_date`, `txn_type`, `mc_gross`, `mc_fee`, `mc_currency`, `settle_amount`, `exchange_rate`, `first_name`, `last_name`, `address_street`, `address_city`, `address_state`, `address_zip`, `address_country`, `address_status`, `payer_email`, `payer_status`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", 

$_POST['txn_id'],$_POST['business'],$_POST['item_name'],$_POST['item_number'],$_POST['quantity'],$_POST['invoice'],$_POST['custom'],$_POST['memo'],$_POST['tax'],$_POST['option_name1'],$_POST['option_selection1'],$_POST['option_name2'],$_POST['option_selection2'],$_POST['payment_status'],strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),$_POST['txn_type'],$mc_gross,$mc_fee,$_POST['mc_currency'],$_POST['settle_amount'],$_POST['exchange_rate'],$_POST['first_name'],$_POST['last_name'],$_POST['address_street'],$_POST['address_city'],$_POST['address_state'],$_POST['address_zip'],$_POST['address_country'],$_POST['address_status'],$_POST['payer_email'],$_POST['payer_status']);


I tried adding date_default_timezone_set("America/Chicago"); as you suggested and this did fix the other time problems as I said above, but it had no effect on the donation module.

Any other suggestions?
 
neralex
PostPosted: Sun Nov 06, 2016 1:22 am Reply with quote

The function Only registered users can see links on this board! Get registered or login! in your script is using the time and/or date according to locale settings. To set the default timezone manually in a php-file can be overrided by another timezone setting in another file and it will not affect internal functions like strftime.

You could try to change this part:

php Code:
strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),


to:

php Code:
date('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),


Be careful, its not tested.


As I pointed, the best way is to set the timezone in the php.ini file of your webserver. I don't know your server-setting but normally you should have a option to set a own timezone in your webserver configurations like cPanel. This option should you find in the PHP settings. If you doesn't get access to the php.ini settings, then contact your hosting company. This is an simple entry.


Last edited by neralex on Tue Nov 08, 2016 2:10 pm; edited 1 time in total 
Doulos
PostPosted: Mon Nov 07, 2016 5:30 am Reply with quote

Thanks for your reply, nerelax. I got it fixed. Just for fun I checked the IPN error log for the donation module and saw this :
Quote:
PHP Warning: date(): Invalid date.timezone value 'UTC -6', we selected the timezone 'UTC' for now.
I changed "UTC -6" to "America/Chicago" and it now works.

Thanks so much for you time.
 
neralex
PostPosted: Tue Nov 08, 2016 2:06 pm Reply with quote

RavensScripts
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©