PHP Free For All Links

Free For All Links

<HTML><HEAD><TITLE>Free Hosting</TITLE></HEAD>
<STYLE>
:link { COLOR: black; TEXT-DECORATION: bold; }
:visited { COLOR: black; TEXT-DECORATION: bold; }
A:hover { COLOR: gray; }
ul, td, font { width:23%px; padding:3px; font-family:Verdana; font-size:11px; }
</STYLE>
<?
$file = "db.txt";

$a = file($file);
$b = count(file($file));
$i = "0";

echo "
<TABLE align=center cellPadding=0 cellSpacing=0 bgColor=#556277 width=700><TR><TD>
<FONT color=white size=1><B>:. Links</B>
<TR bgcolor=#e1e1e1><TD><ul>
";

while($b != $i) {
  $str = stripslashes($a[$i]);
  $str = eregi_replace("<", "&lt;", $str);
  $str = eregi_replace(">", "&gt;", $str);
  $c = explode("|", $str);
  echo "&nbsp;-&#8250; <A href='$c[0]'>$c[0]</B></A> - $c[1]</li><BR><BR>";
  $i++;
}
echo "</ul></TABLE></HTML>";


if (isset($_POST['submit'])) {

  extract($_POST);

  if (isset($url) && isset($desc) && $url != "" && $desc != "") {
    $file = "db.txt";

    if (is_file($file)) {
      $a = file($file);
      $b = count(file($file));
      $i = "0";
        while($b != $i) {
          $c = explode("|", $a[$i]);
          if (strtoupper($url) == strtoupper($c[0])) { $rez = "true"; }
        $i++;
      }
      if (isset($rez)) { echo "This url <B>$c[0]</B> is already registered."; }
      else {
        $open = fopen($file,'a');
        fwrite($open, "$url|$desc\n");
        fclose($open);
        echo "<FONT><center><P>Posted: <B>$url</B> <A href=?>Back</A>";
      }
    }
  }
  else { echo "Missing information!"; }
}
else {
  echo "<center>
  <form name=data action=? method=post>
  <TABLE border=0 cellPadding=2 cellSpacing=1>
  <TR><TD align=right><FONT>URL:</FONT></TD>
  <TD><input type=textbox name=url size=25>
  <TR><TD align=right valign=top><FONT>Description:</FONT></TD>
  <TD><input name=desc type=textbox size=25>
  <TR><TD>&nbsp;</TD><TD><input type=submit name=submit value=Submit></form>
  </TABLE></form>";
}
?>