View file user/status/delete.php

File size: 823B
<?php
require( '../../sys/inc/core.php' );
if ( isset( $_GET['id'] ) && db::count("SELECT COUNT(*) FROM `status` WHERE `id` = '" . intval( $_GET['id'] ) . "'") == 1 ) {
    $post = db::fetch("SELECT * FROM `status` WHERE `id` = '" . intval( $_GET['id'] ) . "' LIMIT 1", ARRAY_A);
    $ank  = db::fetch("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1", ARRAY_A);
    if ( isset( $user ) && ( $user['level'] > $ank['level'] ) || $post['id_user'] == $user['id'] )
        db::query("DELETE FROM `status` WHERE `id` = '$post[id]'");
    db::query("DELETE FROM `status_komm` WHERE `id_status` = '$post[id]'");
    db::query("DELETE FROM `status_like` WHERE `id_status` = '$post[id]'");
    $_SESSION['message'] = 'Статус упешно удален';
    header( "Location: index.php?id=$ank[id]" );
    exit;
}
?>