forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: alexndrre on June 06, 2016, 02:31:36 am

Title: Error on last albums plugin!
Post by: alexndrre on June 06, 2016, 02:31:36 am
Hello, I am using a plugin which displays the last albums uploaded in the gallery on your website.

But it displays this following message:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/u467224226/public_html/galeria/api.php on line 11

Warning: mysql_connect(): Access denied for user 'u467224226_yjygu'@'10.1.2.19' (using password: YES) in /home/u467224226/public_html/galeria/api.php on line 11
Could not connect: Access denied for user 'u467224226_yjygu'@'10.1.2.19' (using password: YES)

Below, the following code. Can anyone save me?

<?php
   require_once('include/config.inc.php');
   header("Content-type: application/x-javascript");
   
   
      
   $connect = mysql_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass'])
      or die('Erro ao conectar ao servidor');
   $connect_db = mysql_select_db($CONFIG['dbname'], $connect)
      or die ('Erro ao conectar ao banco de dados');
         
            
            $resultado = mysql_query("SELECT * FROM `cpg_albums` ORDER BY `cpg_albums`.`aid` DESC LIMIT 0 , 4", $connect)

               or die('Nenhum album encontrado com esta query');
                                       
               echo 'document.write(\'';
               
               if(mysql_num_rows($resultado) == 0){
                  echo 'Nenhum álbum cadastrado';
               } else {
echo '<section id="ultimas_fotos">  ';
                  while($row = mysql_fetch_array($resultado)){
                     echo ' ';
                        $album_id = $row['aid'];
                        $subresult = mysql_query("SELECT * FROM `cpg_pictures` where aid=$album_id order by pid DESC LIMIT 0, 20");
                        
                        if(mysql_num_rows($subresult) == 0){
                           $album_img = "http://tisdalephotos.com/images/thumbs/thumb_nopic.png";
                        } else {
                           while($subrow = mysql_fetch_array($subresult)){
                              $album_img = "http://tisdalephotos.com/albums/".$subrow['filepath'].'thumb_'.$subrow['filename']  .$subrow['datebrowse'];
                                                                               
                           }
                        }
                        
                        echo '<div id="ultalb"><a href="http://tisdalephotos.com/thumbnails.php?album='.$album_id.' "><img src="'.$album_img.'" alt="" /></a><div id="ultalbt"><a href="http://tisdalephotos.com/thumbnails.php?album='.$album_id.' ">+</a></div></div>';   
                        
                     echo '';
                  }
               }

echo '</tr></section>';
               echo '\');';
            
         ?>
Title: Re: Error on last albums plugin!
Post by: Αndré on June 07, 2016, 10:39:30 am
There are 2 issues:

1. usage of deprecated mysql functions
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/u467224226/public_html/galeria/api.php on line 11

2. insufficient permissions to access the database:
Warning: mysql_connect(): Access denied for user 'u467224226_yjygu'@'10.1.2.19' (using password: YES) in /home/u467224226/public_html/galeria/api.php on line 11
Could not connect: Access denied for user 'u467224226_yjygu'@'10.1.2.19' (using password: YES)


To fix issue 1) either use mysqli or PDO instead of mysql functions, or set your web server to not display deprecated warning messages (I recommend the first option!).

To fix issue 2) please check the credentials and the MySQL permissions of that MySQL user.