<?php
function getIp() {
    $ip = $_SERVER['REMOTE_ADDR'];
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    return $ip;
}

$visitorIP = getIp();
//echo $visitorIP; 
if  ($visitorIP == "85.194.241.82" || $visitorIP == "89.174.81.103" || $visitorIP == "89.174.81.98" || $visitorIP == "89.174.81.102" || $visitorIP == "91.185.184.29" ||  $visitorIP == "91.185.185.2 " || $visitorIP == "185.36.169.252"){
    include ('../../../scripts/classes.php');

    $callback_msgid = explode(',', $_GET['MsgId']);
    $callback_status = explode(',', $_GET['status']);
    
    if($callback_msgid){
        foreach($callback_msgid as $c => $value){
            $sql = "UPDATE sms_outbox SET status = '".mysqli_real_escape_string($mysqli, $callback_status[$c])."', time_sent = NOW(), updated_on = NOW() WHERE message_id ='".mysqli_real_escape_string($mysqli, $value)."' LIMIT 1";
            $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
        }
    }
    mysqli_close($mysqli);
    echo "OK";
} else {
    echo "nop...";
}
?>