HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/www/archive/fifthace/application/helpers/db_helper.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	
	/**************************************************************************************************/
	/***** Result Set Formatting Functions ************************************************************/
	
	function rset( $q ) {
		if ($q->num_rows() >= 1) {
			$arr = array();
			for ($i=0; $i < $q->num_rows(); $i++) {
				$r = $q->result_array();
				$arr[count($arr)] = $r;		
			}
			return $arr[0];
		} else return false;
	}
	
	/* QCOL returns an single script array of values in a column */
	/* great for selecting one field and expecting multiple records in return */
	function qcol( $q ) {
		$r = rset( $q );
		if (!isset($r[0])) return false;
		else {
			$out = array();
			foreach ( $r as $x ) {
				foreach ( $x as $key => $val) {
					$out[] = $val;
				}
			}
			return $out;
		}
	}
	
	function qrow( $q, $row=0 ) {
		$r = rset( $q );
		if (!isset($r[$row])) return false;
		else return $r[$row];
	}
	
	function qsql( $q ) {
		if ($q->num_rows() == 0) return false;
		else {      
			$r = $q->result_array();
			$r = $r[0];
			foreach ($r as $k => $v) return $v;
		}
	}
	
	function qin( $a ) {
		$in = '(';
		for ($i=0; $i < count($a); $i++) {
			if ($i > 0) $in .= ',';
			$in .= "'".$a[$i]."'";
		}
		$in .= ')';
		return $in;
	}
	
	/**************************************************************************************************/
	/**************************************************************************************************/

	function getLatLng($add, $city, $state, $zip){
        //time to get the latitude and longitude

        $address = $add." ".$zip;
        $address = str_replace(" ", "+", $address);

        $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false');
        $output= json_decode($geocode);
        
        //echo 'http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false';
        //echo pp($output);
        
        $lat=$lng=0;
        if(isset($output->results[0])){

			$lat = $output->results[0]->geometry->location->lat;
			$lng = $output->results[0]->geometry->location->lng;
        }
        
        $arr=array(
                    "lat"=>$lat,
                    "lng"=>$lng);
        return $arr;
    }

?>