Cannot Upload - Database Error? Cannot Upload - Database Error?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Cannot Upload - Database Error?

Started by pols1337, July 04, 2014, 02:36:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pols1337

Hi there, I recently had my server administrator upgrade PHP to 5.5.13 and MySQL to 5.7.  I also reskinned although I doubt that affects anything.  I cannot upload either via the User uploads or the Batch uploads. 

- I checked the permissions and the /albums folder shows a 777
- The intermediate and thumbnails are being created

Gallery link: http://adonismale.com/tg/index.php

See photos. Please advise


pols1337

And if this helps, here is the Critical Error (see screenshot)

While executing query 'INSERT INTO cpg15x_pictures (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('23', 'userpics/10001/', 'tumblr_mx414oW8UV1qdgdbio1_r1_500~0.jpg', '67720', '96763', '500', '750', '1404434426', '1', 'Cute Guy', 'Guy in pink shirt', '', 'YES', '', '', '', '', '66.199.97.83', '66.199.97.83', '0', '')' in include/picmgmt.inc.php on line 173

mySQL error: Incorrect datetime value: '0000-00-00 00:00:00' for column 'mtime' at row 1




pols1337

And lastly ... here is the Debug Info



USER:
------------------
Array
(
    [ID] => 00ff3af3d218532937b16a9477af5ef5
    [am] => 1
    [lang] => english
    [liv_a] => Array
        (
            [0] => 697
            [1] => 694
            [2] => 693
            [3] => 6
            [4] => 490
        )

    [liv] => Array
        (
            [0] => 309960
            [1] => 309972
            [2] => 309961
            [3] => 309920
            [4] => 314416
        )

    [search] => Array
        (
            [params] => Array
                (
                    [title] => on
                    [caption] => on
                    [keywords] => on
                    [filename] => on
                    [type] => AND
                    [newer_than] =>
                    [older_than] =>
                )

            [search] => red
        )

    [upload_method] => html_single
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_name] => Joel
    [groups] => Array
        (
            [0] => 1
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 0
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 0
    [has_admin_access] => 1
    [access_level] => 3
    [pub_upl_need_approval] => 1
    [priv_upl_need_approval] => 1
    [group_name] => Administrators
    [can_create_public_albums] => 0
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
    [allowed_albums] => Array
        (
        )

)

