forum.coppermine-gallery.net

Support => cpg1.6.x Support => cpg1.6 miscellaneous => Topic started by: FansCityEu on April 16, 2019, 02:16:55 am

Title: Help to make this small plugin work with 1.6.x
Post by: FansCityEu 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 '\');';

?>
Title: Help to make this small plugin work with 1.6.x
Post by: Αndré on April 16, 2019, 02:30:55 pm
it reports "unable to connect to database"

Are you sure it reports exactly that message?