Solved

PG4WP is wrongly wrappling the SQL statement in the visitor maps plugin

Posted on 2014-02-02
1
484 Views
Last Modified: 2014-02-04
I have wordpress 3.8.1 with postgres, I have modified the php in visitors-maps.php for the create table part however for the rest of the queries (insert and update) the query is sent to the database with an additional keyword at the end, for example
The query in the visitors-maps.php looks:

        $query = "INSERT INTO " . $wo_table_wo . "
        (session_id,
        ip_address,
        user_id,
        name,
        country_name,
        country_code,
        city_name,
        state_name,
        state_code,
        latitude,
        longitude,
        last_page_url,
        http_referer,
        user_agent,
        hostname,
        time_entry,
        time_last_click,
        num_visits)
        values (
                '" . esc_sql($ip_address) . "',
                '" . esc_sql($ip_address) . "',
                '" . esc_sql($wo_user_id) . "',
                '" . esc_sql($name) . "',
                '" . esc_sql($country_name) . "',
                '" . esc_sql($country_code) . "',
                '" . esc_sql($city_name) . "',
                '" . esc_sql($state_name) . "',
                '" . esc_sql($state_code) . "',
                '" . esc_sql($latitude) . "',
                '" . esc_sql($longitude) . "',
                '" . esc_sql($last_page_url) . "',
                '" . esc_sql($http_referer) . "',
                '" . esc_sql($user_agent) . "',
                '" . esc_sql($hostname) . "',
                '" . esc_sql($current_time) . "',
                '" . esc_sql($current_time) . "',
                '1');";

Open in new window


But in the postgres log I can see it sent to the DB as:
STATEMENT:  INSERT INTO wp_visitor_maps_wo
               (session_id,
               ip_address,
               user_id,
               name,
               country_name,
               country_code,
               city_name,
               state_name,
               state_code,
               latitude,
               longitude,
               last_page_url,
               http_referer,
               user_agent,
               hostname,
               time_entry,
               time_last_click,
               num_visits)
               values (
                       '0.0.0.0',
                       '0.0.0.0',
                       '1',
                       'Me',
                       'Home',
                       'HO',
                       'CITY',
                       'AREA',
                       '00',
                       '0000',
                       '0000',
                       '/wp-admin/?loggedout=true',
                       'http://www.mydomain.com',
                       'Client',
                       'ISP',
                       '000',
                       '000',
                       '1'); VALUES

Open in new window


It has added the word VALUES at the end.

Also Query is in the visitors-maps.php looks:

 $wpdb->query("UPDATE " . $wo_table_st . "
  SET
  count = '" . absint($visitors_count) . "',
  time = '".$mysql_now."'
  WHERE (time !='".$mysql_now."' 
     OR count < '" . absint($visitors_count) . "') AND type = 'day';");

Open in new window


But in the postgres log I can see it sent to the DB as:

STATEMENT:  UPDATE wp_visitor_maps_st
         SET
         count = '0',
         time = '2014-02-02 12:47:50'
         WHERE (time !='2014-02-02 12:47:50'
            OR count < '0') AND type = 'day'; SET

Open in new window

It has added the word SET at the end.

Is there a way to correct this issue?
0
Comment
Question by:Ashraf Hassanein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Ashraf Hassanein earned 0 total points
ID: 39832292
PG4WP is not working properly if values is written in lower case and for the update all the command has to be written in one line.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question