Wednesday, 6 August 2014

By using PHP unzip zip files with source code

<?php
$zip = new ZipArchive;
$res = $zip->open('demo.zip');
if ($res === TRUE) {
$zip->extractTo('test/');
$zip->close();
echo 'woot!';
} else {
echo 'doh!';
}
?>

Tuesday, 5 August 2014

Bootstrap Off Canvas nav toggle viewing windows size

$(document).ready(function () {
$('[data-toggle=offcanvas]').click(function () {
$('.row-offcanvas').toggleClass('active')
});
});

Monday, 4 August 2014

How to determine if an ip within specific range or not by using php?

$lower = "0.0.0.0.0";
$upper = "255.255.255.255";
$ip = "0.0.0.10";
$lower_dec = (float)sprintf("%u",ip2long($lower));
$upper_dec = (float)sprintf("%u",ip2long($upper));
$ip_dec = (float)sprintf("%u",ip2long($ip));
if( ($ip_dec>=$lower_dec) && ($ip_dec<=$upper_dec) ){
echo "True";
}else{
echo "False";
}