Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Block for Smartor's EZPortal  (Read 5955 times)

0 Members and 1 Guest are viewing this topic.

eddiepacs

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Block for Smartor's EZPortal
« on: November 10, 2003, 07:47:31 pm »

I've been looking everywhere and cannot find for the best of me code that will allow me to add a block to my EZPortal.. which will show a random picture or whatever picture from my coppermine gallery.  I know theres one for Nuke, but how about EZPortal?!... the closest I could find is the following:

Code: [Select]
<?php

//***Enter Path information here***
//***absolute path to main coppermine directory***

$copperminepath '/coppermine/';  //***YOU MUST CHANGE THIS***

//This connects to the mysql DB
//***change username and password below***

$MZrandompic = @mysql_connect('localhost''root''1234567'); //***YOU MUST CHANGE THIS***

if (!$MZrandompic) {
echo( 
'<p>Unable to connect to the ' .
'database server at this time.</p>' );
exit();
}

//select photo DB
//***YOU MUST CHANGE THIS***

if (! @mysql_select_db('coppermine') ) {
die( 
'<p>Unable to locate the picture ' .
'database at this time.</p>' );
}

//This gets a random picture record from the database and
//the picture's location and displays it

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,4");
if (!
$MZresult) {
die(
'<p>Error performing query: ' mysql_error() .
'</p>');
}

while ( 
$MZrow mysql_fetch_array($MZresult) ) {

// $albumid = $MZrow['aid'];  //This gets the picture's associated album name
$pos $MZrow['pid'];      //This finds the picture's coppermine location

echo('<P ALIGN=center>');

echo(
'<a target = "_new" href="' $copperminepath '/displayimage.php?album=' $albumid .
'&pos=-' $pos '">'); //make thumbnail clickable

echo('<IMG SRC="' $copperminepath '/albums/');           //append base dir structure
echo($MZrow['filepath'].thumb_.$MZrow['filename'] .
     
'" alt=' $MZrow['filename'] . ' ''border=0 width=80 height=50>' '</a>'); //outputs path from /userspics
}

//This displays the picture's album name and
//links it to the coppermine album

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");
if (!
$MZalbumresult) {
die(
'<p>Error performing query: ' mysql_error() .
'</p>');
}

while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) {
echo(
'<FONT SIZE=1>');
echo(
'<P ALIGN=center>');

echo(
'<a href="' $copperminepath .
'/thumbnails.php?album=' $albumid '">' .
$MZalbumname['title'] . '</a>' '</p>');
}

if (! @
mysql_select_db('coppermine') ) {
die( 
'<p>Unable to reload the main website ' .
'database at this time.</p>' );
}

?>


but I dont know how to create a block to call it to see if it actually works...

i know how to create a block... and i know how to call the script:

Code: [Select]
<? include("thescript.php") ?>

but i dont know how to put 2 and 2 together so that it works....i've tried different ways of geting it to work, but all has failed.

please help, i would really appreciate it :)

thanks,
ed
Logged
Pages: [1]   Go Up
 

Page created in 0.028 seconds with 20 queries.