示例#1
0
 public function addLike($postId = -1)
 {
     $response['signed'] = false;
     $response['succeeded'] = false;
     $response['like'] = array();
     if (isset($_SESSION["user_id"]) && strlen(trim($_SESSION["user_id"])) > 0 && $postId != -1) {
         $response['signed'] = true;
         $response['like'] = addLike($_SESSION['user_id'], $postId);
         $response['succeeded'] = true;
     }
     echo json_encode($response);
 }
示例#2
0
 case "follows":
     switch ($method) {
         case "POST":
             $results = addFriend($data);
             break;
         case "DELETE":
             $results = deleteFriend($data);
             break;
         default:
             $results["meta"] = methodNotAllowed($method, $path);
     }
     break;
 case "likes":
     switch ($method) {
         case "POST":
             $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);
示例#3
0
         $sql = "SELECT * FROM AlbumTable WHERE UserID={$albumUserID}";
     }
     print getData($sql);
     break;
 case 'sendComment':
     if ($ifLogin == 1) {
         $cmt = $_POST['cmt'];
         $picID = $_POST['picID'];
         addComment($userID, $picID, $cmt, time());
     } else {
     }
     break;
 case 'addLike':
     if ($ifLogin == 1) {
         $picID = $_POST['picID'];
         addLike($userID, $picID, time());
     } else {
     }
     break;
 case 'uploadPic':
     if ($ifLogin == 1) {
         $picAlbumID = $_POST['upAlbumID'];
         $picAlbumName = $_POST['upAlbumName'];
         $sql = "SELECT * FROM AlbumTable WHERE AlbumID={$picAlbumID} AND UserID={$userID}";
         $res = exeSQL($sql);
         $row = mysql_fetch_array($res);
         if (empty($row)) {
             $sql = "SELECT AlbumID FROM AlbumTable WHERE UserID={$userID} AND AlbumName='Default'";
             $res = exeSQL($sql);
             $row = mysql_fetch_array($res);
             $_POST['upAlbumID'] = $row[0];
示例#4
0
function checkLikes($uid, $mid)
{
    $q = mysql_query("SELECT * FROM `Likes_Dislikes` where `uid` = '{$uid}' and `mid`='{$mid}'") or die(mysql_error());
    $row = mysql_fetch_assoc($q);
    $l = $row['likes'];
    $d = $row['dislikes'];
    if ($l == 1 && $d == 0) {
        removeLike($uid, $mid);
    } elseif ($l == 0 || $l == NULL) {
        addLike($uid, $mid);
    } elseif ($l == 0 && $d == 1) {
        removeDislike($uid, $mid);
        addLike($uid, $mid);
    }
}
示例#5
0
     // {
     //   like;
     //   unLike;
     //   userID;
     //   idMessage;
     // }
     try {
         if ($obj->like == _SET) {
             addLike('Likes', $obj->idMessage, $obj->userID);
         } else {
             if ($obj->like == _UNSET) {
                 delLike('Likes', $obj->idMessage, $obj->userID);
             }
         }
         if ($obj->unLike == _SET) {
             addLike('UnLikes', $obj->idMessage, $obj->userID);
         } else {
             if ($obj->unLike == _UNSET) {
                 delLike('UnLikes', $obj->idMessage, $obj->userID);
             }
         }
     } catch (Exception $e) {
         echo "Error: " . $e->getMessage();
         $error = true;
     }
     if (!isset($error)) {
         echo "OK";
     }
 } else {
     if ($command == 'cmRemoveAttach') {
         $uniqName = $_POST['str'];
示例#6
0
<?php

require_once "../include/config.php";
require_once $basedir . "/include/functions.php";
$private_key = $config['private_key'];
$hash = isset($_POST['hash']) ? $_POST['hash'] : 0;
$public_key = isset($_POST['public']) ? $_POST['public'] : 0;
$time = isset($_POST['t']) ? $_POST['t'] : 0;
$myhash = md5($public_key . $private_key . $time);
if ($hash != $myhash) {
    echo json_encode(array('error' => '1', 'status' => $lang[215]));
    exit;
}
$g_id = isset($_POST['gid']) ? $_POST['gid'] : 0;
$u_id = isset($_POST['uid']) ? $_POST['uid'] : 0;
$bool = addLike($g_id, $u_id);
if ($bool) {
    echo json_encode(array('error' => '0', 'status' => $bool));
    exit;
}
示例#7
0
<?php

function get_ip_address()
{
    foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
        if (array_key_exists($key, $_SERVER) === true) {
            foreach (explode(',', $_SERVER[$key]) as $ip) {
                $ip = trim($ip);
                // just to be safe
                if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) {
                    return $ip;
                }
            }
        }
    }
}
@(require 'phpFiles/dbconnect.php');
header('Content-Type: text/xml');
echo '<response>';
$dedicationId = @$_GET['dedicationId'];
$totalLikeNow = @addLike(get_ip_address(), $dedicationId);
echo $totalLikeNow . "#" . $dedicationId;
echo '</response>';