$str="select system,sub from article where id='".$id."';";
$q=mysql_query($str);
$res=mysql_fetch_array($q);
$sub=$res['sub'];
$sysn=$res['system'];
$str="select count(*) from dirs where sub=0;";
$q2=mysql_query($str);
$res2=mysql_fetch_array($q2);
$nn1=$res2['count(*)'];
if ($nn1>0)
{
$str="select * from dirs where sub=0;";
$q2=mysql_query($str);
while ($res2=mysql_fetch_array($q2))
{
if ($res2['id']==$sub)
{
if ($sysn=='index')
{
?>
}
$str="select count(*) from article where sub='".$res2['id']."' and system<>'index';";
$q3=mysql_query($str);
$res3=mysql_fetch_array($q3);
$nn2=$res3['count(*)'];
if ($nn2>0)
{
$str="select * from article where sub='".$res2['id']."' and system<>'index';";
$q3=mysql_query($str);
while ($res3=mysql_fetch_array($q3))
{
if ($id==$res3['id'])
{
?>
}
}
}
$str="select count(*) from article where sub=0 and system<>'index';";
$q=mysql_query($str);
$res=mysql_fetch_array($q);
$nn=$res['count(*)'];
if ($nn>0)
{
$str="select * from article where sub=0 and system<>'index';";
$q=mysql_query($str);
while ($res=mysql_fetch_array($q))
{
if ($id==$res['id'])
{
?>