<?
echo "Group : <a href=gal.php>2D</a>,";
echo "<a href=gal.php?group=cr&tot=2&page=1&amt=3>3D</a>";
# because se-ed.net hide the $DOCUMENT_ROOT
if ($DOCUMENT_ROOT) { echo ", <a href=gal.php?group=total>Total</a><br>"; }
if ($group == "total") {
switch ($DOCUMENT_ROOT) {
case "/home/httpd/html":
$dir="$DOCUMENT_ROOT"."/thaiall/phpgallery";
break;
case "/web/sites/109/perlphpasp/www.perlphpasp.f2s.com":
$dir="$DOCUMENT_ROOT"."/bookphp/phpgallery";
break;
}
$dir_handle = opendir($dir);
while ($list = readdir($dir_handle)) {
if (strtolower(substr($list,-5)) == "t.jpg") {
echo "<a href=".substr($list,0,4).".jpg><img src=$list></a>";
echo " Date: ".date("F d, Y",fileatime("$list"));
echo " Size: ".filesize("$list")." byte<br>";
}
}
exit;
}
if (!$group) { $group="tg"; $tot=10; $page=1; $amt=3;}
echo "<hr>";
$first=$amt*($page-1)+1;
$last=$amt*$page;
if ($last >$tot) {$last = $tot;}
for ($i=$first;$i<=$last;$i++) {
printf("<a href=$group%02.0f.jpg><img src=$group%02.0ft.jpg></a> ",$i,$i);
printf("$group%02.0f.jpg<br>",$i);
}
$tpage = round($tot / $amt);
if (($tot / $amt) > $tpage) { $tpage++; }
echo "Page: ";
for ($i=1;$i<=$tpage;$i++) {
echo "<a href=gal.php?group=$group&tot=$tot&page=$i&amt=$amt>$i</a>, ";
}
?>
จำนวน : 40 บรรทัด