Webdesigncr3ator

Your Trusted Partner

Tag: PHP

Play with form and submit for Sohan

<html>
<head>
<title>A Basic Html Form </title>
</head>
<body>

<?php 

if(isset($_POST['submit'])){

$user=$_POST['username'];

 if ($user=='me'){
  echo 'Matched';
  }
  
  else {
  echo 'Sorry';
  }
 

 }
 
 
 
?>


<form method="post" action="#">
  <input type = "text" name="username" value= "username">
  <input type="submit" name="submit" value="Get Selected Values" />
</form>

Playing with ip address and geolocation

You must have to enabled file get contents on your server :

<?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 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($country==’Bangladesh’)
{
echo
“<script type=\”text/javascript\”>”.
“window.alert(‘Your country Bangladesh.’);”.
“</script>”;
}

else {

echo ‘ok’;
}

?>

© 2017 Webdesigncr3ator

Theme by Anders NorenUp ↑