<?

include '../../config.php';
include '../../func.php';
head();

if ( $_GET['mod'] == 'delete' ) {
    
    $id = num($_GET['id']);
    
    $result = mysql_query("DELETE FROM fo_bad WHERE `id` = '".$id."'");
    
    if ( $result != NULL ) {
        
        echo link1 . 'Жалоба успешно удалена' . div;
        
    } else {
        
        echo link1 . 'Возникла ошибка' . div;
        
    }
    
}

$all_bad = mysql_result(mysql_query("SELECT count(*) FROM `fo_bad`"), 0);

if ( $all_bad > 0 ) {
    
$result = mysql_query("SELECT * FROM fo_bad");
while($bad = mysql_fetch_assoc($result)){
    
    $file = mysql_fetch_assoc(mysql_query("SELECT * FROM `fo` WHERE `id` = '".$bad['file']."'"));
    echo link1 . 'Файл: '.$file['name'] . div . link2 . $bad['msg'] . '<br/ ><br/ ><a href="../../obmen/view.php?id='.$file['id'].'">К файлу</a> | <a href="../../profile.php?id='.$bad['user'].'">В анкету</a><br/ >';

    echo '<br/ ><a href="bad.php?mod=delete&id='.$bad['id'].'">Удалить жалобу</a>' . div;
}

} else {
    
    echo link2 . 'Жалоб нет' . div;
    
}


###########


echo link2 . ' Жалоб '.$all_bad . div;