loadTemplatefile('index.php', true, true); $fortune = shell_exec('/usr/games/fortune warhammer'); $tpl->setVariable('fortune', $fortune); if (DB::isError($dbh)) { die ($dbh->getMessage()); } $sql2 = "select b.bookmarkid, b.name, b.url, b.hits, avg(s.status) as avail ". "from bookmark as b left outer join urltrace as s ". "on b.bookmarkid = s.bookmarkid where sectionid='38' ". "group by b.bookmarkid order by b.hits desc"; $result2 = $dbh->query($sql2); if (!DB::isError($result2)) { $tpl->setCurrentBlock('link'); while ($object2 = $result2->fetchRow(DB_FETCHMODE_ASSOC)) { $tpl->setVariable(array('linkname' => htmlentities($object2{'name'}),'linktarget' => $object2{'url'} , 'linkid' => $object2{'bookmarkid'}) ); $tpl->setVariable('avail', ($object2{'avail'}/2)); $tpl->setVariable('hits', ($object2{'hits'})); $tpl->setVariable('url',($object2{'url'})); if ($object2{'avail'}<50) { $tpl->setVariable(array('avail2'=> 'low', 'height'=>14)); } else {$tpl->setVariable(array('avail2'=> 'high', 'height'=>16));} $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock('section'); $tpl->setVariable('sectionname', htmlentities($object{'name'})); $tpl->setVariable('sectionid', $object{'sectionid'}); $tpl->setVariable('sectionhits', $object{'totalhits'}); $tpl->parseCurrentBlock(); $tpl->setVariable('errstr',""); $tpl->show(); $dbh->disconnect(); ?>