Skip to content

Instantly share code, notes, and snippets.

View ahmad-moussawi's full-sized avatar
🎹
Playing 🎶

Ahmad Moussawi ahmad-moussawi

🎹
Playing 🎶
View GitHub Profile
<?php
class Permission
{
static $dictionaryPath = 'clients.php';
/**
* Check if the clientId exists in the dictionary
* @param $clientId
function checkIp() {
/**
* Deny if not from the following IPs
*
*/
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];