Example #1
0
         if ($result > -1) {
             header("Location: /post/" . $result);
         } else {
             header("Location: /post/add/failure/" . $result);
         }
         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
Example #2
0
<?php

//Like or unlike post
require_once '../includes/functions.inc.php';
require_once '../includes/admin.inc.php';
if (isset($_POST['pid']) && isset($_SESSION['uid'])) {
    $pid = $_POST['pid'];
    $uid = $_SESSION['uid'];
    post_like($pid, $uid);
}