Example #1
0
                $results = addLike($data);
                break;
            case "DELETE":
                $results = deleteLike($data);
                break;
            default:
                $results["meta"] = methodNotAllowed($method, $path);
        }
        break;
    case "pictures":
        switch ($method) {
            case "POST":
                $results = addPicture($data);
                break;
            case "DELETE":
                $results = deletePicture($data);
                break;
            default:
                $results["meta"] = methodNotAllowed($method, $path);
        }
        break;
    default:
        $results["meta"]["ok"] = false;
        $results["meta"]["status"] = 404;
        $results["meta"]["feedback"] = "Unrecognised URI.";
        $results["meta"]["message"] = "Not Found";
}
//send back the data provided
$results['meta']["data"] = $data;
//send back the method requested
$results['meta']["method"] = $method;
Example #2
0
        $companyName = $_POST['company_name'];
        $location = $_POST['location'];
        $quizName = $xml->Configuration->Activity;
        $status = $_POST['status'];
        $rawScr = $_POST['rawScr'];
        $gameTime = $_POST['gameTime'];
        $passScr = $_POST['passScr'];
        $maxScr = $_POST['maxScr'];
        $minScr = $_POST['minScr'];
        $time = $_POST['null'];
        $jic = $_POST['jic'];
        $hashtag = hash('md5', "hashtag");
        $result = addResult($edate, $name, $email, $companyName, $location, $quizName, $userAns, $correctAns, $status, $rawScr, $gameTime, $passScr, $maxScr, $minScr, $time, $jic, $hashtag);
        echo $result;
    } elseif (isset($_POST['deletePicture'])) {
        deletePicture($_POST['deletePicture']);
    }
}
function logRatings($name, $email, $stars)
{
    include_once "database_class.php";
    $db = Database::getInstance();
    $log_ratings = $db->logRatings($name, $email, $stars);
    return $log_ratings;
}
function getRatings($email)
{
    include_once "database_class.php";
    $db = Database::getInstance();
    $get_ratings = $db->getRatings($email);
    return $get_ratings;
Example #3
0
 if ($option == "images") {
     foreach ($arrayId as $imageId) {
         deletePicture($imageId, $db, $access, $userId, 0);
     }
     echo json_encode(1);
 } else {
     if ($option == "imageset") {
         foreach ($arrayId as $imagesetId) {
             if (checkOwnerOfSet($imagesetId, $db, $userId) == 1 || $access == 1) {
                 $sql = "SELECT * FROM picture WHERE pictureSet = ?;";
                 $sth = $db->prepare($sql);
                 $sth->bindParam(1, $imagesetId);
                 $sth->execute();
                 $result = $sth->fetchAll();
                 foreach ($result as $image) {
                     deletePicture($image['id'], $db, $access, $userId, 1);
                 }
                 $sql = "DELETE FROM pictureset\n\t\t\t\t \t\tWHERE id = ?";
                 $sth = $db->prepare($sql);
                 $sth->bindParam(1, $imagesetId);
                 $sth->execute();
                 rmdir("../../uploads/" . $userId . "/" . $imagesetId);
                 $sql = "SELECT * FROM pictureset WHERE person = ?;";
                 $sth = $db->prepare($sql);
                 $sth->bindParam(1, $userId);
                 $sth->execute();
                 if ($sth->rowCount() == 0) {
                     rmdir("../../uploads/" . $userId);
                 }
                 echo json_encode(1);
             }