コード例 #1
0
ファイル: index.php プロジェクト: jonbeckett/wetheusers
             break;
         case "edit":
             $result = post_edit();
             if ($result > -1) {
                 header("Location: /post/" . $result);
             } else {
                 header("Location: /post/edit/" . $_POST["id"] . "/failure");
             }
             break;
         case "like":
             $result = post_like($url_parts[4]);
             header('Content-Type: application/json');
             print json_encode($result);
             break;
         case "unlike":
             $result = post_unlike($url_parts[4]);
             header('Content-Type: application/json');
             print json_encode($result);
             break;
         case "delete":
             $result = post_delete($url_parts[4]);
             header("Location: /" . $_SESSION["user_name"]);
             break;
     }
     break;
     // post
 // post
 case "comment":
     require_once "lib/api/comments.php";
     require_once "lib/api/likes.php";
     switch ($url_parts[3]) {
コード例 #2
0
<?php

include "config/config.php";
include "admin/include/function.php";
if (isset($_GET["like"])) {
    if (!post_like_check($_GET["from"], $_GET["to"])) {
        add_post_like($_GET["from"], $_GET["to"]);
        echo count_post_like($_GET["to"]);
    } else {
        echo "no";
    }
}
if (isset($_GET["unlike"])) {
    post_unlike($_GET["from"], $_GET["to"]);
    echo count_post_like($_GET["to"]);
}