403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.217.99
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/route_form.php
<?php include('_mod_security.php'); ?>
<?php
	//var_dump($_POST);
	form_prep('routes', 'basic_info');
	$cookie_id = 'route_zips_'.time();
	if ($action == 'Add New' && empty($_POST['region_id']) && !empty($_GET['region_id'])) :
		$_POST['region_id'] = $_GET['region_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['route_name'])) :
			$ar_err['route_name'] = 'Route 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 (!$err_flag) :
			$set = "route_name = ".$db->quote(trim($_POST['route_name'])).", ".
					"region_id = ".nz($_POST['region_id'], '0').", ".
					"comments = ".$db->quote(trim($_POST['comments'])).", ".
					"update_by = ".nz(trim($_SESSION['user_id'])).", ".
					"update_date = '".date('Y-m-d H:i:s')."' ";
			if ($action == 'Edit') :
				$sql = "UPDATE routes set ".$set.
					"WHERE route_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 routes 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['route_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();
			$active_tab = 'basic_info';
			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=route_form&ref=".urlencode($_REQUEST['ref'])."'";
				echo "</SCRIPT>";
			endif;
		else :
			$active_tab = $err_tab;
			$form_message = "Errors found!";
		endif;
	else:
		if ($action == 'Edit') :
			$sql = "SELECT * FROM routes WHERE route_id = ".nz($_REQUEST['id'], '0')." and region_id IN (".get_regions().") ";
			$result = $db->query($sql) or die('Database Error!');
			if ($result->rowCount() > 0) :
				$row = $result->fetch(PDO::FETCH_OBJ);
				$_POST['route_id'] = $row->route_id;
				$_POST['route_name'] = $row->route_name;
				$_POST['region_id'] = $row->region_id;
				$_POST['comments'] = $row->comments;
				$_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_route = $row->route_id;
				//$_COOKIE[$cookie_id] = $row->region_id;
			else :
				echo form_fatal_error('Invalid Operation!');
				return;
			endif;
		else :
		endif;
	endif;
?>

<script>
	var active_page = '<?php echo $_REQUEST['IX']; ?>';
	var active_tab = '';
	
	update_zip = function(zip)
	{
		if ($('#zip_' + zip).prop('checked'))
		{
			var func = 'add';
		}
		else
		{
			var func = 'remove';
		}
		$.ajax({
			url: "ajax.php?call=route_zipcodes_ajax&func=" + func + "&route=<?php echo nz($_REQUEST['id'], '0'); ?>&region=" + $('#region_id').val() + "&zip=" + zip,
			cache: false,
			dataType: "json",
			success: function(json) {
					if (json.result == 'Success')
					{
						ar_lcs_db_loaded['db_grid_locations'] = false;
						$('#ajax_result_msg').show().text('Updated');
						setTimeout(function() {$('#ajax_result_msg').text('').hide(); }, 300);
					}
					else
					{
						alert(json.result);
					}
			}
			 ,error: function (request, status, error) { alert(status + ", " + error); }
		})
	}
	
	update_driver = function(driver_id)
	{
		$('.route_driver_cell').each(function() {
				//alert($(this).attr('id').substr(7));
				if ($(this).attr('id') == 'driver_' + driver_id)
				{
					if ($('#driver_' + driver_id).prop('checked'))
					{
						var func = 'add';
					}
					else
					{
						var func = 'remove';
					}
					$.ajax({
						url: "ajax.php?call=route_drivers_ajax&func=" + func + "&route=<?php echo nz($_REQUEST['id'], '0'); ?>&region=" + $('#region_id').val() + "&driver_id=" + driver_id,
						cache: false,
						dataType: "json",
						success: function(json) {
								if (json.result == 'Success')
								{
									$('#ajax_result_msg').show().text('Updated');
									setTimeout(function() {$('#ajax_result_msg').text('').hide(); }, 300);
								}
								else
								{
									alert(json.result);
								}
						}
						 ,error: function (request, status, error) { alert(status + ", " + error); }
					})
				}
				else
				{
					if ($(this).prop('checked'))
					{
						$(this).prop('checked', false);
						$.ajax({
							url: "ajax.php?call=route_drivers_ajax&func=remove&route=<?php echo nz($_REQUEST['id'], '0'); ?>&region=" + $('#region_id').val() + "&driver_id=" + $(this).attr('id').substr(7),
							cache: false,
							dataType: "json",
							success: function(json) {
									if (json.result == 'Success')
									{
										$('#ajax_result_msg').show().text('Updated');
										setTimeout(function() {$('#ajax_result_msg').text('').hide(); }, 300);
									}
									else
									{
										alert(json.result);
									}
							}
							 ,error: function (request, status, error) { alert(status + ", " + error); }
						})
					}
				}
			});
	}
	
	update_header = function()
	{
		if ($("#route_name").val() > "" )
		{
			$("#header_repeater").text(" - " + $("#route_name").val());
		}
	}
	
	$(document).ready(function()	
		{
			setCookie('<?php echo $cookie_id; ?>',$('#region_id').val(),1);
			switch_tab('<?php echo $active_tab; ?>');
			update_header();
			$(':input:not(.search)').change(function() {sheet_dirty = true; } );
		}
	)
</script>

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

<form style="" name="frm_route" id="frm_route" 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 id="ajax_result_msg" class="ajax_result_msg"></div>
		<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_zipcodes" onclick="switch_tab('zipcodes');">
					Zip Codes
				</div>
				<div class="tab_header" id="tab_locations" onclick="switch_tab('locations');">
					Locations
				</div>
				<div class="tab_header" id="tab_drivers" onclick="switch_tab('drivers');">
					Drivers
				</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('route_id', 'text', 10, 0, false, false, true, '', '', 'route_id', 'Route ID');
				form_field('route_name', 'text', 50, 0, true, false, false, '', '', 'route_name', 'Route 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, 'setCookie(\''.$cookie_id.'\',$(this).val(),1); ar_lcs_db_load[\'db_grid_zipcodes\'](); ');
			?>
		</div>
		<div class="input_column">
			<?php
				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_zipcodes">
			<div class="form_header">
				Zip Codes
			</div>
			<?php
				$ref = urlencode('route_form&tab=zipcodes&id='.trim(nz($_REQUEST['id'], '0')));
				//$ix_form_delivery = 'delivery_form&ref='.$ref.'&route_id='.trim(nz($_REQUEST['id'], '-1'));
			?>
			<?php db_navigator_bar(array('table_id'=>'db_grid_zipcodes', 'form'=>'', 'btn_addnew'=>'false', 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_zipcodes', 'call'=>'route_zipcodes_ajax', 'sort_col'=>'1', 'sort_order'=>'0', 'subtab'=>'true', 'parm1'=>$cookie_id, 'parm2'=>" AND rz.route_id = ".nz($_REQUEST['id'], '0'), 'func'=>'grid' )); ?>
		</div>
		<!-- -------------------------------------------------------------------------------------------------------------- -->
		<div class="tab_content" id="tab_content_locations">
			<div class="form_header">
				Locations
			</div>
			<?php
				$ref = urlencode('route_form&tab=locations&id='.trim(nz($_REQUEST['id'], '0')));
				$ix_form_location = 'location_form&ref='.$ref.'&route_id='.trim(nz($_REQUEST['id'], '-1'));
			?>
			<?php db_navigator_bar(array('table_id'=>'db_grid_locations', 'form'=>$ix_form_location, 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_locations', 'call'=>'route_locations_ajax', 'sort_col'=>'1', 'sort_order'=>'0', 'subtab'=>'true', 'parm1'=>'', 'parm2'=>" AND rz.route_id = ".nz($_REQUEST['id'], '0'), 'func'=>'grid' )); ?>
		</div>
		<!-- -------------------------------------------------------------------------------------------------------------- -->
		<div class="tab_content" id="tab_content_drivers">
			<div class="form_header">
				Drivers
			</div>
			<?php
				$ref = urlencode('route_form&tab=drivers&id='.trim(nz($_REQUEST['id'], '0')));
				$ix_form_driver = 'driver_form&ref='.$ref.'&route_id='.trim(nz($_REQUEST['id'], '-1'));
			?>
			<?php db_navigator_bar(array('table_id'=>'db_grid_drivers', 'form'=>$ix_form_driver, 'xls_sql'=>$xls_sql, 'print_section'=>'db_grid_drivers', 'call'=>'route_drivers_ajax', 'sort_col'=>'1', 'sort_order'=>'0', 'subtab'=>'true', 'parm1'=>$cookie_id, 'parm2'=>" AND rd.route_id = ".nz($_REQUEST['id'], '0'), 'func'=>'grid' )); ?>
		</div>
		<!-- -------------------------------------------------------------------------------------------------------------- -->
	<?php 
		endif;
	?>
	<?php form_button_strip('bottom'); ?>
</form>

Youez - 2016 - github.com/yon3zu
LinuXploit