<?php
include ("inc/inc_common.php");
include ("inc/inc_connect.php");
include ("inc/inc_admincheck.php");

if ($cAdminLevel < 3)
{
    //kick out non-moderators...
    header("Location: topics.php?groupid=$groupid");
    exit;
}

if ($undelete == 1)
{
    //unhide...
    $query = "UPDATE $forumtable SET intPostHidden = '0', strHider = '$gfcookie[1]' WHERE intTopicId = '$delid'";
    mysql_query( $query, $link ) or die ( "Error! : ".mysql_error() );
    header("Location: topics.php?groupid=$groupid");
    exit;
}


if ($softdelete == 1)
{
    //hide from non-moderators...
    $query = "UPDATE $forumtable SET intPostHidden = '1', strHider = '$gfcookie[1]' WHERE intTopicId = '$delid'";
    mysql_query( $query, $link ) or die ( "Error! : ".mysql_error() );

}
else
{
    //or delete entirely
    $query = "DELETE FROM $forumtable WHERE intTopicId = '$delid'";
    mysql_query( $query, $link ) or die ( "Could not delete from \"$forumtable\" table: ".mysql_error() );
}


//delete one from the number of replies this topic has...

header("Location: topics.php?groupid=$groupid");
exit;
