<?
include_once("_common.php");

if (!trim($bo_table)) exit;

if ($wr_id && $w != "r") {
    $sql = "select * from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$bf_no'";
    $row = sql_fetch($sql);

    @unlink(G4_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);

    $sql = "delete from {$g4['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$bf_no'";
    sql_query($sql);

} else {

	$sql = "select * from {$g4['amina_file']} where bo_table = '$bo_table' and bf_no = '$bf_no' and mb_id = '{$member['mb_id']}' and bf_ip = '{$_SERVER['REMOTE_ADDR']}'";
    $row = sql_fetch($sql);

    @unlink(G4_DATA_PATH.'/upload/'.$row['bf_file']);

    $sql = "delete from {$g4['amina_file']} where bo_table = '$bo_table' and bf_no = '$bf_no' and mb_id = '{$member['mb_id']}' and bf_ip = '{$_SERVER['REMOTE_ADDR']}'";
    sql_query($sql);
}
?>