Ejemplo n.º 1
0
 public function checkUser()
 {
     $rate = $_POST['rate'];
     $video_id = $_POST['video_id'];
     $ipadresa = $this->get_client_ip_env();
     $ratAct = new RatingActions();
     $result = $ratAct->checkUser($ipadresa, $video_id);
     if ($result !== false) {
         if ($rate === $result['Rate']) {
             echo "You have already liked this video";
         } else {
             $res = $ratAct->updateUser($video_id, $rate, $ipadresa);
             echo "updated";
         }
     } else {
         $ratAct->insertUser($video_id, $rate, $ipadresa);
         echo "you successfuly rated this video";
     }
 }
Ejemplo n.º 2
0
                } else {
                    if (getenv('HTTP_FORWARDED')) {
                        $ipaddress = getenv('HTTP_FORWARDED');
                    } else {
                        if (getenv('REMOTE_ADDR')) {
                            $ipaddress = getenv('REMOTE_ADDR');
                        } else {
                            $ipaddress = 'UNKNOWN';
                        }
                    }
                }
            }
        }
    }
    return $ipaddress;
}
$ratAct = new RatingActions();
$ipadresa = get_client_ip_env();
$video_id = $_POST['video_id'];
$result = $ratAct->checkUser($ipadresa, $video_id);
if ($result !== false) {
    if ($result['Rate'] === 'like') {
        $rate = 'like';
        echo $rate;
    } else {
        $rate = 'dislike';
        echo $rate;
    }
} else {
    echo "video is not rated";
}
Ejemplo n.º 3
0
                    if (getenv('HTTP_FORWARDED')) {
                        $ipaddress = getenv('HTTP_FORWARDED');
                    } else {
                        if (getenv('REMOTE_ADDR')) {
                            $ipaddress = getenv('REMOTE_ADDR');
                        } else {
                            $ipaddress = 'UNKNOWN';
                        }
                    }
                }
            }
        }
    }
    return $ipaddress;
}
$rate = $_POST['rate'];
$video_id = $_POST['video_id'];
$ipadresa = get_client_ip_env();
$ratAct = new RatingActions();
$result = $ratAct->checkUser($ipadresa, $video_id);
if ($result !== false) {
    if ($rate === $result['Rate']) {
        echo "You have already liked this video";
    } else {
        $res = $ratAct->updateUser($video_id, $rate, $ipadresa);
        echo "updated";
    }
} else {
    $ratAct->insertUser($video_id, $rate, $ipadresa);
    echo "you successfuly rated this video";
}