Location: PHPKode > scripts > Linker IMG > linker-img/manage/checknum.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : checknum.php
// Path  : Manage directory
// last update : 2002/03/13
// Desc : number  check
//=====================================

//=====================================
// File include part
//=====================================

include ("./authen.php");
include ("../function/$Sdb_type.php"); 
include ("../function/main_func.php"); 
include ("../$Slang/m_common.php"); 


//=====================================
// Print select form 
//=====================================

if (!$switch) {

print <<<EOF

<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>

<body bgcolor="#E9E9E9">
<form action="checknum.php" method="post">
<input type="hidden" name="switch" value="check">
<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td>

	<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
	<b><font color="white" size="2">$l_etcfunc_num</font></b>
	</td></tr></table>

</td>	</tr>

<tr><td>&nbsp;</td></tr>

<tr><td width=500 align=center bgcolor='#E0E0E0' height=24>
<font size=2>$l_checknum_head</font></td>
</tr>

<tr><td  bgcolor='#F6F6F6' height='24'>
<font size=2>&nbsp;<input type="checkbox" name="check_catlink" checked> $l_cat / $l_link </td></tr>

<tr><td  bgcolor='#F6F6F6' height='24'>
<font size=2>&nbsp;<input type="checkbox" name="check_com"> $l_comment</font></td></tr>


<tr><td align=center bgcolor='#E0E0E0'><input type="submit" value="$l_etcfunc_num" class=cinput></td></tr>

</table>
</form>

EOF;
exit;
}

//=====================================
// Arrange category / link /comment
//=====================================

print <<<EOF

<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>

<body bgcolor="#E9E9E9">
<form action='./del_link.php' method='post' name='myform'>

<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

	<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
	<b><font color="white" size="2">$l_etcfunc_num</font></b>
	</td></tr></table>

</td>	</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>
</table>
 
EOF;

for ($i=0; $i<100; $i++) { echo ("    ");  flush();} 


$db1 = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);
$db2 = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);


//=====================================
// Arrange category / link number
//=====================================

$start_time = time();

if ($check_catlink) 
{
	$db1->query("select sid,path,pathtxt from LINKER_CAT order by pathtxt");

	while ($row = $db1->nrecord()) 
	{
		// Category num
		$db2->query("select count(*) as ctotal from LINKER_CAT where parent='$row[sid]'");
		$crow = $db2->nrecord();
		// Link
		$db2->query("select count(*) as ltotal from LINKER_LINK where parent='$row[sid]'");
		$lrow = $db2->nrecord();
		// last uptime
		$temp_path = $row[path]."/";
		$db2->query("select max(uptime) as lutime from LINKER_LINK where parent='$row[sid]' or path like '$temp_path%'");
		$urow = $db2->nrecord();
		// update
		$db2->query("update LINKER_CAT SET sub_cat='$crow[ctotal]',sub_link='$lrow[ltotal]', bingo1='$urow[lutime]' where sid='$row[sid]'");
		$temp_patxtxt = str_replace($Ssepchar, $Sarrow , $row[pathtxt]) . " ($crow[ctotal] / $lrow[ltotal])";
		
		echo "
		<table border='0' cellpadding=0 cellspacing=1 width='500'>
		<tr><td height=23 bgcolor='#F6F6F6'>&nbsp;<font size=2>$temp_patxtxt</font></td></tr></table>
		";
		
		flush(); 
		usleep(5000);
		
	}

	echo "<table border='0' cellpadding=0 cellspacing=1 width='500'>
	<tr><td height=23 bgcolor='#E0E0E0'>&nbsp;<font size=2>$l_check_catlink</font></td></tr>
	<tr><td height=23>&nbsp;</td></tr>
	</table>
	";
	flush(); 
	usleep(5000);
		

}

//=====================================
// Arrange comment number
//=====================================

if ($check_com) 
{


	$db1->query("select sid,title from LINKER_LINK order by pathtxt");

	while ($row = $db1->nrecord()) 
	{

		$db2->query("select count(*) as mtotal from LINKER_COM where parent='$row[sid]' ");
		$mrow = $db2->nrecord();
		$db2->query("update LINKER_LINK SET comment = '$mrow[mtotal]' where sid='$row[sid]'");
	
		echo "
		<table border='0' cellpadding=0 cellspacing=1 width='500'>
		<tr><td height=23 bgcolor='#F6F6F6'>&nbsp;<font size=2>$row[title] ($mrow[mtotal])</font></td></tr></table>
		";
		
		flush(); 
		usleep(5000);

	}

	echo "
	<table border='0' cellpadding=0 cellspacing=1 width='500' >
	<tr>
	<td bgcolor='#E0E0E0' height='24'><font size='2'>&nbsp; $l_check_com</font></td>
	</tr></table>
	";
}

//=====================================
// Print Result
//=====================================


$last_time=time();
$spend_time = $last_time-$start_time;

echo "
<table border='0' cellpadding=0 cellspacing=1 width='500' >
<tr>
<td bgcolor='#E0E0E0'  height='24'><font size='2'>&nbsp; $l_esttime : $spend_time $l_sec</font></td></tr>
</table>
</form><br><br>
</body></html>
";

?>
Return current item: Linker IMG