function delAll() { $photoFileOP = new sysFilesOperations(); $photoFileOP->setRquery("SELECT * FROM amistiTemp WHERE userID=?", array($_SESSION['userID'])); $fdel = $photoFileOP->getRquery(); if (count($fdel) > 0) { // check if exists file in the Temp folder or DB for ($x = 0; $x < count($fdel); $x++) { $photoFileOP->fileDelete($fdel[$x]['tempBigPath']); //remove the file $photoFileOP->fileDelete($fdel[$x]['tempSmallPath']); //remove the file } $photoFileOP->setRquery("DELETE FROM amistiTemp WHERE userID=?", array($_SESSION['userID'])); //delete the file from temptable } }
$res = json_encode($res); //echo $res; echo "passed"; } } } else { $res = ["eType" => 1, "data" => $fname]; $res = json_encode($res); //echo $res; echo "failed.."; } } //--------DELETE ALL IF USER DID NOT SAVE/POST THE POST if ($_GET['del'] == true) { $fOp->setRquery("SELECT * FROM amistiTemp WHERE userID=?", array($_SESSION['userID'])); $gRes = $fOp->getRquery(); if (count($gRes) > 0) { for ($x = 0; $x < count($gRes); $x++) { unlink($gRes[$x]['tempBigPath']); unlink($gRes[$x]['tempSmallPath']); } if ($fOp->setRquery("DELETE FROM amistiTemp WHERE userID=?", array($_SESSION['userID']))) { echo true; } } } //------DELETE PIC IF THE USER WANNA DELETE A PIC if ($_GET['delOne'] == true) { $delID = str_replace("dDel_", "", $_GET['delID']); $fOp->setRquery("SELECT * FROM amistiTemp WHERE userID=? AND tempID=?", array($_SESSION['userID'], $delID)); $gRes = $fOp->getRquery();
function getPostID($i) { $photoFileOP = new sysFilesOperations(); $id = $i; //GET THE OBJECT ID $photoFileOP->setRquery("SELECT * FROM amistiPic WHERE picID=?", array($id)); $idRes = $photoFileOP->getRquery(); //check ID if (count($idRes) > 0) { $id = $idRes[0]['postID']; } return $id; }