Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Help to make this small plugin work with 1.6.x  (Read 312 times)

0 Members and 1 Guest are viewing this topic.

FansCityEu

  • Coppermine newbie
  • Country: 00
  • Offline Offline
  • Posts: 16
  • FC
Help to make this small plugin work with 1.6.x
« on: April 16, 2019, 02:16:55 am »

A hostee of mine is using this small plugin to display latest albums updated but does not work with PHP 7.x and CPG 1.6.x, I have tried to make it work but I have been unabled to do so, it reports "unable to connect to database"

Code: [Select]
<?php
require_once(
'include/config.inc.php');
header("Content-type: application/x-javascript");

$connect mysqli_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass'])
or die('Error connecting to the server');

$connect_db mysqli_select_db($CONFIG['dbname'], $connect)
or die ('Error connecting to the database');

$resultado mysqli_query("SELECT * FROM `cpg_albums` ORDER BY `cpg_albums`.`aid` DESC LIMIT 0 , 6"$connect)
or die('No albums found with this query');
                                        
echo 'document.write(\'';
if(mysqli_num_rows($resultado) == 0){
echo 'No albums created';
} else {
echo '<ul id="galbuns">';
while($row mysqli_fetch_array($resultado)){
echo ' ';
$album_id $row['aid'];
$subresult mysqli_query("SELECT * FROM `cpg_pictures` where aid=$album_id order by pid DESC LIMIT 0, 6");

if(mysqli_num_rows($subresult) == 0){
$album_img "http://siteurl.com./galeria/thumbs/thumb_nopic.png";
} else {
while($subrow mysqli_fetch_array($subresult)){
$album_img "http://siteurl.com./galeria/albums/".$subrow['filepath'].'thumb_'.$subrow['filename']  .$subrow['datebrowse'];
                                                                                
}
}

echo '<li><div class="galtitul"><a href="http://siteurl.com./galeria/thumbnails.php?album='.$album_id.' ">'.$row['title'].'</a></div></li>';

echo '';
}
}

echo '</ul>';
echo '\');';

?>
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Help to make this small plugin work with 1.6.x
« Reply #1 on: April 16, 2019, 02:30:55 pm »

it reports "unable to connect to database"

Are you sure it reports exactly that message?
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 20 queries.