==========================
Queries:
------------------
Array
(
    [0] => SELECT name, value FROM cpg15x_config [include/init.inc.php:179] (1.22 ms)
    [1] => SELECT * FROM cpg15x_plugins ORDER BY priority [include/plugin_api.inc.php:52] (0.56 ms)
    [2] => SELECT name, value FROM cpg15x_bridge [include/functions.inc.php:4418] (0.32 ms)
    [3] => SELECT u.member_id , u.member_login_key FROM `adon_ipb`.sessions AS s INNER JOIN `adon_ipb`.members AS u ON s.member_name = u.members_display_name WHERE s.id = '9e0ec2841dfd7f70ad6b56699736200b' [bridge/invisionboard3x.inc.php:178] (19.91 ms)
    [4] => SELECT u.member_id AS id, u.members_display_name AS username, member_login_key AS password, u.member_group_id AS group_id FROM `adon_ipb`.members AS u LEFT JOIN `adon_ipb`.groups AS g ON u.member_group_id=g.g_id WHERE u.member_id='1' [bridge/udb_base.inc.php:70] (0.26 ms)
    [5] => SELECT MAX(group_quota) AS disk_max, MIN(group_quota) AS disk_min, MAX(can_rate_pictures) AS can_rate_pictures, MAX(can_send_ecards) AS can_send_ecards, MAX(can_post_comments) AS can_post_comments, MAX(can_upload_pictures) AS can_upload_pictures, MAX(can_create_albums) AS can_create_albums, MAX(has_admin_access) AS has_admin_access, MAX(access_level) AS access_level, MIN(pub_upl_need_approval) AS pub_upl_need_approval, MIN( priv_upl_need_approval) AS  priv_upl_need_approval FROM cpg15x_usergroups WHERE group_id in (1) [bridge/udb_base.inc.php:323] (0.25 ms)
    [6] => SELECT group_name FROM cpg15x_usergroups WHERE group_id= 1 [bridge/udb_base.inc.php:327] (0.12 ms)
    [7] => SELECT COUNT(*) FROM cpg15x_categorymap WHERE group_id in (1) [bridge/udb_base.inc.php:340] (0.13 ms)
    [8] => SELECT lang_id FROM cpg15x_languages WHERE enabled='YES' [include/init.inc.php:330] (0.31 ms)
    [9] => SELECT user_favpics FROM cpg15x_favpics WHERE user_id = 1 [include/init.inc.php:388] (0.09 ms)
    [10] => DELETE FROM cpg15x_banned WHERE expiry < '2014-07-04 00:40:26' [include/init.inc.php:444] (0.12 ms)
    [11] => SELECT null FROM cpg15x_banned WHERE (user_id=1 OR '66.199.97.83' LIKE ip_addr ) AND brute_force=0 LIMIT 1 [include/init.inc.php:460] (0.12 ms)
    [12] => SELECT category FROM cpg15x_albums WHERE aid = 23 [db_input.php:554] (0.28 ms)
    [13] => SELECT extension, mime, content, player FROM cpg15x_filetypes [include/functions.inc.php:5779] (0.75 ms)
    [14] => INSERT INTO cpg15x_pictures (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('23', 'userpics/10001/', 'tumblr_mx414oW8UV1qdgdbio1_r1_500~0.jpg', '67720', '96763', '500', '750', '1404434426', '1', 'Cute Guy', 'Guy in pink shirt', '', 'YES', '', '', '', '', '66.199.97.83', '66.199.97.83', '0', '') [include/picmgmt.inc.php:173] (0.23 ms)
    [15] => SELECT COUNT(*) FROM cpg15x_pictures WHERE approved = 'NO' [include/functions.inc.php:2421] (0.29 ms)
    [16] => SELECT lang_id, abbr FROM cpg15x_languages WHERE available='YES' AND enabled='YES' [include/themes.inc.php:2292] (0.19 ms)
)

==========================
GET :
------------------
Array
(
)

==========================
POST :
------------------
Array
(
    [method] => html_single
    [album] => 23
    [title] => Cute Guy
    [caption] => Guy in pink shirt
    [keywords] =>
    [event] => picture
    [form_token] => 8c8d2796eb8d71dd87bb4cdb165fddbc
    [timestamp] => 1404434395
)

==========================
COOKIE :
------------------
Array
(
    [service] => guys
    [screen_name] => Texas_57799
    [keep_white] => 0
    [guestSkinChoice] => 94
    [sfc] => 1400968297
    [sfct] => friends
    [member_id] => 1
    [pass_hash] => bcf175bd96bf91f142ab6224fadf3cf3
    [itemMarking_core] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_forums] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_forums_items] => eJxFzTEOwDAIQ9G7ZO6ADSGhV6t696YQKevTt_w042S0GyYmcyD0SvIkndp9-k_DD5lIVVY0BIIcQnfVPYS2CNHjEJhDsEjXdqAIReyxHpKEh7ir_UiC4e8HHdklpQ,,
    [itemMarking_ccs] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_ccs_items] => eJyrVjIyNrBQsjI0MTC2MDa1NLTUAYmYQ0RMTIzMTUyAXCJGFhZwEWNDg1pcMDj4Czo,
    [itemMarking_gallery] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_gallery_items] => eJxl0kkSAyEIBdC79DoLkDlXS-Xu6QQjlmxfCcLX1xVIQtcTGYjZ0fhxBYVj0ZgEnUYj4z8ZhlwnSVwn6mSdopN28k5rVAPDH2l08kaGncZJhmsIDdHsRRtRkhSxJdlGmZeuvNRjknYaRTiS8CTDXCKjTEJio9kLigZ8SXAloSqzUDeCpJpeKXcU7ySd-CSHKpT5c2RsNG-sVAUzQqkdBX7Z3xkt4iz0qFOM-Y5cXEkwJEklQfPncK1NLknWyU9ymqfuRsyYJEXo7w-Pa6yq
    [itemMarking_downloads] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_downloads_items] => eJxN0jdyxDAMBdC7qN4COfhqHt99SUIm0L75CAL1-yAzPj8oIJCmXDCfXCcF6F8EKT9PWE7hLTIEfFWxXuE4kkPc9fMgiA-yWKTR89l5k0sMXCLapJNg7YSh3L0seZNBNokXySUVLdJLYrgoIZoo9dBYlbQooYmiUl2IKUW9BJ5vTBxLIOYh7A-C9KI7kVwiqxD9kvGbiiZcXESgyJdU6KQMmirl_ayLaJOlNYGdXvc44bJ_h5W6tw9Rl1wiGsRFPAhr4ii0rJRcXBKPXCIdpFXIg96JNogq1b04tFI-6N0rBmFRNnntdZ92kxf19qQv0aCamDyoJqYMeg-tg-qq2auiWVEMetvnIPr7AtdOt_o,
    [itemMarking_blog] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_blog_items] => eJyrVjK0tDBVsjI0MTA2MTEyMjfUAYmYwESAbIiIMVxcxNTMBCRiBhcxsLAwqQVcMCC-Ds0,
    [itemMarking_nexus] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_members] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_links] => eJyrVkrPyU9KzFGyMjQxMDY0NTQwMNJRSi9KLU4tUbKKjq0FXDCjwQnF
    [itemMarking_links_items] => eJxNzksOwzAIRdG9ZJyBMX58urWqew84ykvl2ZGB-z0y9PjIGvUsMs8C_IE2LILH_jEJNq1BCNDRMAhFBZ4EzdUQhOnS4ASR3uH2XDDSNzAMYR3mDIPfS_WFuYGlMOtSZylg-yxLsTQKjKVQzIZ4YfSI3aW6Kl3kdwF7Az-t
    [ipsconnect_ffa88925e948b80f694e433524a3ba7f] => 1
    [session_id] => 9e0ec2841dfd7f70ad6b56699736200b
    [__utma] => 11431268.532701774.1403067297.1404429702.1404432955.67
    [__utmb] => 11431268.4.10.1404432955
    [__utmc] => 11431268
    [__utmz] => 11431268.1403571875.29.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not provided)
    [rteStatus] => rte
    [cpg15x_data] => YTo3OntzOjI6IklEIjtzOjMyOiIwMGZmM2FmM2QyMTg1MzI5MzdiMTZhOTQ3N2FmNWVmNSI7czoyOiJhbSI7aToxO3M6NDoibGFuZyI7czo3OiJlbmdsaXNoIjtzOjU6Imxpdl9hIjthOjU6e2k6MDtpOjY5NztpOjE7aTo2OTQ7aToyO2k6NjkzO2k6MztpOjY7aTo0O2k6NDkwO31zOjM6ImxpdiI7YTo1OntpOjA7czo2OiIzMDk5NjAiO2k6MTtzOjY6IjMwOTk3MiI7aToyO3M6NjoiMzA5OTYxIjtpOjM7czo2OiIzMDk5MjAiO2k6NDtzOjY6IjMxNDQxNiI7fXM6Njoic2VhcmNoIjthOjI6e3M6NjoicGFyYW1zIjthOjc6e3M6NToidGl0bGUiO3M6Mjoib24iO3M6NzoiY2FwdGlvbiI7czoyOiJvbiI7czo4OiJrZXl3b3JkcyI7czoyOiJvbiI7czo4OiJmaWxlbmFtZSI7czoyOiJvbiI7czo0OiJ0eXBlIjtzOjM6IkFORCI7czoxMDoibmV3ZXJfdGhhbiI7czowOiIiO3M6MTA6Im9sZGVyX3RoYW4iO3M6MDoiIjt9czo2OiJzZWFyY2giO3M6MzoicmVkIjt9czoxMzoidXBsb2FkX21ldGhvZCI7czoxMToiaHRtbF9zaW5nbGUiO30=
)

