漏洞: 只需一行代码即可在Myalbum中生成随机图片
发表者: slyss 于 2008/5/11 18:20:00 9270次阅读大家好
我编写了一个函数,用于生成随机图片块(来自myalbum-p)。
您需要将其包含在:包含根目录下的functions.php
/****** hack by www.stefanosilvestrini.com *****/
function getPicGallery($myalbumNum, $cid, $random) {
global $xoopsConfig;
$db =& Database::getInstance();
$myalbumNum = trim($myalbumNum);
if($random != 1) $sql = "SELECT s.lid AS lid, s.ext AS ext FROM ".$db->prefix('myalbum'.$myalbumNum.'_photos')." s, ".$db->prefix('myalbum'.$myalbumNum.'_cat')." t WHERE s.cid = t.cid AND s.cid = ".$cid." ORDER BY s.lid DESC LIMIT 1";
else $sql = "SELECT s.lid AS lid, s.ext AS ext FROM ".$db->prefix('myalbum'.$myalbumNum.'_photos')." s, ".$db->prefix('myalbum'.$myalbumNum.'_cat')." t WHERE s.cid = t.cid AND s.cid = ".$cid." ORDER BY RAND() LIMIT 1";
$result = $db->query($sql);
$myrow = $db->fetchArray($result);
$object = ""
.".XOOPS_URL."/modules/myalbum".$myalbumNum."/photo.php?lid=".$myrow['lid']."'>"
.".XOOPS_URL."/uploads/thumbs".$myalbumNum."/".$myrow['lid'].".".$myrow['ext']."' align='center' hspace='3' vspace='3' width='100px' />"
.""
."
";
return $object;
}