Пример #1
0
 public function getCity($ip)
 {
     $record = $this->fetchRow("select * from auto_pre_iptocity WHERE ip = ?", array($ip), 3600);
     if (!empty($record)) {
         $rec = json_decode($record['details'], 1);
         return $rec;
     }
     if (empty($record)) {
         $this->clearCache($this->sql, array($ip));
         $details = iptocity($ip);
         if (empty($details) || $details['status'] != 'OK') {
             return false;
         }
         $geo = new Models_Geo();
         $nearby = $geo->get_nearby_cities($details['lat'], $details['lon']);
         $rec = array();
         foreach ($nearby as $v) {
             $rec = $v;
             break;
         }
         if (empty($rec)) {
             return false;
         }
         $d = array();
         $d['ip'] = $ip;
         $d['details'] = json_encode($rec);
         $this->addDetails('auto_pre_iptocity', $d);
         return $rec;
     }
     return false;
 }
Пример #2
0
 public function myBids($uid, $period)
 {
     $this->checkUser($uid);
     $sql = sprintf("SELECT * FROM location_bids WHERE owner_id=%s AND period_bids=%s order by bid_created_dt asc", $this->qstr($uid), $this->qstr($period));
     $result = $this->_connMain->Execute($sql);
     if ($result->RecordCount() == 0) {
         throw new Exception('No Bids available.');
     }
     $return = array();
     $Models_Geo = new Models_Geo();
     $return['country'] = array();
     $return['state'] = array();
     $return['city'] = array();
     while (!$result->EOF) {
         $location = array();
         switch ($result->fields['location_type']) {
             case 'Country':
                 $location = $Models_Geo->getCountryDetails($result->fields['location_id'], 0);
                 $return['country'][] = array('bidDetail' => $result->fields, 'location' => $location);
                 break;
             case 'State':
                 $location = $Models_Geo->getStateDetails($result->fields['location_id'], 0);
                 $return['state'][] = array('bidDetail' => $result->fields, 'location' => $location);
                 break;
             case 'City':
                 $location = $Models_Geo->getCityDetails($result->fields['location_id'], 0);
                 $return['city'][] = array('bidDetail' => $result->fields, 'location' => $location);
                 break;
         }
         $result->MoveNext();
     }
     return $return;
 }
Пример #3
0
<?php

check_login();
include SITEDIR . '/includes/navLeftSideVars.php';
if (!empty($_REQUEST['cty'])) {
    $status = 0;
    $insertSQL = sprintf("INSERT INTO geo_city_owners (cty_id, owner_id, expiry_date, subs_expiry_date, status) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_REQUEST['cty'], "int"), GetSQLValueString($_SESSION['user']['id'], "text"), GetSQLValueString(date('Y-m-d H:i:s', strtotime("+1 month")), "date"), GetSQLValueString(date('Y-m-d H:i:s', strtotime("+1 year")), "date"), GetSQLValueString($status, "int"));
    mysql_select_db($database_connMain, $connMain);
    $Result1 = mysql_query($insertSQL, $connMain) or die(mysql_error());
    $insertGoTo = $currentURL;
    header(sprintf("Location: %s", $insertGoTo));
    exit;
}
//getting owern information
$Models_Geo = new Models_Geo();
$ownerDetails = $Models_Geo->getOwnerDetails($city_id, 0);
if (!empty($ownerDetails)) {
    header("Location: " . $currentURL);
    exit;
}
?>
<h1><?php 
echo $pageTitle;
?>
</h1>
<p>Apply For City Moderator</p>
<form action="<?php 
echo PAYPAL_URL;
?>
" method="post">
    
Пример #4
0
function matchUserDate($uid, $lat, $lng, $custom_date)
{
    if (empty($uid)) {
        return false;
    }
    if (empty($lat)) {
        return false;
    }
    if (empty($lng)) {
        return false;
    }
    if (empty($custom_date)) {
        return false;
    }
    global $modelGeneral;
    $query = "SELECT * FROM settings LEFT JOIN geo_cities ON settings.birth_city_id = geo_cities.cty_id WHERE 1 AND settings.uid = ?";
    $settingsDetail = $modelGeneral->fetchRow($query, array($uid), 3600);
    if (empty($settingsDetail['dob'])) {
        return false;
    }
    if (empty($settingsDetail['birth_city_id'])) {
        return false;
    }
    $geo = new Models_Geo();
    $nearby = $geo->get_nearby_cities($lat, $lng);
    if (empty($nearby)) {
        continue;
    }
    $cityDetails = array();
    foreach ($nearby as $v) {
        $cityDetails = $v;
        break;
    }
    if (empty($cityDetails)) {
        return false;
    }
    $to = $cityDetails;
    if (empty($to['extraDetails'])) {
        $tmp = findCity($to['cty_id']);
        unset($tmp['nearby']);
        unset($tmp['etc']);
        $to = array_merge($to, $tmp);
    }
    if (!empty($settingsDetail['extraDetails']) && !empty($settingsDetail['birth_city_id'])) {
        $tmp = findCity($settingsDetail['birth_city_id']);
        unset($tmp['nearby']);
        unset($tmp['etc']);
        $settingsDetail = array_merge($settingsDetail, $tmp);
    }
    $to['dob'] = $custom_date;
    $matchResult = match($settingsDetail, $to);
    return $matchResult;
}
Пример #5
0
<?php

check_login();
$pageTitle = 'My Cities';
include SITEDIR . '/libraries/addresses/nearby.php';
$Models_Geo = new Models_Geo();
$mycities = $Models_Geo->myOwnedCities($_SESSION['user']['id']);
?>
<h3>My Cities</h3>
<?php 
if (empty($mycities)) {
    ?>
<div>No Cities in your account.</div>
<?php 
} else {
    foreach ($mycities as $k => $v) {
        ?>
  <a href="<?php 
        echo makecityurl($v['id'], $v['name']);
        ?>
/manage/main"><?php 
        echo $v['name'];
        ?>
, <?php 
        echo $v['state'];
        ?>
, <?php 
        echo $v['country'];
        ?>
</a><br>
  <strong>Expiry:</strong> <?php 
Пример #6
0
 function findCitySearch($searchTerm)
 {
     $geo = new Models_Geo();
     $cities = $geo->findCityDetails($searchTerm, 1);
     return $cities;
 }