Welcome to Geeklog Saturday, June 06 2020 @ 11:51 pm EDT

Geeklog Forums

Comment submission issue


Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Location:la rochelle, France
On one of my geeklog 1.8.1 site when users submit comments the page display the message "An SQL error has occurred."

Log file is
PHP Formatted Code
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1. SQL in question: REPLACE INTO gl_commentnotifications (uid,deletehash,mid) VALUES (39,'50dee73dc953c0283b320bc0e57b0c4f',)


I can't reproduce it on demo site. What can I do to avoid this error

From lib-comment.php near line 1217
PHP Formatted Code

//null goes into cid, comment not published yet, set moderation queue id
DB_save($_TABLES['commentnotifications'], 'uid,deletehash,mid',"$uid,'$deletehash',$cid");
 

$cid seems to be null in this case.

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Roccivic

Forum User
Moderator
Registered: 19/05/10
Posts: 136
Something to do with this bug?
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Location:la rochelle, France
Certainly. I solved my issue by adding $cid = 0

PHP Formatted Code

// save user notification information
    if (isset($_POST['notify']) && ($ret == -1 || $ret == 0) ) {
        $deletehash = md5($title . $cid . $comment . rand());
        if ($ret == -1) {
            //null goes into cid, comment not published yet, set moderation queue id
            $cid = 0; // comment went into the submission queue
            DB_save($_TABLES['commentnotifications'], 'uid,deletehash,mid',"$uid,'$deletehash',$cid");
        } else {
            DB_save($_TABLES['commentnotifications'], 'cid,uid,deletehash',"$cid,$uid,'$deletehash'");
        }
    }


Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 11:51 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content