==========================
VERSION INFO :
------------------
PHP version        5.5.13    OK   
MySQL version      5.7.4-m14 OK   
Coppermine version 1.5.28    stable

==========================
Module: GD
------------------
Exact version                    2.1.0                     
GD Version                       bundled (2.1.0 compatible)
FreeType Support                 1                         
FreeType Linkage                 with freetype             
T1Lib Support                                             
GIF Read Support                 1                         
GIF Create Support               1                         
JPEG Support                     1                         
PNG Support                      1                         
WBMP Support                     1                         
XPM Support                      1                         
XBM Support                      1                         
JIS-mapped Japanese Font Support                           

==========================
Key config settings
------------------
site_url             http://adonismale.com/tg/           
charset              utf-8                               
allow_private_albums 1                                   
cookie_name          cpg15x                               
cookie_path          /                                   
impath               /usr/bin/                           
lang                 english                             
main_page_layout     anycontent/breadcrumb/catlist/alblist
silly_safe_mode      0                                   
smtp_host                                                 
theme                pulse                               
thumb_method         im                                   

==========================
Plugins
------------------
Name           HTML5 Upload                                 
Actions        upload_form, plugin_install, plugin_uninstall
Filters        upload_options                               
--------------
Name           Keyboard Navigation                         
Actions        page_start                                   
Filters                                                     
--------------
Name           Keywords_add                                 
Actions        page_start                                   
Filters                                                     
--------------
Name           LightBox NotesFor.net                       
Actions        plugin_install, plugin_uninstall             
Filters        file_data, theme_img_navbar                 
--------------
Name           Picture Navigation                           
Actions        page_start                                   
Filters                                                     
--------------
Name           Mousewheel support for filmstrip             
Actions        page_start                                   
Filters                                                     
--------------

