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 } }
<?php if (!session_start()) { session_start(); } include "../aClass/sysFilesOperations.php"; include "../aClass/profileSettings.php"; $fOp = new sysFilesOperations(); define('MAINPATH', realpath($_SERVER["DOCUMENT_ROOT"]) . "/imgs/"); define('CAROUSEL', MAINPATH . $_SESSION['uName'] . "/carousel/"); define('BIMG', MAINPATH . $_SESSION['uName'] . "/BigImage/"); // function to delete temp function delTemp($delID = "") { if (empty($delID)) { $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; } } } else { $fOp->setRquery("SELECT * FROM amistiTemp WHERE userID=? AND tempID=?", array($_SESSION['userID'], $delID)); $gRes = $fOp->getRquery(); if (count($gRes) > 0) { for ($x = 0; $x < count($gRes); $x++) {
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; }