Support » Plugins » 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
    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/
    help would be very much apriciated.

Viewing 15 replies - 1 through 15 (of 15 total)
  • What version of WordPress are you using?

    I’m using 1.0.2

    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));

    $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

    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 🙁

    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

    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” ?

    I’ll reinstall the psngallery hack and show you, give me a sec.

    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.

    Ok, got it, pleas go here and have a look: http://www.riding-shotgun.de/blog/

    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….

    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!

    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”;
    // 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

    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 🙁

    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“;
    // 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.