Esempio n. 1
0
 /**
  * Get the country by IP
  * Return an array with : short name, like 'us', long name, like 'United States and response like 'OK' or <error_message> '
  * @access public
  * @param string $ip
  * @return array
  */
 public function getCountryByIp($ip)
 {
     $country = array(0 => 'unknown', 1 => 'NA', 'response' => 'OK');
     if (Dot_Kernel::validIp($ip) != "public") {
         return $country;
     }
     if (extension_loaded('geoip') == false) {
         // GeoIp extension is not active
         $api = new Dot_Geoip_Country();
         $geoipPath = $this->config->resources->geoip->path;
         if (file_exists($geoipPath)) {
             $country = $api->getCountryByAddr($geoipPath, $ip);
         } else {
             $country['response'] = 'Warning: ' . $this->option->warningMessage->modGeoIp;
         }
     }
     if (function_exists('geoip_db_avail') && geoip_db_avail(GEOIP_COUNTRY_EDITION) && 'unknown' == $country[0]) {
         //if GeoIP.dat file exists
         $countryCode = geoip_country_code_by_name($ip);
         $countryName = geoip_country_name_by_name($ip);
         $country[0] = $countryCode != false ? $countryCode : 'unknown';
         $country[1] = $countryName != false ? $countryName : 'NA';
     }
     if ('unknown' == $country[0]) {
         // GeoIp extension is active, but .dat files are missing
         $api = new Dot_Geoip_Country();
         $geoipPath = $this->config->resources->geoip->path;
         if (file_exists($geoipPath)) {
             $country = $api->getCountryByAddr($geoipPath, $ip);
         } else {
             $country['response'] = 'Warning: ' . $this->option->warningMessage->modGeoIp;
         }
     }
     return $country;
 }
function dmn_getcountry($mnip, &$countrycode)
{
    $mnipalone = substr($mnip, 0, strpos($mnip, ":"));
    $res = geoip_country_name_by_name($mnipalone);
    $countrycode = strtolower(geoip_country_code_by_name($mnipalone));
    return $res;
}
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function track($id, $uniqid)
 {
     $email = Email::where('id', $id)->where('uniqid', $uniqid)->first();
     // If email is found
     if ($email) {
         // Get data
         $ip = $_SERVER['REMOTE_ADDR'];
         $host = gethostbyaddr($ip);
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
         $country = @geoip_country_name_by_name($ip);
         if (!$country) {
             $country = null;
         }
         $validator = EmailTracking::validate(array('ip' => $ip, 'host' => $host, 'user_agent' => $user_agent, 'country' => $country));
         if ($validator->passes()) {
             $tracking = new EmailTracking();
             $tracking->ip = $ip;
             $tracking->host = $host;
             $tracking->user_agent = $user_agent;
             $tracking->country = $country;
             $tracking->save();
             $email->email_trackings()->save($tracking);
             // Attach tracking to email
             // Send pushbullet notification
             $user = $email->user;
             if ($user->pushbullet && $ip != env('IGNORE_IP', 'null')) {
                 $pushbullet = new PHPushbullet($user->pushbullet_api_key);
                 $message = 'Your email "' . $email->title . '" has been read by ' . $ip . ' (' . $host . ' - ' . $country . ').';
                 $pushbullet->device($user->pushbullet_device)->note($email->title, $message);
             }
             // Return pixel
             $response = Response::make(File::get(Config::get('mail_tracker.pixel_file')));
             $response->header('Content-Type', 'image/gif');
             return $response;
         }
         // Otherwise, log error
         abort(500, 'Something went wrong...');
     }
     // Otherwise, exit
     abort(404, 'Email not found!');
 }
 /**
  * {@inheritDoc}
  */
 public function getGeocodedData($address)
 {
     if (!filter_var($address, FILTER_VALIDATE_IP)) {
         throw new UnsupportedException('The GeoipProvider does not support Street addresses.');
     }
     // This API does not support IPv6
     if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
         throw new UnsupportedException('The GeoipProvider does not support IPv6 addresses.');
     }
     if ('127.0.0.1' === $address) {
         return array($this->getLocalhostDefaults());
     }
     $results = array('country_name' => @geoip_country_name_by_name($address), 'country_code' => @geoip_country_code_by_name($address));
     if ($results['country_code'] === false) {
         throw new NoResultException(sprintf('Could not find %s ip address in database.', $address));
     }
     $timezone = @geoip_time_zone_by_country_and_region($results['country_code']) ?: null;
     $results = array_merge($this->getDefaults(), array('country' => $results['country_name'], 'countryCode' => $results['country_code'], 'timezone' => $timezone));
     return array(array_map(function ($value) {
         return is_string($value) ? utf8_encode($value) : $value;
     }, $results));
 }
 /**
  * Get country name.
  *
  * @return string|false Country name or FALSE on failure
  */
 public function getCountryName()
 {
     return geoip_country_name_by_name($this->ip);
 }
