This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getRealIPAddr() | |
{ | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet | |
{ | |
$ip=$_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy | |
{ | |
$ip=$_SERVER['HTTP_X_FORWARDED_FOR']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function list_files($dir) | |
{ | |
if(is_dir($dir)) | |
{ | |
if($handle = opendir($dir)) | |
{ | |
while(($file = readdir($handle)) !== false) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function resize($img, $w, $h, $newfilename) { | |
//Check if GD extension is loaded | |
if (!extension_loaded('gd') && !extension_loaded('gd2')) { | |
trigger_error("GD is not loaded", E_USER_WARNING); | |
return false; | |
} | |
//Get Image size info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flattenArray(array) { | |
var arrayPool = []; | |
if(array.length > 0) { | |
for(var i=0; i < array.length; i++){ | |
if(array[i].constructor === Array){ | |
arrayPool = arrayPool.concat(flattenArray(array[i])); | |
} else { | |
arrayPool.push(array[i]); | |
} | |
} |
OlderNewer