Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function check($data){
- $sql = new FCMS_MySql_Con();
- $res = mysql_query("SELECT country FROM geoip WHERE country = '$data'",$sql->GetMyConnection()) or die('Error : ' . mysql_error());
- if(!mysql_num_rows($res)){
- $output = "not found";
- }else{
- $output = "found";
- }
- return $output;
- }
- echo check('AU');
- $record = geoip_record_by_name('203.219.47.182');
- if($record){
- //print("<br/><font color='red'>Two letter continent code:</font> ".check("AU"));
- print("<br/><font color='red'>Two letter country code:</font> ".$record[country_code]);
- print("<br/><font color='red'>Three letter country code:</font> ".$record[country_code3]);
- print("<br/><font color='red'>The country name:</font> ".$record[country_name]);
- print("<br/><font color='red'>The region code:</font> ".$record[region]);
- print("<br/><font color='red'>The city:</font> ".$record[city]);
- print("<br/><font color='red'>The Postal Code, FSA or Zip Code.:</font> ".$record[postal_code]);
- print("<br/><font color='red'>The Latitude as signed double:</font> ".$record[latitude]);
- print("<br/><font color='red'>The Longitude as signed double: </font> ".$record[longitude]);
- print("<br/><font color='red'>Designated Market Area code (USA and Canada only):</font> ".$record[dma_code]);
- print("<br/><font color='red'>The PSTN area code (ex: 212):</font> ".$record[area_code]);
- }
- class FCMS_MySql_Con {
- var $g_link = false;
- var $db_host = "localhost:3306";
- var $db_user = "root";
- var $db_password = "";
- var $db_name = "";
- function CheckSql(){
- if (!isset($this->g_link)) {
- $this->g_link = false;
- }
- return $this->g_link;
- }
- function GetMyConnection(){
- if($this->g_link){
- return $this->g_link;
- }
- $this->g_link = mysql_connect($this->db_host, $this->db_user, $this->db_password) or die('Could not connect to mysql server. ERROR:'.mysql_error() );
- mysql_select_db($this->db_name, $this->g_link) or die('Could not select database. ERROR:'.mysql_error() );
- return $this->g_link;
- }
- function CleanUpDB(){
- if( $this->g_link != false ){
- mysql_close($this->g_link);
- }
- return $this->g_link = false;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement