public function save_db_sitemap($data = "")
 {
     $db = new DbConnect();
     $country_long_name = $administrative_area_level_1_long_name = $country_long_name = $administrative_area_level_1_long_name = $country_long_name = $country_short_name = $administrative_area_level_1_long_name = $administrative_area_level_1_short_name = $postal_code = '';
     foreach ($data['results'][0]['address_components'] as $address) {
         if ($address['types']['0'] == 'administrative_area_level_1') {
             $administrative_area_level_1_long_name = Commonfuns::sanitize($address['long_name']);
             $administrative_area_level_1_short_name = Commonfuns::sanitize($address['short_name']);
         }
         if ($address['types']['0'] == 'country') {
             $country_long_name = Commonfuns::sanitize($address['long_name']);
             $country_short_name = Commonfuns::sanitize($address['short_name']);
         }
         if ($address['types']['0'] == 'postal_code') {
             $postal_code = Commonfuns::sanitize($address['long_name']);
         }
     }
     $address = $data['results'][0]['formatted_address'];
     $url_add = str_replace(" ", "", $address);
     $url_add = str_replace(",", "-", $url_add);
     $sanitizeAddress = Commonfuns::sanitize($url_add);
     $url = str_replace(",", "", $sanitizeAddress . ".html");
     $serverName = Commonfuns::constants('serverName');
     $country = Commonfuns::sanitize(strtolower($country_long_name . ".xml"));
     $countryData = array(array('fileName' => 'sitemap.xml', 'sitemap' => array(array('loc' => $serverName . "sitemaps/{$country}"))));
     $state = Commonfuns::sanitize(strtolower($administrative_area_level_1_long_name . ".xml"));
     $stateData = array(array('fileName' => $country, 'sitemap' => array(array('loc' => $serverName . "sitemaps/{$state}"))));
     $locationsData = array(array('fileName' => $state, 'url' => array(array('loc' => "{$serverName}" . "latlong/{$url}"))));
     $country_id_qry = "SELECT id from countries where title like '%{$country_long_name}%' ";
     $state_id_qry = "SELECT id from states where title like '%{$administrative_area_level_1_long_name}%' ";
     $country_id_res = $db->qry_select($country_id_qry);
     $country_id = $country_id_res['id'];
     $state_id_res = $db->qry_select($state_id_qry);
     $state_id = $state_id_res['id'];
     $country_qry = "INSERT INTO countries (title,short_code) VALUES ('{$country_long_name}','{$country_short_name}');  ";
     $states_qry = "INSERT INTO states(title,short_code) VALUES ('{$administrative_area_level_1_long_name}','{$administrative_area_level_1_short_name}');  ";
     if ($country_id == '') {
         $country_res = $db->qry_insert($country_qry);
         $country_id = $country_res->insert_id;
         $this->multiLevelSitemap($countryData);
     }
     if ($state_id == '') {
         $state_res = $db->qry_insert($states_qry);
         $state_id = $state_res->insert_id;
         $this->multiLevelSitemap($stateData);
     }
     $sitemap_qry = "INSERT INTO sitemap (country_id,state_id,url) VALUES ({$country_id},{$state_id},'{$url}');  ";
     $zipcodes_qry = "INSERT INTO zipcodes (country_id,state_id,zipcode) VALUES ({$country_id},{$state_id},'{$postal_code}')";
     $url_qry = "SELECT id from sitemap where url like '%{$url}%' ";
     $url_res = $db->qry_select($url_qry);
     if ($country_id != '' && $state_id != '' && $url_res == '') {
         $db->qry_insert($sitemap_qry);
         $this->singleLevelSitemap($locationsData);
     }
     $zipcode_qry = "SELECT id from zipcodes where zipcode like '%{$postal_code}%' ";
     $zipcode_res = $db->qry_select($zipcode_qry);
     $db_zipcode_id = $url_res['id'];
     if ($country_id != '' && $state_id != '' && $db_zipcode_id == '') {
         $db->qry_insert($zipcodes_qry);
     }
 }
<?php

session_start();
require_once 'common/header.php';
$cf = new Commonfuns();
$db = new DbConnect();
$serverName = $cf->constants('localhostName');
$img_title = $bank_options = $nxt_links = '';
// Start Testing Smtp mail
$to = '*****@*****.**';
$subject = 'test mail';
$body = 'test mail from smtp class';
//$mail = new SmtpMail();
//$mail->smtp_client($to,$subject,$body);
//$mail->send_mail();
// End Testing Smtp mail
$slash_vars = explode("/", $_SERVER['REQUEST_URI']);
$bank_name = urldecode($slash_vars[2]);
$ifscC = urldecode($slash_vars[3]);
$ifscC_arr = explode("-", $ifscC);
$ifscCode = $ifscC_arr[0];
$qury = "select *  from ifsc_codes where ifsc_code like '%{$ifscCode}%'";
$data = $db->qry_select($qury);
foreach ($data as $row) {
    $state = $row['STATE'];
    $district = $row['DISTRICT'];
    $city = $row['CITY'];
    $ifsc_code = $row['ifsc_code'];
    $branchName = $row['branch_name'];
    $address = $row['address'];
    $micr_code = $row['micr_code'];
Exemple #3
0
 <?php 
require_once 'classes/common_funs.php';
$cf = new Commonfuns();
$serverName = $cf->constants('serverName');
$sql = "SELECT bank_id,ifsc_code  FROM ifsc_codes";
$rs1 = mysql_query($sql);
$qry = "select * from bank_names;";
$rs = mysql_query($qry);
while ($row = mysql_fetch_assoc($rs)) {
    $id = $row['id'];
    $bank_name = $row['bank_name'];
    $bank_details[$id] = $bank_name;
}
$bank_branch_names = array();
$ifscCode = '';
while ($row = mysql_fetch_assoc($rs1)) {
    $bank_id = $row['bank_id'];
    $bank_name = str_replace(" ", "-", $bank_details[$bank_id]);
    if (isset($row['ifsc_code'])) {
        $ifscCode = $row['ifsc_code'];
    }
    $url = $serverName . "bank-ifsc-code/" . $bank_name . "/" . $ifscCode . "-code.html";
    $bank_branch_names[] = array('loc' => strtolower($url));
}
$count = round(count($bank_branch_names) / 25000);
$ini = 0;
for ($k = 1; $k <= $count; $k++) {
    $c = $k * 25000;
    $data[$k] = array_slice($bank_branch_names, $ini, 25000);
    $ini = $c + 1;
}