<?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=="196.216.236.2"){
    include ('../../../scripts/classes.php');
    $timestamp = $_GET['timestamp'];
    $cliMsgId = $_GET['cliMsgId'];
    $status = $_GET['status'];
    $charge = $_GET['charge'];
    
    $sql = "UPDATE sms_outbox SET status = '$status', charge='$charge', time_sent=FROM_UNIXTIME('$timestamp') WHERE message_id ='$cliMsgId'";
    $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
    mysqli_free_result($result);
    mysqli_close($mysqli);
} else {
    header('Location: login.php');
}
?>