All pastes #422558 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-04-03 15:18 UTC
rendered paste body
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x                                              html1/DTD/xhtml1-strict.dtd"><html><head> <title>Zycomm file repository</title> <link rel="shortcut icon" href="http://ftp.zycomm.co.uk/res/z.gif" /> <link rel="stylesheet" href="http://ftp.zycomm.co.uk/res/style.css" type="text/css" media="screen" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-language" content="en-gb" /> <meta http-equiv="imagetoolbar" content="false" /> <meta name="author" content="James Fletcher" /> <meta name="copyright" content="Zycomm Electronics LTD." /> <meta name="mssmarttagspreventparsing" content="true" /> <meta name="robots" content="index, follow, noarchive" /> <meta name="revisit-after" content="7 days" /></head><body><div id="header"><h1>Zycomm file repository</h1></div> <br /><div id="main"><?php$dir=urldecode($_SERVER['REQUEST_URI']);//do not even ask me about the following line. it even takes me ages to remember what it does.$folder=str_ireplace(substr(substr($dir,0,strrpos($dir,'/')),0,strrpos(substr($dir,0,strrpos($dir,'/')),'/')),'',$dir);echo"<p>files in: </p><p>".$folder."</p>\n";echo"<ul>\n";if($dir!=='/'){ $str=substr(substr($dir,0,strrpos($dir,'/')),0,strrpos(substr($dir,0,strrpos($dir,'/')),'/')); /*headache*/ echo"<li class=\"back\"><a href=\"http://ftp.zycomm.co.uk".$str."/\">back</li>\n"; echo"<br />\n";}else{ echo"<li class=\"root\">base</li>\n"; echo "<br />\n";}$dir=dir('/usr/home/zycomm-users/engineers'.$dir);while(false!==($entry=$dir->read())){ if($entry!=='.'&&$entry!=='..'&&$entry!=='index.php'&&$entry!=='res'&&$entry!=='highlight.php'){  $class=pathinfo($entry);  $class=$class['extension'];  $cwd=getcwd();  $cwd=substr($cwd,1);  if(is_dir(substr(urldecode($_SERVER['REQUEST_URI']).$entry,1))){   $class='folder';  }  if($_SERVER['REQUEST_URI']=='/'){   $file=$entry;  }else{   $file=urlencode($_SERVER['REQUEST_URI'].$entry);  }    if($class=='folder'){   echo"<li class=\"".$class."\"><a href=\"".urlencode($entry)."/\">".$entry."</li>\n";  }else{   echo"<li class=\"".$class."\"><a href=\"http://ftp.zycomm.co.uk/".urldecode($_SERVER['REQUEST_URI']).$entry."\">".$entry."</li>\n";  } }}?></ul></div></body></html>