Esempio n. 6
0
    function doDirectPayment($basket) {

        if (!is_object($this->account)) {
            print "
            <tr>
            <td colspan=3>
            ";

            print 'Invalid account data';

            print "
            </td>
            </tr>
            ";

            return false;
        }

        if (!is_array($basket)) {
            print "
            <tr>
            <td colspan=3>
            ";

            print 'Invalid basket data';

            print "
            </td>
            </tr>
            ";
            return false;
        }

        if (is_array($this->test_credit_cards) && in_array($_POST['creditCardNumber'], $this->test_credit_cards)) {
	        $this->CardProcessor->environment='sandbox';
        }

        $this->CardProcessor->chapter_class  = 'chapter';
        $this->CardProcessor->odd_row_class  = 'oddc';
        $this->CardProcessor->even_row_class = 'evenc';

        $this->CardProcessor->note = $this->account->account;
        $this->CardProcessor->account = $this->account->account;

        $this->CardProcessor->vat = $this->vat;

        // set hidden elements we need to preserve in the shopping cart application
        $this->CardProcessor->hidden_elements = $this->account->hiddenElements;

        // load shopping items
        $this->CardProcessor->cart_items=$basket;

        // load user information from owner information if available otherwise from sip account settings

        if ($this->account->owner_information['firstName']) {
	    	$this->CardProcessor->user_account['FirstName']=$this->account->owner_information['firstName'];
    	} else {
        	$this->CardProcessor->user_account['FirstName']=$this->account->firstName;
        }

        if ($this->account->owner_information['lastName']) {
        	$this->CardProcessor->user_account['LastName']=$this->account->owner_information['lastName'];
        } else {
        	$this->CardProcessor->user_account['LastName']=$this->account->lastName;
        }

        if ($this->account->owner_information['email']) {
        	$this->CardProcessor->user_account['Email']=$this->account->owner_information['email'];
        } else {
        	$this->CardProcessor->user_account['Email']=$this->account->email;
        }

        if ($this->account->owner_information['address'] && $this->account->owner_information['address']!= 'Unknown') {
        	$this->CardProcessor->user_account['Address1']=$this->account->owner_information['address'];
        } else {
        	$this->CardProcessor->user_account['Address1']='';
        }

        if ($this->account->owner_information['city'] && $this->account->owner_information['city']!= 'Unknown') {
        	$this->CardProcessor->user_account['City']=$this->account->owner_information['city'];
        } else {
        	$this->CardProcessor->user_account['City']='';
        }

        if ($this->account->owner_information['country'] && $this->account->owner_information['country']!= 'Unknown') {
        	$this->CardProcessor->user_account['Country']=$this->account->owner_information['country'];
        } else {
	        $this->CardProcessor->user_account['Country']='';
        }

        if ($this->account->owner_information['state'] && $this->account->owner_information['state']!= 'Unknown') {
    	    $this->CardProcessor->user_account['State']=$this->account->owner_information['state'];
        } else {
        	$this->CardProcessor->user_account['State']='';
        }

        if ($this->account->owner_information['postcode'] && $this->account->owner_information['postcode']!= 'Unknown') {
	        $this->CardProcessor->user_account['PostCode']=$this->account->owner_information['postcode'];
        } else {
    	    $this->CardProcessor->user_account['PostCode']='';
        }

        if ($_REQUEST['purchase'] == '1' ) {
            $chapter=sprintf(_("Transaction Results"));
            $this->account->showChapter($chapter);

            print "
            <tr>
            <td colspan=3>
            ";

            // ensure that submit requests are coming only from the current page
            if ($_SERVER['HTTP_REFERER'] == $this->CardProcessor->getPageURL()) {

                // check submitted values
                $errors = $this->CardProcessor->checkForm($_POST);
                if (count($errors) > 0){
                    print $this->CardProcessor->displayFormErrors($errors);

                    foreach (array_keys($errors) as $key) {
                        $log_text.=sprintf("%s:%s ",$errors[$key]['field'],$errors[$key]['desc']);
                    }

                    $log=sprintf("CC transaction for %s failed with error: %s",$this->account->account,$log_text);
                    syslog(LOG_NOTICE, $log);
                    return false;
                }

                // process the payment
                $b=time();

                $pay_process_results = $this->CardProcessor->processPayment($_POST);
                if(count($pay_process_results['error']) > 0){
                    // there was a problem with payment
                    // show error and stop

                    if ($pay_process_results['error']['field'] == 'reload') {
                        print $pay_process_results['error']['desc'];
                    } else {
                        print $this->CardProcessor->displayProcessErrors($pay_process_results['error']);
                    }

                    $e=time();
                    $d=$e-$b;

                    $log=sprintf("CC transaction for %s failed with error: %s (%s) after %d seconds",
                    $this->account->account,
                    $pay_process_results['error']['short_message'],
                    $pay_process_results['error']['error_code'],
                    $d
                    );

                    syslog(LOG_NOTICE, $log);

                    return false;
                } else {

                    $e=time();
                    $d=$e-$b;

                    $log=sprintf("CC transaction %s for %s completed succesfully in %d seconds",
                    $pay_process_results['success']['desc']->TransactionID,
                    $this->account->account,
                    $d
                    );
                    syslog(LOG_NOTICE, $log);

                    print "<p>";
                    print _("Transaction completed sucessfully. ");

                    /*
                    if ($this->CardProcessor->environment!='sandbox' && $this->account->first_transaction) {
                        print "<p>";
                        print _("This is your first payment. ");

                        print "<p>";
                        print _("Please allow the time to check the validity of your transaction before activating your Credit. ");

                        print "<p>";
                        print _("You can speed up the validation process by sending a copy of an utility bill (electriciy, gas or TV) that displays your address. ");

                        print "<p>";
                        printf (_("For questions related to your payments or to request a refund please email to <i>%s</i> and mention your transaction id <b>%s</b>. "),
                        $this->account->billing_email,
                        $pay_process_results['success']['desc']->TransactionID
                        );

                        $this->make_credit_checks=true;

                    } else {
                       print "<p>";
                       print _("You may check your new balance in the Credit tab. ");
                    }
                    */
                }

                if ($this->account->Preferences['ip'] && $_loc=geoip_record_by_name($this->account->Preferences['ip'])) {
                    $enrollment_location=$_loc['country_name'].'/'.$_loc['city'];
                } else if ($this->account->Preferences['ip'] && $_loc=geoip_country_name_by_name($this->account->Preferences['ip'])) {
                    $enrollment_location=$_loc;
                } else {
                    $enrollment_location='Unknown';
                }

                if ($_loc=geoip_record_by_name($_SERVER['REMOTE_ADDR'])) {
                    $transaction_location=$_loc['country_name'].'/'.$_loc['city'];
                } else if ($_loc=geoip_country_name_by_name($_SERVER['REMOTE_ADDR'])) {
                    $transaction_location=$_loc;
                } else {
                    $transaction_location='Unknown';
                }

                if ($this->account->Preferences['timezone']) {
                    $timezone=$this->account->Preferences['timezone'];
                } else {
                    $timezone='Unknown';
                }

                $extra_information=array(
                                         'Account Page'         => $this->account->admin_url_absolute,
                                         'Account First Name'   => $this->account->firstName,
                                         'Account Last Name '   => $this->account->lastName,
                                         'Account Timezone'     => $this->account->timezone,
                                         'Enrollment IP'        => $this->account->Preferences['ip'],
                                         'Enrollment Location'  => $enrollment_location,
                                         'Enrollment Email'     => $this->account->Preferences['registration_email'],
                                         'Enrollment Timezone'  => $timezone,
                                         'Transaction Location' => $transaction_location
                                         );

                $result = $this->account->addInvoice($this->CardProcessor);
                if ($result) {
                    $extra_information['Invoice Page']=sprintf("https://admin.ag-projects.com/admin/invoice.phtml?iId=%d&adminonly=1",$result['invoice']);
                }

                if ($this->CardProcessor->saveOrder($_POST,$pay_process_results,$extra_information)) {

                    $this->transaction_results=array('success' => true,
                                                     'id'      => $this->CardProcessor->transaction_data['TRANSACTION_ID']
                                                     );

                    return true;

                } else {
                    $log=sprintf("Error: SIP Account %s - CC transaction %s failed to save order",$this->account->account, $this->CardProcessor->transaction_data['TRANSACTION_ID']);
                    syslog(LOG_NOTICE, $log);
                    return false;
                }

            } else {
                print _("Invalid CC Request");
                return false;
            }

            print "
            </td>
            </tr>
            ";

        } else {

            print "
            <tr>
            <td colspan=3>
            ";

            // print the submit form
            $arr_form_page_objects = $this->CardProcessor->showSubmitForm();
            print $arr_form_page_objects['page_body_content'];

            print "
            </td>
            </tr>
            ";

    	}

    }
