-
Notifications
You must be signed in to change notification settings - Fork 1
/
ajaxLikes.php
33 lines (21 loc) · 871 Bytes
/
ajaxLikes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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>';
?>