<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<title>Moja strona WWW</title>
</head>
<body>
<div>
<?php
if(!($fd = fopen("links.txt", "r"))){
  echo "Lista odnośników jest w tej chwili niedostępna.";
}
else{
  echo "<ul>\n";
  while (!feof ($fd)){
    $line = trim(fgets($fd));
    if(!($pos = strpos($line, ' '))){
      $link = $line;
      $desc = $line;
    }
    else{
      $link = substr($line, 0, $pos);
      $desc = substr($line, $pos + 1);
    }
    if($link != "" && $desc != ""){
      echo "<li><a href=\"$link\">$desc</a></li>\n";
    }
  }
  fclose($fd);
  echo "</ul>\n";
}
?>
</div>
</body>
</html>
