. */ /** * @brief Script to return ajax result * * @author Alex ORLUC * @date $date$ * @version $Revision$ */ if(empty($_POST['contact_id'])){ echo "success"; } else { $db = new dbquery(); $db->connect(); if (is_numeric($_POST['contact_id'])) { $where = "contact_id = ".$_POST['contact_id']." AND creation_date >= (select CURRENT_DATE + integer '-".$_SESSION['check_days_before']."')"; $query = "SELECT res_id FROM res_view_letterbox WHERE ".$where; } else { $where = "(exp_user_id = '".$_POST['contact_id']."' OR dest_user_id = '".$_POST['contact_id']."') AND creation_date >= (select CURRENT_DATE + integer '-".$_SESSION['check_days_before']."')"; $query = "SELECT res_id FROM res_view_letterbox WHERE ".$where; } if($_POST['res_id'] != "none"){ $query .= " AND res_id NOT IN (".$_POST['res_id'].")"; $_SESSION['excludeId'] = $_POST['res_id']; } $query .= " ORDER by creation_date DESC limit 1"; $db->query($query); // $db->show(); if ($db->nb_result() > 0){ $_SESSION['where_from_contact_check'] = " AND (".$where.")"; echo "fail"; } else { echo "success"; } }