<?php


namespace FUNCTIONS;


class FUNCTIONS{

    public function prnt($data,$die=false){
        echo "<pre>";
        print_r($data);
        echo "</pre>";
        if ($die) die();
    }

    public function post($post=false){
        //print_r($_POST);
        if($post) {
            return isset($_POST[$post]) ? $_POST[$post] : false;
        }else{
            return $_POST;
        }
    }

    public function get($get){
        //print_r($_POST);
        return isset($_GET[$get])?$_GET[$get]:false;
    }

    function getIP() {
        $ipaddress = '';
        if (isset($_SERVER['HTTP_CLIENT_IP']))
            $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
        else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
            $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
        else if(isset($_SERVER['HTTP_X_FORWARDED']))
            $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
        else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
            $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
        else if(isset($_SERVER['HTTP_FORWARDED']))
            $ipaddress = $_SERVER['HTTP_FORWARDED'];
        else if(isset($_SERVER['REMOTE_ADDR']))
            $ipaddress = $_SERVER['REMOTE_ADDR'];
        else
            $ipaddress = 'UNKNOWN';
        return $ipaddress;
    }

    function location($location = 'index'){

        header('location:'.SITE.$location.'.php');

    }

    function getServer($key){
        return isset($_SERVER[$key])?$_SERVER[$key]:false;
    }
}