Esempio n. 7
0
 /**
  * @param string     $proxy
  * @param string     $answer
  * @param null|array $curlInfo
  * @return array|bool
  */
 protected function genInfo($proxy, $answer, $curlInfo = null)
 {
     if (preg_match('%^[01]{5}%', $answer) && preg_match_all('%(?<fun_status>[01])%', $answer, $matches)) {
         $infoProxy['proxy'] = $proxy['proxy'];
         $infoProxy['source'] = isset($proxy['source']) ? $proxy['source'] : null;
         $infoProxy['protocol'] = isset($proxy['protocol']) ? $proxy['protocol'] : null;
         $infoProxy['anonym'] = (bool) $matches['fun_status'][0];
         $infoProxy['referer'] = (bool) $matches['fun_status'][1];
         $infoProxy['post'] = (bool) $matches['fun_status'][2];
         $infoProxy['get'] = (bool) $matches['fun_status'][3];
         $infoProxy['cookie'] = (bool) $matches['fun_status'][4];
         $infoProxy['last_check'] = time();
         preg_match('%(?<ip>\\d+\\.\\d+\\.\\d+\\.\\d+)\\:\\d+%ims', $infoProxy['proxy'], $match);
         $countryName = isset($match['ip']) && function_exists('geoip_country_name_by_name') ? geoip_country_name_by_name($match['ip']) : NULL;
         $infoProxy['country'] = $countryName ? $countryName : 'no country';
         $infoProxy['starttransfer'] = isset($curlInfo['starttransfer_time']) ? $curlInfo['starttransfer_time'] : NULL;
         $infoProxy['upload_speed'] = isset($curlInfo['speed_upload']) ? $curlInfo['speed_upload'] : NULL;
         $infoProxy['download_speed'] = isset($curlInfo['speed_download']) ? $curlInfo['speed_download'] : NULL;
         return $infoProxy;
     } else {
         return [];
     }
 }
