コード例 #1
0
function validate_delete_observation()
{
    global $objObserver;
    $util = new Utils();
    $cometobservations = new CometObservations();
    if (!$_GET['observationid']) {
        unset($_SESSION['deepskylog_id']);
        header("Location:../index.php");
    } elseif ($_GET['observationid']) {
        // only admins may delete a comet observation
        $role = $objObserver->getObserverProperty($_SESSION['deepskylog_id'], 'role', 2);
        if ($role == RoleAdmin || $role == RoleCometAdmin) {
            $cometobservations->deleteObservation($_GET['observationid']);
            $_GET['indexAction'] = 'comets_all_observations';
        } else {
            unset($_SESSION['deepskylog_id']);
            header("Location: ../index.php");
            // back to entrance page
        }
    }
}