==========================
Server restrictions
------------------
safe_mode                                                     
safe_mode_exec_dir                                             
safe_mode_gid                                                 
safe_mode_include_dir                                         
sql.safe_mode                                                 
disable_functions                                             
file_uploads             1                                     
include_path             .:/usr/share/php5:/usr/share/php5/PEAR
open_basedir                                                   
allow_url_fopen          1                                     
max_execution_time       30                                   
max_input_time           60                                   
upload_max_filesize      2M                                   
post_max_size            8M                                   
memory_limit             128M                                 
suhosin.post.max_vars                                         
suhosin.request.max_vars                                       


==========================
Page (performance)
------------------
Parameter        Current   Peak     
Memory usage     3.25 MiB  3.59 MiB
Page generation  168.63 ms 168.63 ms
Page query time  25.18 ms  25.18 ms
Page query count 17        17       


==========================
               

ron4mac

Best guess here since I have no way to test it:

You may need to change the three lines in "include/picmgmt.inc.php" around line 169 to the following:
        $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, mtime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "','1000-01-01 00:00:00', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '{$CURRENT_PIC_DATA['guest_token']}')";
    } else  {
        $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, mtime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "','1000-01-01 00:00:00', '{$CURRENT_PIC_DATA['owner_id']}', '', '', '', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '{$CURRENT_PIC_DATA['guest_token']}')";

[Recommend you save a copy of the file first]

phill104

Well that was hard work trying to get those versions into WAMP lol.

As suggested the changes by Ron4Mac appear to work. Please confirm if it is good your end.
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

From the MySQL docs:
Quote from: http://dev.mysql.com/doc/refman/5.1/en/datetime.htmlThe supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

I suggest to adjust the default value for the column mtime in your MySQL database instead of modifying core files. I'll fix this for cpg1.5.30 and above.

Αndré

Fixed default value for columns that use the MySQL datatype "datetime" in SVN revision 8720.

pols1337

Can you direct me to the latest SVN revision? 

Also, is include/picmgmt.inc.php the only file that needs to be replaced? 

Thanks everyone  :D

phill104

It is a mistake to think you can solve any major problems just with potatoes.

ron4mac

Quote from: pols1337 on July 04, 2014, 06:19:26 PM
Also, is include/picmgmt.inc.php the only file that needs to be replaced? 

To be clear ... you must edit your picmgmt.inc.php file and change the few lines as listed above. You can not replace it with the SVN copy of that file.

Your only other option is to apply these lines to your Coppermine database:

ALTER TABLE cpg15x_comments CHANGE `msg_date` `msg_date` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE cpg15x_pictures CHANGE `mtime` `mtime` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE cpg15x_users CHANGE `user_lastvisit` `user_lastvisit` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE cpg15x_users CHANGE `user_regdate` `user_regdate` datetime NOT NULL default '1000-01-01 00:00:00';


Your best solution would be to apply the changes to your database.

Αndré

Actually, the easiest solution (that will also be part of cpg1.5.30) is to add
ALTER TABLE CPG_comments CHANGE `msg_date` `msg_date` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE CPG_pictures CHANGE `mtime` `mtime` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE CPG_users CHANGE `user_lastvisit` `user_lastvisit` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE CPG_users CHANGE `user_regdate` `user_regdate` datetime NOT NULL default '1000-01-01 00:00:00';

to the end of sql/update.sql and then run update.php as admin ;)

pols1337

Quote from: Αndré on July 04, 2014, 08:27:08 PM
Actually, the easiest solution (that will also be part of cpg1.5.30) is to add
ALTER TABLE CPG_comments CHANGE `msg_date` `msg_date` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE CPG_pictures CHANGE `mtime` `mtime` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE CPG_users CHANGE `user_lastvisit` `user_lastvisit` datetime NOT NULL default '1000-01-01 00:00:00';
ALTER TABLE CPG_users CHANGE `user_regdate` `user_regdate` datetime NOT NULL default '1000-01-01 00:00:00';

to the end of sql/update.sql and then run update.php as admin ;)

I did those two steps.  Please see screenshot for my results from update.sql

But when I attempt to batch upload files, I still get the unknown file icon.

pols1337

Hold on, I may have figured out the problem on my end since I'm still getting the same error:

While executing query 'INSERT INTO cpg15x_pictures (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('23', 'userpics/10001/', '97c463ff8709fb08a0d07aa9769f2616.jpg', '138911', '177418', '691', '1238', '1404766211', '1', 'Sample photo', 'Description for sample photo', '', 'YES', '', '', '', '', '66.199.97.83', '66.199.97.83', '0', '')' in include/picmgmt.inc.php on line 173

mySQL error: Incorrect datetime value: '0000-00-00 00:00:00' for column 'mtime' at row 1


I think the local server's socket is not configured correctly, so I'm going to have my server admin take a look.