Esempio n. 8
0
/**
 * Returns the country name from the current IP
 * 
 * See <get_ip_address>
 * @return string Country name or empty string if unknown
 */
function get_countryname_by_ip()
{
    //	// maxmind installed as server module?
    //	if(isset($_SERVER["GEOIP_COUNTRY_CODE"]))
    //		return $_SERVER["GEOIP_COUNTRY_CODE"];
    if (function_exists('geoip_open')) {
        $gi = geoip_open($GLOBALS['CONFIG']['geoip']['city_dat_file'], GEOIP_STANDARD);
        $country_name = geoip_country_name_by_name($gi, $GLOBALS['current_ip_addr']);
        geoip_close($gi);
    } else {
        $country_name = geoip_country_name_by_name($GLOBALS['current_ip_addr']);
    }
    return $country_name;
}
Esempio n. 9
0
 /**
  * Get GeoIp host information
  *
  * @return void
  */
 protected function getGeoIpHostInfo()
 {
     if (function_exists('geoip_db_get_all_info') && null !== $this->host && $this->host != '127.0.0.1' && $this->host != 'localhost') {
         // Get base info by city
         if ($this->databases['city']) {
             $data = geoip_record_by_name($this->host);
             $this->hostInfo['areaCode'] = $data['area_code'];
             $this->hostInfo['city'] = $data['city'];
             $this->hostInfo['continentCode'] = $data['continent_code'];
             $this->hostInfo['country'] = $data['country_name'];
             $this->hostInfo['countryCode'] = $data['country_code'];
             $this->hostInfo['countryCode3'] = $data['country_code3'];
             $this->hostInfo['dmaCode'] = $data['dma_code'];
             $this->hostInfo['latitude'] = $data['latitude'];
             $this->hostInfo['longitude'] = $data['longitude'];
             $this->hostInfo['postalCode'] = $data['postal_code'];
             $this->hostInfo['region'] = $data['region'];
             // Else, get base info by country
         } else {
             if ($this->databases['country']) {
                 $this->hostInfo['continentCode'] = geoip_continent_code_by_name($this->host);
                 $this->hostInfo['country'] = geoip_country_name_by_name($this->host);
                 $this->hostInfo['countryCode'] = geoip_country_code_by_name($this->host);
                 $this->hostInfo['countryCode3'] = geoip_country_code3_by_name($this->host);
             }
         }
         // If available, get ISP name
         if ($this->databases['isp']) {
             $this->hostInfo['isp'] = geoip_isp_by_name($this->host);
         }
         // If available, get internet connection speed
         if ($this->databases['netspeed']) {
             $netspeed = geoip_id_by_name($this->host);
             switch ($netspeed) {
                 case GEOIP_DIALUP_SPEED:
                     $this->hostInfo['netspeed'] = 'Dial-Up';
                     break;
                 case GEOIP_CABLEDSL_SPEED:
                     $this->hostInfo['netspeed'] = 'Cable/DSL';
                     break;
                 case GEOIP_CORPORATE_SPEED:
                     $this->hostInfo['netspeed'] = 'Corporate';
                     break;
                 default:
                     $this->hostInfo['netspeed'] = 'Unknown';
             }
         }
         // If available, get Organization name
         if ($this->databases['org']) {
             $this->hostInfo['org'] = geoip_org_by_name($this->host);
         }
     }
 }
