query("SELECT U_NICK, U_RIGHT FROM $rcom_user WHERE U_SESS = '".session_id()."'") as $row) { $u_nick = $row[0]; $u_right = $row[1]; } if($topic != ''){ if($u_right == 10){ $dbh = new PDO('mysql:host='.$DB_HOST.';dbname='.$DB_NAME.'', $DB_USER, $DB_PASS); $dbh->query("DELETE FROM $rcom_blog WHERE B_TOPIC = $topic"); $dbh->query("OPTIMIZE TABLE $rcom_blog"); header("Location: index.php"); $dbh = null; }else{ header("Location: index.php"); } } if($topic_com != ''){ if($u_right == 10){ $dbh = new PDO('mysql:host='.$DB_HOST.';dbname='.$DB_NAME.'', $DB_USER, $DB_PASS); foreach($dbh->query("SELECT C_TOPIC FROM $rcom_comment WHERE C_ID = $topic_com") as $row) { $C_TOPIC = $row[0]; } $dbh->query("DELETE FROM $rcom_comment WHERE C_ID = $topic_com"); $dbh->query("OPTIMIZE TABLE $rcom_comment"); foreach($dbh->query("Select COUNT(*) FROM $rcom_comment WHERE C_TOPIC = $C_TOPIC") as $row) { $B_COM = $row[0]; } $dbh->query("UPDATE $rcom_blog SET B_COM = '$B_COM' WHERE B_TOPIC = $C_TOPIC"); $dbh->query("OPTIMIZE TABLE $rcom_blog"); $dbh = null; header("Location: index.php?topic=$C_TOPIC"); }else{ header("Location: index.php"); } } ?>