I have an asp and then think paraphrastic php. but do not know how to write just good? that expert hand come and help me once!

friend from Taiwan

<%
mydir = request("dir")
if mydir = "" then mydir = "."
i = InStrRev(mydir,"/") - 1
if i <= 0 then
uplevel = "."
else
uplevel = left(mydir,i)
end if
realpath = server.mappath(mydir)
set f=CreateObject("scripting.filesystemobject")
set fo=f.getfolder(realpath)
set fc=fo.subfolders
set fl=fo.files
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title></title>
<style fprolloverstyle>A:hover {color: #FF0000}
</style>
</head>
<body bgcolor=#f0ffe8 style="font-size: 9pt">
<h1 align="center"><font color="#008000"></font></h1>
<table width="100%"><tr><td>
<div style="font-size:9pt" align=right>

</div>
</table>
<center>目前所在位置:<%=mydir%></center>
<hr width="90%" color="#FF0000">
<%
if f.FileExists(realpath & "\message.htm") then
set mf = f.OpenTextFile(realpath & "\message.htm")
messages = mf.ReadAll
mf.Close
response.write messages & "<hr width=90% color=#FF0000>"
end if
%>
<center><table border=0>
<%
i=0
for each f1 in fc
if left(f1.name,1) <> "_" and f1.name<>"manager" then
i=i+1
response.write("<td style='font-size:9pt' align=center width=75><a href='manager.asp?dir=" & mydir & "/" & f1.name & "' onmouseover=document.all['dir" & i & "'].src='manager/folder2.gif'; onmouseout=document.all['dir" & i & "'].src='manager/folder1.gif';><img id='dir" & i & "' src=manager/folder1.gif border=0><br>" & f1.name & "</a><br>" & chr(13))
if i mod 6 = 0 then
response.write("<tr>")
end if
end if
next
for each f1 in fl
extname = f.GetExtensionName(realpath & "/" & f1.Name)
i=i+1
if Ucase(extname)="ASP" or f1.Name="message.htm" then
i=i-1
elseif Ucase(extname)="MID" or Ucase(extname)="RMI" or Ucase(extname)="AU" or Ucase(extname)="WAV" then
response.write("<td style=font-size:9pt align=center width=75><a href=" & mydir & "/" & f1.name & ">" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br><embed src=" & mydir & "/" & f1.name & " autostart=false loop=false width=75 height=20><br>" & chr(13))
elseif Ucase(extname)="GIF" or Ucase(extname)="JPG" or Ucase(extname)="JPEG" or Ucase(extname)="PNG" then
if instr(mydir,"包子")>0 or f1.size<1024 then
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=" & mydir & "/" & f1.name & " border=0><br>" & f1.name & "</a><br>" & int(f1.size*100/1024)/100 & "K<br>" & chr(13))
else
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=" & mydir & "/" & f1.name & " border=0 width=64><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
end if
elseif Ucase(extname)="HTML" or Ucase(extname)="HTM" then
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=manager/html.gif border=0><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
elseif Ucase(extname)="DOC" then
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=manager/word.gif border=0><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
elseif Ucase(extname)="TXT" then
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=manager/text.gif border=0><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
elseif Ucase(extname)="EXE" or Ucase(extname)="COM" then
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=manager/exe.gif border=0><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
elseif Ucase(extname)="ZIP" or Ucase(extname)="TAR" or Ucase(extname)="GZ" or Ucase(extname)="LHA" then
response.write("<td style='font-size:9pt' align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=manager/zip.gif border=0><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
else
response.write("<td style=font-size:9pt align=center width=75><a href=" & mydir & "/" & f1.name & "><img src=manager/other.gif border=0><br>" & f1.name & "</a><br>" & int(f1.size/1024) & "K<br>" & chr(13))
end if
if i mod 6 = 0 then
response.write("<tr>")
end if
next
%>
</table></div>
<hr width="90%" color="#FF0000">
<% if mydir = "." then %>
<center><a href="../"><img src=manager/uplevel.gif border=0>回上一頁</a></center>
<% else %>
<center><a href="manager.asp?dir=."><img src=manager/menu.gif border=0>回目錄</a> <a href="manager.asp?dir=<% =uplevel %>"><img src=manager/uplevel.gif border=0>回上一頁</a></center>
<% end if %>
</body>
</html>