<?php
$f=fopen("db.php","r");
$odb=explode("\r\n|\r\n",substr(fread($f,filesize("db.php")),16));
fclose($f);
$odbl=sizeof($odb);

for ($i=0;$i<$odbl;$i++) {
if ($i==0) $ft.="<h1>Hiragana:</h1>";
else $ft.="<h1>Katakana:</h1>";
$odb1=explode("\r\n_\r\n",$odb[$i]);
$odb1l=sizeof($odb1);
for ($ii=0;$ii<$odb1l;$ii++) {
$odb2=explode("\r\n",$odb1[$ii]);
$odb2l=sizeof($odb2);
for ($iii=0;$iii<$odb2l;$iii++) {
$cdp=$odb2[$iii];
if ($cdp!="-") {
$cdpa=substr($cdp,0,3);
$cdpb=substr($cdp,3);
$ft.="<div><div>".$cdpb."</div>&#12".$cdpa.";</div>";
}
else $ft.="<div class='none'></div>";
}
if ($ii+1<$odb1l) $ft.="\n<div class='nl'></div>\n";
}
if ($i+1<$odbl) $ft.="\n<div class='nls'></div>\n";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml">
<head>
<title>kanaviewer</title>
<style type='text/css'>
* {
  margin:0;
  padding:0;
  }

#box {
  background:#f5f5f5 url(logo.png) no-repeat 2px 4px;
  width:480px;
  height:400px;
  position:absolute;
  left:50%;
  top:50%;
  margin-left:-244px;
  margin-top:-228px;
  padding:50px 3px 3px 3px;
  border:1px solid #999;
  }

#box h1 {
  font:24px georgia;
  padding-left:5px;
  }

#box div {
  float:left;
  width:30px;
  height:30px;
  padding:5px;
  font-size:30px;
  cursor:default;
  position:relative;
  }

#box div div, #box div div:hover {
  position:absolute;
  top:-15px;
  left:2px;
  z-index:2;
  font:normal 12px arial;
  padding:1px 2px;
  border:1px solid #000;
  background:#ddd;
  width:auto;
  height:auto;
  float:none;
  display:none;
  }

#box div:hover {
  border:1px solid #000;
  padding:4px;
  background:#eee;
  }

#box div:hover div {
  display:block;
  }

#box div.nl, #box div.nls {
  float:none;
  width:0px;
  padding:5px 0;
  }

#box div.nls {
  height:52px;
  }

#box div.ls {
  width:0;
  height:0;
  }

#box div.nl:hover, #box div.nls:hover, #box div.none:hover {
  border:0;
  padding:5px;
  background:transparent;
  }
</style>
<script type='text/javascript'>

</script>
</head>
<body>
<div id='box'>
<?php echo $ft; ?>
</div>
</body>
</html>