Esempio n. 10
0
 /**
  * Returns the country ID and Name for a given hostname.
  *
  * @param string $name  The hostname.
  *
  * @return mixed  An array with 'code' as the country code and 'name' as
  *                the country name, or false if not found.
  */
 public function getCountryInfo($name)
 {
     if (Horde_Util::extensionExists('geoip')) {
         $id = @geoip_country_code_by_name($name);
         $cname = @geoip_country_name_by_name($name);
         return !empty($id) && !empty($cname) ? array('code' => Horde_String::lower($id), 'name' => $cname) : false;
     }
     $id = $this->countryIdByName($name);
     if (!empty($id)) {
         $code = $this->_countryCodes[$id];
         return array('code' => Horde_String::lower($code), 'name' => $this->_getName($code));
     }
     return false;
 }
Esempio n. 11
0
 private function ip_details($ip)
 {
     $ip_details = [];
     $ip_details['country'] = geoip_country_name_by_name($ip);
     return $ip_details;
 }
Esempio n. 12
0
<?
require_once($_SERVER['DOCUMENT_ROOT'].'/private/config.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/private/init/mysql.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/private/func.php');

$table = $table_market = $data_market = $transaction_table = $tx_rate = $block_table = $mn_count = $mntable = $hash_rate = $price_usd = $mtable = $diff_stat = $ghash_rate = $tpools = '';
$all_reward = $k = $other_reward = $pools_all_blocks = $pools_all_reward = $pools_all_hashrate = $step = $all_sum = $all_price = 0;
$pools_stats = array();
$rur = get_json_param('rur');
$markets = get_json_param('markets');

$query = $db->prepare("SELECT * FROM `mn_data`");
$query->execute();
while($row=$query->fetch()){
	$mntable = $mntable."<tr><td>{$row['ip']}</td><td>{$row['port']}</td><td>{$row['status']}</td><td><img src=\"https://dash.org.ru/img/16/".mb_strtolower(geoip_country_code_by_name($row['ip'])).".png\"> ".geoip_country_name_by_name($row['ip'])."</td><td>{$row['version']}</td><td><a href=\"https://chainz.cryptoid.info/dash/address.dws?{$row['address']}.htm\" target=\"_blank\">{$row['address']}</a></td></tr>";
}

