Ejemplo n.º 1
0
 case 'sharelogtodatabase':
     if (isset($_POST['url']) && isset($_POST['title']) && isset($_POST['message'])) {
         $user->addShare($_POST['url'], $_POST['title'], $_POST['message']);
         header('Content-type: application/json');
         echo json_encode(array("responce" => "Successfully shared.", "new_status" => "Successfully shared."));
     } else {
         header("HTTP/1.0 406 Not Found");
     }
     break;
 case 'getusercredentials':
     header('Content-type: application/json');
     echo json_encode($user->getUserCredentials());
     break;
 case 'deleteusershare':
     if (isset($_GET['id'])) {
         if ($user->deleteShare($_GET['id'])) {
             header('Content-type: application/json');
         } else {
             header("HTTP/1.0 404 Not Found");
         }
     } else {
         header("HTTP/1.0 406 Not Found");
     }
     break;
 case 'followertodatabase':
     $followerid = $_GET['follower'];
     $follow = $_GET['follow'];
     header('Content-type: application/json');
     if ($follow == "Follow") {
         $user->addFollower($followerid);
         echo json_encode(array("responce" => "Added follower", "new_status" => "following"));