<?php
/**
* @file
*
* @copyright Copyright (C) 2015 OSb Web Solutions
* @author Ovidiu S Bokar <contact@osbwebsolutions.com>
* @date 25/02/2015
*
*/
class Restriction {
/**
* @var
*/
private $_allowedIPList;
/**
* @var
*/
private $_userIP;
/**
* @param $arg
* @return mixed
*/
public function getAllowedIPlist($arg){
return $this->_allowedIPList = $arg["allowed"];
}
/**
* @param $ip
* @return mixed
*/
public function getUserIP($ip){
return $this->_userIP = $ip;
}
//check if the user IP is in the white list
/**
*
*/
public function checkGlobalIndex(){
if(!in_array($this->_userIP,$this->_allowedIPList)){
echo 'You are in the wrong place.';exit;
}
}
/**
* @param $arg
* @param $ip
*/
public function globalInit($whiteList,$ip){
$this->getAllowedIPlist($whiteList);
$this->getUserIP($ip);
$this->checkGlobalIndex();
}
}
|