//$query = $db->prepare("select sum(tx_sum), sum(txs), time from `data` group by month(from_unixtime(`time`)) order by `time` desc");
$query = $db->prepare("select sum(tx_sum), sum(txs), time from `data` group by concat(month(from_unixtime(`time`)),year(from_unixtime(`time`))) order by `time` desc");
$query->execute();
while($row=$query->fetch()){
	$transaction_table = $transaction_table."<tr><td>".date("Y, F" ,$row['time'])."</td><td>".round($row['sum(tx_sum)'])."</td><td>{$row['sum(txs)']}</td></tr>";
}

//$query = $db->prepare("select sum(tx_sum), time from `data` group by day(from_unixtime(`time`)) order by `time` asc");
$query = $db->prepare("select sum(tx_sum), date(from_unixtime(`time`)) as dateNum from `data` group by dateNum");
$query->execute();
while($row=$query->fetch()){
	if(empty($row["sum(tx_sum)"])) continue;
	//$tx_rate = "$tx_rate [{$row['time']}000, ".round($row["sum(tx_sum)"])."],";
	$tx_rate = "$tx_rate [".strtotime($row['dateNum'])."000, ".round($row["sum(tx_sum)"])."],";
Esempio n. 13
0
 /**
  * getCountry
  * 
  * Returns the country of the set IP.
  * 
  * @access protected
  * @static
  * @return string
  */
 protected static function getCountry()
 {
     return geoip_country_name_by_name(self::_getIP());
 }
Esempio n. 14
0
    $query_select = $db->prepare("SELECT * FROM `node` WHERE `ip` = :ip");
    $query_select->bindParam(':ip', $value, PDO::PARAM_STR);
    $query_select->execute();
    if ($query_select->rowCount() != 1) {
        $query_insert = $db->prepare("INSERT INTO `node` (`ip`, `country`, `users`, `hash`, `fee`, `uptime`) VALUES (:ip, :country, :users, :hash, :fee, :uptime)");
        $query_insert->bindParam(':ip', $value, PDO::PARAM_STR);
        $query_insert->bindParam(':country', geoip_country_name_by_name($value), PDO::PARAM_STR);
        $query_insert->bindParam(':users', $users, PDO::PARAM_STR);
        $query_insert->bindParam(':hash', round($sum), PDO::PARAM_STR);
        $query_insert->bindParam(':fee', round($json['fee'], 2), PDO::PARAM_STR);
        $query_insert->bindParam(':uptime', round($uptime), PDO::PARAM_STR);
        $query_insert->execute();
    } else {
        $query_update = $db->prepare("UPDATE `node` SET `country` = :country, `users` = :users, `hash` = :hash, `fee` =:fee, `uptime` = :uptime WHERE `ip` = :ip");
        $query_update->bindParam(':ip', $value, PDO::PARAM_STR);
        $query_update->bindParam(':country', geoip_country_name_by_name($value), PDO::PARAM_STR);
        $query_update->bindParam(':users', $users, PDO::PARAM_STR);
        $query_update->bindParam(':hash', round($sum), PDO::PARAM_STR);
        $query_update->bindParam(':fee', round($json['fee'], 2), PDO::PARAM_STR);
        $query_update->bindParam(':uptime', round($uptime), PDO::PARAM_STR);
        $query_update->execute();
    }
}
$query = $db->prepare("SELECT * FROM `node`");
$query->execute();
while ($row = $query->fetch()) {
    if (!in_array($row['ip'], $addr) || in_array($row['ip'], $remove_nodes)) {
        $query_delete = $db->prepare("DELETE FROM `node` WHERE `ip` = :ip");
        $query_delete->bindParam(':ip', $row['ip'], PDO::PARAM_STR);
        $query_delete->execute();
    }
Esempio n. 15
0
 }
 if (mb_strlen($post['password']) > 20) {
     error(sprintf($config['error']['toolong'], 'password'));
 }
 wordfilters($post['body']);
 $post['body'] = escape_markup_modifiers($post['body']);
 if ($mod && isset($post['raw']) && $post['raw']) {
     $post['body'] .= "\n<tinyboard raw html>1</tinyboard>";
 }
 if ($config['country_flags']) {
     if (!geoip_db_avail(GEOIP_COUNTRY_EDITION)) {
         error('GeoIP not available: ' . geoip_db_filename(GEOIP_COUNTRY_EDITION));
     }
     if ($country_code = @geoip_country_code_by_name($_SERVER['REMOTE_ADDR'])) {
         if (!in_array(strtolower($country_code), array('eu', 'ap', 'o1', 'a1', 'a2'))) {
             $post['body'] .= "\n<tinyboard flag>" . strtolower($country_code) . "</tinyboard>" . "\n<tinyboard flag alt>" . @geoip_country_name_by_name($_SERVER['REMOTE_ADDR']) . "</tinyboard>";
         }
     }
 }
 if (mysql_version() >= 50503) {
     $post['body_nomarkup'] = $post['body'];
     // Assume we're using the utf8mb4 charset
 } else {
     // MySQL's `utf8` charset only supports up to 3-byte symbols
     // Remove anything >= 0x010000
     $chars = preg_split('//u', $post['body'], -1, PREG_SPLIT_NO_EMPTY);
     $post['body_nomarkup'] = '';
     foreach ($chars as $char) {
         $o = 0;
         $ord = ordutf8($char, $o);
         if ($ord >= 0x10000) {
Esempio n. 16
0
function geo_ip_country_name($ip)
{
    $ip = trim($ip);
    $result = '';
    if (strlen($ip)) {
        if (function_exists('geoip_country_code_by_name')) {
            $result = @geoip_country_name_by_name($ip);
        } else {
            if (function_exists('geoip_open') && file_exists("includes/geoip/GeoIP.dat")) {
                $gi = geoip_open("includes/geoip/GeoIP.dat", GEOIP_STANDARD);
                if ($gi) {
                    $result = geoip_country_name_by_addr($gi, $ip);
                    geoip_close($gi);
                }
            }
        }
    }
    return $result;
}
Esempio n. 17
0
     echo "\tPlayers: " . $row['players'] . "\n";
     echo "\tMaxPlayers: " . $row['maxplayers'] . "\n";
     echo "\tBots: " . $row['bots'] . "\n";
     echo "\tSpectators: " . $row['spectators'] . "\n";
     echo "\tMap: " . $row['map'] . "\n";
     echo "\tMods: " . $row['mods'] . "\n";
     $protected = $row['protected'] != 0 ? 'true' : 'false';
     echo "\tTTL: " . ($stale - (time() - $row['ts'])) . "\n";
     echo "\tProtected: " . $protected . "\n";
     if ($row['state'] == 2 && $row['started'] != '') {
         echo "\tStarted: " . $row['started'] . "\n";
     }
     $country = explode(":", $row['address']);
     array_pop($country);
     $country = implode(":", $country);
     $country = geoip_country_name_by_name($country);
     if ($country) {
         echo "\tLocation: " . $country . "\n";
     }
     /*$query = $db->prepare('SELECT client FROM clients WHERE address = :addr');
       $query->bindValue(':addr', $row['address'], PDO::PARAM_STR);
       $query->execute();
       $res = $query->fetchAll();
       if ($res)
       {
           echo "\tClients:\n";
           foreach ($res as $client)
               echo "\t\t" . $client['client'] . "\n";
       }*/
 }
 $db = null;
Esempio n. 18
0
 function lookupGeoLocation ($ip) {
     if ($_loc=geoip_record_by_name($ip)) {
         return $_loc['country_name'].'/'.$_loc['city'];
     } else if ($_loc=geoip_country_name_by_name($ip)) {
         return $_loc;
     } else {
         return '';
     }
 }
Esempio n. 19
0
<?php

echo geoip_country_name_by_name('188.209.246.97');
Esempio n. 20
0
<?php

include_once "lib/lib.php";
connect();
Login();
$user = $_SESSION["user"];
$userId = $user['id'];
$login = $user['login'] ? $user['login'] : $user['vkid'];
$movieId = array_key_exists('id', $_GET) ? (int) $_GET['id'] : -1;
$user_country = geoip_country_name_by_name($_SERVER['REMOTE_ADDR']);
$ban = $user_country == 'Russian Federation' && in_array($movieId, $BANNED);
$movie = false;
$desc = false;
$ignore = false;
$torrents = false;
$bestQuality = array('quality' => "CAMRIP", 'translateQuality' => "ORIGINAL");
if ($movieId != -1) {
    $sqlresult = mysqli_query($GLOBALS['mysqli'], "SELECT * FROM movies WHERE id = {$movieId}");
    $movie = mysqli_fetch_assoc($sqlresult);
    if (!$movie) {
        header('HTTP/1.0 404 Not Found');
        echo "Not Found";
        exit;
    }
    $desc = json_decode($movie['description'], true);
    $movie['Release'] = strtotime($desc['Released']);
    $sqlresult = mysqli_query($GLOBALS['mysqli'], "SELECT movieId FROM userignore WHERE userId = {$userId} AND movieId = {$movieId} ORDER BY id DESC");
    $ignore = (bool) mysqli_fetch_assoc($sqlresult);
    $sqlresult = mysqli_query($GLOBALS['mysqli'], "SELECT * FROM links WHERE movieId = {$movieId} ORDER BY seed DESC LIMIT 500");
    while ($row = mysqli_fetch_assoc($sqlresult)) {
        if (qualityToRool($row['quality']) > qualityToRool($bestQuality['quality']) || qualityToRool($row['quality']) == qualityToRool($bestQuality['quality']) && translateQualityToRool($row['translateQuality']) > translateQualityToRool($bestQuality['translateQuality'])) {
Esempio n. 21
0
 //Ip
 $http = $_SERVER["HTTP_USER_AGENT"];
 //Browser, OS, ...
 $os = "Autre";
 if (stristr($http, "windows")) {
     $os = "Windows";
 } else {
     if (stristr($http, "linux")) {
         $os = "Linux";
     } else {
         if (stristr($http, "mac")) {
             $os = "Mac";
         }
     }
 }
 $country = geoip_country_name_by_name($ip);
 $chain = trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, "SALTforENCRYPTdata", htmlspecialchars($ip . "/" . $http), MCRYPT_MODE_ECB)));
 //Unique chain
 switch ($type) {
     case "like":
         include "modify/count_like.php";
         require_once 'qrlike.php';
         break;
     case "url":
         include "modify/count_url.php";
         require_once 'qrurl.php';
         break;
     case "vote":
         require_once 'qrvote.php';
         include "modify/count_vote.php";
         break;
Esempio n. 22
0
 public function printCountryName()
 {
     return geoip_country_name_by_name(www . google . com);
 }
Esempio n. 23
0
 /**
  * @return string|bool
  */
 public function getCountryName()
 {
     try {
         return geoip_country_name_by_name($this->host);
     } catch (\Exception $e) {
         return false;
     }
 }
Esempio n. 24
0
     } else {
         $shareReport = new ShareReport();
         $media = Media::find($media_id);
         if (isset($media->id)) {
             $c_code = 'IND';
             $c_name = 'India';
             $shareReport->ip = $ip;
             $shareReport->media_id = $media_id;
             $shareReport->user_id = $userid;
             $shareReport->size = $media->size;
             $shareReport->bytes = $ip_bytes;
             $shareReport->perc = percent2($shareReport->bytes, $shareReport->size);
             $shareReport->date = $ip_date;
             try {
                 $c_code = geoip_country_code_by_name($ip);
                 $c_name = geoip_country_name_by_name($ip);
             } catch (Exception $e) {
                 $report = new UserFlag();
                 $report->type = 'share update record error';
                 $report->media_id = $media_id;
                 $report->res = $e->getMessage();
                 $report->save();
             }
             $shareReport->country = $c_name;
             $shareReport->country_code = $c_code;
             $shareReport->save();
         }
     }
 }
 if (isset($ip_rec->id)) {
     $ip_rec->bytes = $ip_rec->bytes + $ip_bytes;
Esempio n. 25
0
"><?php 
                echo htmlspecialchars($kill['target']);
                ?>
</a></td>
		<td><a href="?search=<?php 
                echo urlencode($kill['target_ip']);
                ?>
"><?php 
                echo htmlspecialchars($kill['target_ip']);
                ?>
</a></td>
        <?php 
                if (function_exists('geoip_country_name_by_name')) {
                    ?>
<td><?php 
                    echo empty($kill['ip_address']) ? '' : @geoip_country_name_by_name($kill['target_ip']);
                    ?>
</td><?php 
                }
                ?>
		<td><?php 
                echo $kill['gun'];
                ?>
</td>
	</tr>
<?php 
            }
            ?>
</table>
<?php 
            echo paginator($page, $total_pages);