Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default trouble with a (paid for) admin mod after upgrading to PHP 5.4

    Recently we got upgraded to php5.4 and have had some problems with accessing anything on the server. Found out that removing the php.ini file from the server fixed the issue but this one is not wanting to comply.

    This mod is for vendors to access the backend of the store to input their product information and images and when going to the link you should get a login box:
    http://fantasiesrealm.com/market/privatearea/login.php

    instead we get this error message on the page I also have gone to the cache folder both in main store folder and the private area folder but there is nothing in there.

    I have gone to creator and left a work ticket about it in case he has a clue too.

    Fatal error: Cannot redeclare date_diff() in market/privatearea/includes/functions/general.php on line 3058

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,684
    Plugin Contributions
    123

    Default Re: 139h--private area mod (paid for mod)

    date-diff (http://us3.php.net/manual/en/function.date-diff.php) is a new function in PHP 5.3. The authors of your code just wanted to make it work for PHP prior to 5.3. You can remove this function now that it's built-in to PHP.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: 139h--private area mod (paid for mod)

    Quote Originally Posted by swguy View Post
    date-diff (http://us3.php.net/manual/en/function.date-diff.php) is a new function in PHP 5.3. The authors of your code just wanted to make it work for PHP prior to 5.3. You can remove this function now that it's built-in to PHP.
    so I just need to go to his file listed in the error message and delete that line to fix it? yay, cause his solution is --and I quote--a temporary solution since all hosts will go to php5.4 soon, downgrade or find new host. That is not acceptable and his upgrades are not free or cheaper than original cost for package.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    The date_diff() function was removed from Zen Cart's /admin/includes/functions/general.php file in v1.3.9 (actually renamed to zc_date_diff), so that means your mod is written for v1.3.8 or older.

    The BEST way to deal with this is to compare YOUR general.php against the real general.php for your ZC version, and take any new functions out of that file and put them into a new file at /admin/includes/functions/extra_functions/my_mod_functions.php

    And of course remove or rename that date_diff() function so that it doesn't clash with PHP's reserved function names.

    If your mod has altered existing functions in the general.php file, then you'll need to verify that they're legitimate and if so keep those specific changes where necessary.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    ok, trial and error for me...sorry

    I ended up removing this entire section from his general.php file:

    Code:
    ////
    // compute the days between two dates
      function date_diff($date1, $date2) {
      //$date1  today, or any other day
      //$date2  date to check against
    
        $d1 = explode("-", $date1);
        $y1 = $d1[0];
        $m1 = $d1[1];
        $d1 = $d1[2];
    
        $d2 = explode("-", $date2);
        $y2 = $d2[0];
        $m2 = $d2[1];
        $d2 = $d2[2];
    
        $date1_set = mktime(0,0,0, $m1, $d1, $y1);
        $date2_set = mktime(0,0,0, $m2, $d2, $y2);
    
        return(round(($date2_set-$date1_set)/(60*60*24)));
      }
    The log in page and the area it lets you into now works again.

    Thanks

  6. #6
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    Quote Originally Posted by DrByte View Post
    The date_diff() function was removed from Zen Cart's /admin/includes/functions/general.php file in v1.3.9 (actually renamed to zc_date_diff), so that means your mod is written for v1.3.8 or older.

    The BEST way to deal with this is to compare YOUR general.php against the real general.php for your ZC version, and take any new functions out of that file and put them into a new file at /admin/includes/functions/extra_functions/my_mod_functions.php

    And of course remove or rename that date_diff() function so that it doesn't clash with PHP's reserved function names.

    If your mod has altered existing functions in the general.php file, then you'll need to verify that they're legitimate and if so keep those specific changes where necessary.
    Thank you Dr. Byte, I ended up removing the bit of code I listed in the post above from his general.php file.

    I had compared the file in stores original includes/functions/functions.general.php with his in privatearea/includes/functions/general.php

    Both files had that exact same line in them so I was totally stumped and of course his naming it just general and not like the one in the originals folder stumped me also.

    Course by now you know I stump very easy.

    I was thinking of going thru his files and comparing them to the store files then just adding his codes to the "new edited" files but I is just a big chicken and thought I might kill my store.

    I may do that in the test store though if I get real brave

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    When you're talking about "private area", I assume you're actually talking about the "admin" folder, right?

    Remember, Zen Cart has the following files with similar but distinctly different filenames, and different contents in each:
    /admin/includes/functions/general.php
    /includes/functions/functions_general.php

    Don't assume the files are the same. They're not. So be careful not to mix things up when you're working with mods that touch those files.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    Quote Originally Posted by DrByte View Post
    When you're talking about "private area", I assume you're actually talking about the "admin" folder, right?

    Remember, Zen Cart has the following files with similar but distinctly different filenames, and different contents in each:
    /admin/includes/functions/general.php
    /includes/functions/functions_general.php

    Don't assume the files are the same. They're not. So be careful not to mix things up when you're working with mods that touch those files.
    No sugar, PrivateArea is the actual name for this paid mod which allows vendors to go into an admin section just for them with permissions to add product/pricing/gc's or coupons/sales etc

    And that is the one that would not allow them to log in there anymore

    When the php was first updated a few days ago...we had trouble with several of our forums and store but once removing he php.ini file from the server then that straightened out and logging in was again an ability.

    This upgrade has been an experience for sure but everything seems to work fine, just gave problem for a bit.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    Okay. If your PrivateArea directory is a completely separate highly-modified partial set of old ZC files, then I really can't comment on them.

    But remember, if that PrivateArea stuff was based on old ZC files (evidently 1.3.8 or older judging from what you've said here) then you really should be keeping those up-to-date as you upgrade your real Zen Cart store. If you don't, then the old code in PrivateArea may stop working because of incompatibility with the new ZC database structures, or worse it might even corrupt your real ZC data.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Oct 2007
    Location
    Emporia, Kansas
    Posts
    1,762
    Plugin Contributions
    0

    Default Re: trouble with a (paid for) admin mod after upgrading to PHP 5.4

    Yes than you I will be doing that as soon as i can afford it. Unfortunately sales are down and the vendors are not using it as much as in the beginning...not one thing its another, such is life.

 

 

Similar Threads

  1. v154 Lost 1.39h Admin Access After Upgrading PHP to 5.4
    By spawnie69 in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 14 May 2015, 03:09 PM
  2. v151 Problems with sqlpatch.php after upgrading to v151
    By elvisstuff in forum General Questions
    Replies: 3
    Last Post: 27 Sep 2012, 02:54 PM
  3. Total Rookie to Zen and PHP having trouble after ADMIN renaming
    By oleancomputers in forum Basic Configuration
    Replies: 4
    Last Post: 10 Feb 2011, 04:37 AM
  4. admin redirect loop after upgrading to php 5.2 from php 4
    By TheGrub in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 4 Aug 2010, 08:45 PM
  5. admin page blank after upgrading to PHP 4.4.2, latest ZC version, IIS
    By r3dw00d in forum Installing on a Windows Server
    Replies: 0
    Last Post: 19 Oct 2009, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR