if (!empty($_GET['idPost'])) {
    $idPost = mysql_real_escape_string($_GET['idPost']);
    // Bring back the post for editting
    $query = "SELECT idPost, title, userId, summary, postFor, summary_img, body, tags, date_pub, date, imgs FROM posts WHERE idPost = {$idPost}";
    $result = mysql_query($query, $dbConn);
    $row = mysql_fetch_assoc($result);
    // Make sure the user who wants to edit is the post original editor
    if ($row['userId'] != $arrUser['idUser']) {
        go_home();
    }
    // Put the data in single vars
    //$idPost=$row['idPost']; $title=$row['title']; $body=$row['body']; $date=$row['date']; $date_pub=$row['date_pub']; $summary=$row['summary'];
    //$summary_img=$row['summary_img']; $tags=$row['tags']; $body=$row['body']; $userId=$row['userId']; $imgs=$row['imgs'];
    extract($row);
    // Where are the images of this post stored?
    $dirImgs = date2dateDir($date);
    $arrImgs = glob('../data/images/posts/' . $dirImgs . '/{' . $imgs . '*.jpg}', GLOB_BRACE);
    unset($query, $result, $row);
} else {
    // SETTING THE IMAGE (YEARMONTH) DIR AND THE IMAGES PREFIX
    if (!empty($_GET['dirImgs']) && !empty($_GET['imgs'])) {
        $dirImgs = $_GET['dirImgs'];
        $imgs = $_GET['imgs'];
        $arrImgs = glob('../data/images/posts/' . $dirImgs . '/{' . $imgs . '*.jpg}', GLOB_BRACE);
    } elseif (!empty($_POST['dirImgs']) && !empty($_POST['imgs'])) {
        $dirImgs = $_POST['dirImgs'];
        $imgs = $_POST['imgs'];
        $arrImgs = glob('../data/images/posts/' . $dirImgs . '/{' . $imgs . '*.jpg}', GLOB_BRACE);
    } else {
        $dirImgs = date('Ym');
        $imgs = time();
            $get_info = 'Your new post has been added.';
            break;
        case 'ready':
            $get_info = 'Your post has ben marked as ready. An admin will check and publish the post. Be patient...';
            break;
    }
}
// DELETE
if (!empty($_GET['del'])) {
    $del = mysql_real_escape_string($_GET['del']);
    // Where are the images of the post?
    $query = "SELECT date, imgs FROM prePosts WHERE idPost = '{$del}'";
    $result = mysql_query($query, $dbConn);
    $row = mysql_fetch_assoc($result);
    $imgs = $row['imgs'];
    $dirImgs = date2dateDir($row['date']);
    unset($query, $result, $row);
    // ... got it! Then delete the images...
    $path = "../data/images/posts/{$dirImgs}";
    $images = glob($path . '/{' . $imgs . '*.jpg}', GLOB_BRACE);
    foreach ($images as $image) {
        @unlink($image);
    }
    // ... and the post on database
    $query = "DELETE FROM prePosts WHERE idPost = {$_GET['del']}";
    $result = mysql_query($query, $dbConn);
    unset($query, $result);
    //... and the comments (poor users...)
    $query = "DELETE FROM comments WHERE postId = {$_GET['del']}";
    $result = mysql_query($query, $dbConn);
    unset($query, $result);