About Me

My photo

I am Ram, a Web Designer and Developer.   More than 4  years of experience in software development. Created complex back-end management systems including content management, e-commerce, customer relations and communication interfaces. The projects based on PHP in conjunction. PHP, SQL, JavaScript, AJAX, XHTML, CSS (Responsive), I help people make beautiful websites, functional applications and seamless user experiences.

Sunday, 25 October 2015

Get visitor’s location details from IP address using php

<?php

/*Get user ip address*/
$ip_address=$_SERVER['REMOTE_ADDR'];

/*Get user ip address details with geoplugin.net*/
$geopluginURL='http://www.geoplugin.net/php.gp?ip='.$ip_address;
$addrDetailsArr = unserialize(file_get_contents($geopluginURL));

/*Get City name by return array*/
$city = $addrDetailsArr['geoplugin_city'];

/*Get Country name by return array*/
$country = $addrDetailsArr['geoplugin_countryName'];

/*Comment out these line to see all the posible details*/
/*echo '<pre>';
print_r($addrDetailsArr);
die();*/

if(!$city){
   $city='Not Define';
}if(!$country){
   $country='Not Define';
}
echo '<strong>IP Address</strong>:- '.$ip_address.'<br/>';
echo '<strong>City</strong>:- '.$city.'<br/>';
echo '<strong>Country</strong>:- '.$country.'<br/>';

?>

Friday, 23 October 2015

while loop checkbox validation using javascript

<script>
function validate(){
if($('input[name="check_list[]"]:checked').length == 0) {
    alert('No checkbox is checked');
    return false;
}
  return true;
}
</script>


<form action="" method="post"  onsubmit="return validate();"  enctype="multipart/form-data">

  <input type="checkbox" name="check_list[]" value="">
 <input type="checkbox" name="check_list[]" value="">
  <input type="checkbox" name="check_list[]" value=""> 
 <input type="checkbox" name="check_list[]" value=""> 

<button  class="btn  btn-danger" type="submit" name="upload"> Send </button>
</form>