File : index.php. ID : 2001
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Frame
<body>
<a href=putpic.php>Upload New Sticker or manage it</a>
<hr>
<?
$picsort = array();
$s = 1;
$dir=".";  
$dir_handle = opendir($dir);
while ($list = readdir($dir_handle)) {  
  $l4 = strtolower(substr($list,-4));
  if ($l4 == ".jpg" or $l4 == ".gif") { 
    echo "<table><td><img src=$list></td><td valign=top><font size=6>"; 
    # hypermart.net deny split command but f2s.com ok for split(".",$list)
    $fn = preg_split ("/[.]/",$list);  	
    $f = $fn[0].".txt";
    if (file_exists($f)) {
      $ar = file("$f");  $cnt = count($ar);
      $picsort["$f"] = "$cnt";  
    } else { $cnt = 0; }
	echo "$s : $list Total vote : $cnt</font>";
    echo "<form action=puttxt.php>";
    echo "<input type=hidden name=ftxt value=$fn[0]>";
    echo "<input name=opinion><input type=submit name=action value=put>";
    echo "<input type=submit name=action value=list>";
    echo "</form>";
    echo "<form action=putpic.php>";
    echo "<input type=hidden name=action value=del>";
    echo "<input type=hidden name=delfile value=$list>";
    echo "<input type=submit value=DeleteThisSticker>";
    echo "</form></td></table>";
    $s = $s + 1;
  }
}
#=====
# sort ($picsort); This is ok but the $key will lost.
asort ($picsort); 
reset ($picsort);
$picsort = array_reverse($picsort);
echo "<hr><ol>Result of Descending sorting";
while (list ($key, $val) = each ($picsort)) {
    echo "<li> $key = $val or $picsort[$key]"; 
    $i++;
}
echo "</ol>";
?>
</body>