Title: Help with image hack
Last modified: August 18, 2016

---

# Help with image hack

 *  Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/)
 * I’ve posted this elsewhere twice but I have gotten no response, so I am trying
   one last time:
    I got a hack from [http://www.lennartgroetzbach.de/phps/cpg.plugin.phps](http://www.lennartgroetzbach.de/phps/cpg.plugin.phps)
   and I installed it, but now, everytime I post the code for the image all I get
   when I want to view it is this: SQL/DB Error: [You have an error in your SQL 
   syntax near ‘OFFSET 4’ at line 1] SELECT filepath, filename, title FROM pix_pictures
   WHERE aid=5 ORDER BY 5 LIMIT 1 OFFSET 4 the blog is here: [http://www.riding-shotgun.de/blog/](http://www.riding-shotgun.de/blog/)
   help would be very much apriciated.

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52188)
 * What version of WordPress are you using?
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52190)
 * I’m using 1.0.2
 *  [idahocline](https://wordpress.org/support/users/idahocline/)
 * (@idahocline)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52193)
 * There are only 3 fields in the select but the query asks a sort on the fifth !
   
   So….in the plugin source, you should update or remove the “order by”.: $wpdb-
   >query(‘SELECT filepath, filename, title FROM ‘.CPG_TABLE_PREFIX.’pictures WHERE
   aid=’.$aid.’ ORDER BY ‘.$aid.’ LIMIT 1 OFFSET ‘.($pos – 1));
 *  [idahocline](https://wordpress.org/support/users/idahocline/)
 * (@idahocline)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52196)
 * $wpdb->query(‘SELECT filepath, filename, title FROM ‘.CPG_TABLE_PREFIX.’pictures
   WHERE aid=’.$aid.’ ORDER BY 3 LIMIT 1 OFFSET ‘.($pos – 1));
    to sort on the title
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52200)
 * hey idahocline, I took a look at the code and what you posted there is what it
   already says in line 89… or where am I supposed to replace it?
    I also tried 
   the psnGallery.php hack, but that gave me even worse errors… I really want to
   have something like this 🙁
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52201)
 * Ok, I put this in line 89 `$wpdb->query('SELECT filepath, filename, title FROM'.
   CPG_TABLE_PREFIX.'pictures WHERE aid='.$aid.' ORDER BY 3 LIMIT 1 OFFSET '.($pos-
   1));`
    but I am still getting an error: SQL/DB Error: [You have an error in your
   SQL syntax near ‘OFFSET 4’ at line 1] SELECT filepath, filename, title FROM pix_pictures
   WHERE aid=5 ORDER BY 3 LIMIT 1 OFFSET 4
 *  [idahocline](https://wordpress.org/support/users/idahocline/)
 * (@idahocline)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52204)
 * Well, if you take the code from the link you wrote above, the code to update 
   is indeed at line 98. But the code is :
    $wpdb->query(‘SELECT filepath, filename,
   title FROM ‘.CPG_TABLE_PREFIX.’pictures WHERE aid=’.$aid.’ **ORDER BY ‘.$aid.’**
   LIMIT 1 OFFSET ‘.($pos – 1)); and not $wpdb->query(‘SELECT filepath, filename,
   title FROM ‘.CPG_TABLE_PREFIX.’pictures WHERE aid=’.$aid.’ **ORDER BY 3** LIMIT
   1 OFFSET ‘.($pos – 1)); What problems have you encountered with “psnGallery” ?
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52205)
 * I’ll reinstall the psngallery hack and show you, give me a sec.
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52206)
 * btw, the `$wpdb->query('SELECT filepath, filename, title FROM '.CPG_TABLE_PREFIX.'
   pictures WHERE aid='.$aid.' ORDER BY 3 LIMIT 1 OFFSET '.($pos - 1));` is still
   not working. but yeah, let me do the psngallery thing, you’ll see.
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52207)
 * Ok, got it, pleas go here and have a look: [http://www.riding-shotgun.de/blog/](http://www.riding-shotgun.de/blog/)
 *  [idahocline](https://wordpress.org/support/users/idahocline/)
 * (@idahocline)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52212)
 * let’s continue per mail….At first look, it seems that you haven’t configured 
   correctly the module….
    I am at work for the moment. But I have finished in 4
   or 5 hours I will be at home. Send me a mail with your version of psnGallery.
   php. I will have a look. (admin at idahocline dot com) While executing query “
   SELECT * FROM **dbname**.**cpg11d**_config” on 0 mySQL error: Access denied for
   user: ‘v109938@localhost’ to database ‘dbname’ **dbname** is the variable name
   the module. **cpg11d** is the default value….
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52213)
 * That’d be so nice, because I would rather have this hack, I liked the way it 
   works better, but I am blind when it comes to code. I will send you the file.
   
   Thanks so much!
 *  [idahocline](https://wordpress.org/support/users/idahocline/)
 * (@idahocline)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52215)
 * at the end of the code, you should find :
    // MySQL configuration $CONFIG[‘dbserver’]
   = “localhost”; // Your database server $CONFIG[‘dbuser’] = “user”; // Your mysql
   username (v109938 I assume) $CONFIG[‘dbpass’] = “password”; // Your mysql password
   $CONFIG[‘dbname’] = “dbname”; // Your mysql database name $CONFIG[‘urlsite’] 
   = “[http://gallery.idahocline.com&#8221](http://gallery.idahocline.com&#8221);;//
   MySQL TABLE NAMES PREFIX $CONFIG[‘TABLE_PREFIX’] = $CONFIG[‘dbname’].”.cpg11d_”;
   So update those entries according yours…. Don’t forget to change “cpg11d_” into“
   pix_” (I assume, according your error message
 *  Thread Starter Anonymous
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52231)
 * ok, so now I have this:
    `// MySQL TABLE NAMES PREFIX $CONFIG['pix_'] = $CONFIG['
   dbname']."pix_"; but still get this: While executing query “SELECT * FROM dbname.
   cpg11d_config” on 0 mySQL error: Access denied for user: ‘v109938@localhost’ 
   to database ‘dbname’ I’m frustrated 🙁
 *  [idahocline](https://wordpress.org/support/users/idahocline/)
 * (@idahocline)
 * [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52273)
 * the update you have to update the **values** not the “identificators”
    $CONFIG[‘
   dbserver’] = “**localhost**“; // Your database server $CONFIG[‘dbuser’] = “**
   user**“; // Your mysql username (v109938 I assume) $CONFIG[‘dbpass’] = “**password**“;//
   Your mysql password $CONFIG[‘dbname’] = “**dbname**“; // Your mysql database 
   name $CONFIG[‘urlsite’] = “**[http://gallery.idahocline.com](http://gallery.idahocline.com)**“;//
   MySQL TABLE NAMES PREFIX $CONFIG[‘TABLE_PREFIX’] = $CONFIG[‘dbname’].”**cpg11d_**“;
   Sorry I should have been more precise….

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Help with image hack’ is closed to new replies.

 * 15 replies
 * 2 participants
 * Last reply from: [idahocline](https://wordpress.org/support/users/idahocline/)
 * Last activity: [22 years, 1 month ago](https://wordpress.org/support/topic/help-with-image-hack/#post-52273)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
