<?
$sub_menu = "400800";
include_once("./_common.php");

auth_check($auth[$sub_menu], "r");

$token		= get_token();

$rs_tables	= sql_query("SHOW TABLES from $mysql_db");

$g4[title] = "MySQL Backup";
include_once("./admin.head.php");

$colspan = 6;
?>

<?=subtitle("DB 백업관리 : $mysql_db")?>
<form name=fboardlist method=post action="./zm.mysql_backup_process.php">
<input type="hidden" name="mode" value="bl_update">
<table width=100% cellpadding=0 cellspacing=1 border=0>
<colgroup width=10%>
<colgroup width=30%>
<colgroup width=10%>
<colgroup width=10%>
<colgroup width=30%>
<colgroup width=10%>
<tr><td colspan='<?=$colspan?>' class='line1'></td></tr>
<tr class='bgcol1 bold col1 ht center'>
    <td><input type=checkbox name=chkall value="1" onclick="check_all(this.form)"></td>
    <td>테이블</td>
    <td>레코드 수</td>
    <td></td>
    <td>테이블</td>
    <td>레코드 수</td>
</tr>
<? while($rd = mysql_fetch_row($rs_tables)) : 
	$reccnt	= 0;
	$reccnt	= mysql_fetch_array(mysql_query("select count(*) as rcnt from $rd[0]"));
?>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<tr class='list<?=$list?> col1 ht' onMouseOver="this.style.backgroundColor='#F6F8FA'" onMouseOut="this.style.backgroundColor=''">
<? for($sw_col = 0; $sw_col < 2; $sw_col++) : ?>
<?	if($sw_col == 0) : ?>
    <td align="center" height=25><input type=checkbox name=chk[] value="<?=$rd[0]?>"></td>
	<td><?=$rd[0]?></td>
	<td align="right"><?=number_format($reccnt[rcnt])?>&nbsp;&nbsp;</td>
<?	else:
	$rd = @mysql_fetch_row($rs_tables);
	$reccnt	= 0;
	$reccnt	= @mysql_fetch_array(mysql_query("select count(*) as rcnt from $rd[0]"));
?>
	<td align="center" height=25><input type=checkbox name=chk[] value="<?=$rd[0]?>"></td>
	<td><?=$rd[0]?></td>
	<td align="right"><?=number_format($reccnt[rcnt])?>&nbsp;&nbsp;</td>
<?	endif; ?>
<? endfor; ?>
</tr>
<? endwhile; ?>
 
<?
if ($i == 0)
    echo "<tr><td colspan='$colspan' align=center height=100 bgcolor=#ffffff>자료가 없습니다.</td></tr>"; 
?>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
</table>
<div>
	<input type="submit" value="선택 테이블 백업하기" class="btn1">
</div>
</form>

<script language="javascript">
function btn_chk(f, m) {
	var chk = document.getElementsByName("chk[]");

	f.mode.value = m;
	
	var sw = 0;
	for(i=0; i<chk.length; i++) {
		if(chk[i].checked) sw = 1;
	}
	if(!sw) { alert("선택 된 리스트가 없습니다."); return false; }

	f.action	= "./zm.report_process.php";
	f.submit();
}

function chkAlert(th, d) {
	var	s = "";

	if(d == "w") s = "글쓰기";
	if(d == "m") s = "쪽지발송";
	if(d == "f") s = "영구히";
	if(th.checked) alert(s+" 서비스를 제한 합니다.");
}

</script>

<?
include_once("./admin.tail.php");
?>
