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 [2]   Go Down

Author Topic: Latest updated albums on a website  (Read 13866 times)

0 Members and 1 Guest are viewing this topic.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Latest updated albums on a website
« Reply #20 on: April 06, 2016, 01:32:39 pm »

Sorry, I misunderstood the request. I'll post updated code soon.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Latest updated albums on a website
« Reply #21 on: April 06, 2016, 01:50:24 pm »

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

    
$connect mysql_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass'])
        or die(
'Error connecting to the server');
    
$connect_db mysql_select_db($CONFIG['dbname'], $connect)
        or die (
'Error connecting to the database');
    
$sql "SELECT * FROM `{$CONFIG['TABLE_PREFIX']}albums` AS a INNER JOIN `{$CONFIG['TABLE_PREFIX']}pictures` AS r ON a.aid = r.aid WHERE approved = 'YES' GROUP BY r.aid ORDER BY ctime DESC LIMIT 0 , 12";
    
$resultado mysql_query($sql$connect)
        or die(
'No albums found with this query');    
    echo 
'document.write(\'';
    if(
mysql_num_rows($resultado) == 0){
        echo 
'No albums created';
    } else {
        echo 
'<div class="wrapper"><ul>';
            while(
$row mysql_fetch_array($resultado)){
            echo 
' ';
            
/*
                $album_id = $row['aid'];
                $subresult = mysql_query("SELECT * FROM `{$CONFIG['TABLE_PREFIX']}pictures` where aid=$album_id order by pid DESC LIMIT 0, 12");
                                
                if(mysql_num_rows($subresult) == 0){
                    $album_img = "GALLERY URL/thumbs/thumb_nopic.png";
                } else {
                    while($subrow = mysql_fetch_array($subresult)){
                        $album_img = "GALLERY URL/albums/".$subrow['filepath'].'thumb_'.$subrow['filename']  .$subrow['datebrowse'];                             
                    }
                }
            */
            
$album_img "GALLERY URL/albums/".$row['filepath'].'thumb_'.$row['filename'].$row['datebrowse'];                             
            echo 
'<li><div class="albimg"><img src="'.$album_img.'" alt="" /><div class="galtit"><a href="http://stanakaticbrasil.com./galteste/thumbnails.php?album='.$album_id.' ">'.$row['title'].'</a></div></div></li>';
            echo 
'';
        }
    }
    echo 
'</ul></div>';
    echo 
'\');';
?>
Logged

biellebrunner

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Latest updated albums on a website
« Reply #22 on: April 06, 2016, 03:11:37 pm »

Ok. It is getting the last updated albums. But now the album title won't show up, and the thumbnails aren't linking to their albums.  :(
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: Latest updated albums on a website
« Reply #23 on: April 06, 2016, 03:28:10 pm »

Sorry. It's quite hard to check the result with the code you provided, as I get just the HTML output and thus don't see such obvious flaws.

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

    
$connect mysql_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass'])
        or die(
'Error connecting to the server');
    
$connect_db mysql_select_db($CONFIG['dbname'], $connect)
        or die (
'Error connecting to the database');
    
$sql "SELECT *, a.title AS alb_title FROM `{$CONFIG['TABLE_PREFIX']}albums` AS a INNER JOIN `{$CONFIG['TABLE_PREFIX']}pictures` AS r ON a.aid = r.aid WHERE approved = 'YES' GROUP BY r.aid ORDER BY ctime DESC LIMIT 0 , 12";
    
$resultado mysql_query($sql$connect)
        or die(
'No albums found with this query');
    echo 
'document.write(\'';
    if(
mysql_num_rows($resultado) == 0){
        echo 
'No albums created';
    } else {
        echo 
'<div class="wrapper"><ul>';
        while(
$row mysql_fetch_array($resultado)){
            
$album_img "GALLERY URL/albums/".$row['filepath'].'thumb_'.$row['filename'].$row['datebrowse'];                             
            echo 
'<li><div class="albimg"><img src="'.$album_img.'" alt="" /><div class="galtit"><a href="http://stanakaticbrasil.com./galteste/thumbnails.php?album='.$row['aid'].'">'.$row['alb_title'].'</a></div></div></li>';
        }
    }
    echo 
'</ul></div>';
    echo 
'\');';
?>
Logged

biellebrunner

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Latest updated albums on a website
« Reply #24 on: April 06, 2016, 04:00:20 pm »

Yes! It worked perfectly!
And no need to apologise, you're already doing so much by just giving it a try (and succeeding!).
Thank you so, so much!  ;D
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.078 seconds with 20 queries.