Hello..!! Three days now I am trying to make block-random-pictures.php to run without errors but without luck.. I have a standalone installation of Coppermine 1.3.2 in my site
http://www.nuked.gr/cpg132/ and I want to display radom pictures from the Gallery to my main page (phpnuke based) on
http://www.nuked.grI modified block-random-pic.php to include the load.init from the cpg132 standalone installation but now I am getting the error :
Parse error: parse error, unexpected T_STRING in /home/jnukedag/public_html/blocks/block-Random_pictures.php on line 55The code I try to make it work (I LOAD IT AS A BLOCK FROM THE ADMINISTRATOR BLOCK PAGE) is the following :
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/*
http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/* Block to fit perfectly in the center of the site, remember that not all
blocks looks good on Center, just try and see yourself what fits your needs */
if (eregi("block-Random_pictures.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
require('/home/nuked/public_html/cpg132/include/init.inc.php');
$numberpic=5; // you can change the number of pictures here
global $prefix, $dbi;
function truncate_string444($str)
{
$maxlength = 20; // maximum lenght of name in block
if (strlen($str) > $maxlength)
return substr($str, 0, $maxlength)." ...";
else
return $str;
}
$content="<center>";
$result = sql_query("SELECT count(*) from cpg_pictures", $dbi);
$nbEnr = mysql_fetch_array($result);
$count = $nbEnr[0];
while ($stop<$numberpic)
{
srand(time()+$stop);
$random_number = rand(0, $count-1);
$result2 = sql_query("SELECT pid, aid, filepath, filename from cpg_pictures WHERE approved='YES' LIMIT $random_number,1", $dbi);
$picture = mysql_fetch_array($result2);
$img = "<img src=\"{$picture['filepath']}thumb_{$picture['filename']}\" border=\"0\">";
$content .= "<a href=\"
http://www.nuked.gr/cpg132/displayimage.php&album=random&cat=&pos=-{$picture['pid']}\">$img<br>" . truncate_string444($picture['filename']) . "</a><br><br>";
$stop++;
}
?>
ANY HELP WILL BE MUCH MUCH APPRECIATED..!! Thanks a lot !