All pastes #277254 Raw Edit

Untitled

public text v1 · immutable
·published 2006-12-13 01:25 UTC
rendered paste body
  dim out as string
  dim i as integer
  dim hasSlash as string
  dim g as folderItem
  
  //check for slash in uri
  if right(uri,1) <>"/" then hasSlash=nthfield(uri,"/",countFields(uri,"/"))+"/"
  
  //start of HTML
  out = "<html>"+endOfLine.windows+"<title>Listing for "+uri+"</title>"+endofLine.windows+"<body>"+_
      endOfLine.windows+"<h1>Listing for "+uri+"</h1>"+endOfLine.windows+_
      "<table cellspacing=""20"">"+endOfLine.windows+"<tr><th>Name</th><th>Size</th></tr>"+endofLine.windows+_
      "<tr><td><a href="""+ hasSlash +".."">Parent Directory</a></td></tr>"+endofLine.windows
  
  //add all items in folder to table
  for i=0 to f.count
    g=f.item(i)
    if g.directory then
      out=out+"<tr><td><a href="""+hasSlash+g.name+"/"">"+g.name+"/</a></td></tr>"_
          +endOfLine.windows
    else
      out=out+"<tr><td><a href="""+hasSlash+g.name+""">"+g.name+"</a></td><td>"_
          +str(g.length)+"</td></tr>"+endOfLine.windows
    end if
  next
  
  //close out html
  out=out+"</table>"+endOfLine.windows+"<h2>Jdisoft WebServer 0.6</h2>"_
      +endOfLine.windows+"</body>"+endOfLine.windows+"</html>"
  
  
  sendFile=false
  return out