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/mitzvahm/planner/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mitzvahm/planner/mod/data_import.php
<?php include('_mod_security.php'); ?>
<?php
	if (empty($_SESSION['active_event'])) :
?>
		<h3>No Bar/Bat Mitzvah defined - please create or activate a Bar/Bat Mitzvah!</h3>
<?php
		exit();
	endif;
	//var_dump($_POST);
	//var_dump($_GET);
	$ar_dest_fields = array(
								salutation => 	array(field => 'Salutation', dbfield => 'salutation', maxlength => 25, required => false),
								first_name => 	array(field => 'First Name', dbfield => 'first_name', maxlength => 50, required => true),
								middle_name => 	array(field => 'Middle Name', dbfield => 'middle_name', maxlength => 50, required => false),
								last_name => 	array(field => 'Last Name', dbfield => 'last_name', maxlength => 50, required => true),
								suffix => 		array(field => 'Suffix', dbfield => 'suffix', maxlength => 25, required => false),
								street => 		array(field => 'Street 1', dbfield => 'street', maxlength => 100, required => false),
								street2 => 		array(field => 'Street 2', dbfield => 'street2', maxlength => 100, required => false),
								city => 		array(field => 'City', dbfield => 'city', maxlength => 50, required => false),
								state => 		array(field => 'State', dbfield => 'state', maxlength => 25, required => false),
								zip =>	 		array(field => 'Zip Code', dbfield => 'zip', maxlength => 15, required => false),
								country => 		array(field => 'Country', dbfield => 'country', maxlength => 50, required => false),
								phone => 		array(field => 'Phone', dbfield => 'phone', maxlength => 25, required => false),
								mobile =>		array(field => 'Mobile', dbfield => 'mobile', maxlength => 25, required => false),
								email => 		array(field => 'Email', dbfield => 'email', maxlength => 100, required => false),
							);
	$err_flag = false;
	$validate_function = '';
	if (empty($_POST['step'])) :
		$_POST['step'] = 1;
	endif;
	if ($_SERVER['HTTPS'] != "on") :
		$url_prefix = 'http';
	else :
		$url_prefix = 'https';
	endif;
	$sql = "SELECT id FROM import_guests WHERE user_id = ".$_SESSION['user_id']."  AND event_id = ".$_SESSION['active_event']." ";
	$result_import_check = mysqli_query($GLOBALS['con'], $sql);
	if (mysqli_num_rows($result_import_check) > 0) :
		$import_in_progress = true;
		$form_message = "Previous import has not been completed.  Please classify remaining import records or discard them.";
		$_POST['step'] = 3;
	endif;
	if ($_POST['step'] == 1) :
		$import_in_progress = false;
		unset($_SESSION['import_sheet_data']);
	elseif ($_POST['step'] == 2) :
		//var_dump($_FILES);
		if (!empty($_FILES['import_file']['name'])) :
			$uploaddir = $app_upload_dir.'/data_import/'.str_pad($_SESSION['active_event'], 10, '0', STR_PAD_LEFT);
			if (!is_dir($uploaddir)) :
				//echo 'trying to make directory';
				mkdir($uploaddir, 0777, true);
			endif;
			$uploadfile = $uploaddir.'/'.date("Ymd_His").'_'.basename($_FILES['import_file']['name']);
			if (move_uploaded_file($_FILES['import_file']['tmp_name'], $uploadfile)) :
				//echo 'File upload successful!';
				require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
				if (strtoupper(substr(PHPExcel_IOFactory::identify($uploadfile),0,5)) == 'EXCEL') :
					$objPHPExcel = PHPExcel_IOFactory::load($uploadfile);
					$_SESSION['import_sheet_data'] = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
					//var_dump($_SESSION['import_sheet_data']);
					if (count($_SESSION['import_sheet_data']) <= 1 && count($_SESSION['import_sheet_data'][1]) <= 1) :
						$_POST['step'] = 1;
						$err_flag = true;
						$form_message = "File does not appear to contain valid guest data! &nbsp;Please select a valid Excel file to import.";
					else :
						$validate_function = 'return validate_step2();';
					endif;
				else :
					$_POST['step'] = 1;
					$err_flag = true;
					$form_message = "File is invalid! &nbsp;Please select a valid Excel<sup>&reg;</sup> file to import.";
				endif;
			else :
				$_POST['step'] = 1;
				$err_flag = true;
				$form_message = "File upload failed! &nbsp;Please select a valid Excel<sup>&reg;</sup> file to import.";
			endif;
		else :
		endif;
	elseif ($_POST['step'] == 3) :
		if (!empty($_SESSION['import_sheet_data'])) :
			if ($_POST['first_row_field_names'] == '1') :
				$r_start = 2;
			else :
				$r_start = 1;
			endif;
			for ($r = $r_start; $r <= count($_SESSION['import_sheet_data']); $r++) :
				$set = "";
				$err_row = false;
				foreach ($_POST as $key => $value) :
					if (strtolower(substr($key,0,11)) == 'dest_field-') :
						$field = trim(substr($key,11));
						if (!empty($value) && $value > ' ') :
							if ($ar_dest_fields[$field]['required'] && (empty($_SESSION['import_sheet_data'][$r][$value]) || trim($_SESSION['import_sheet_data'][$r][$value]) == '')) :
								$err_row = true;
							else :
								$set .= $ar_dest_fields[$field]['dbfield']." = '".trim(substr(mysqli_real_escape_string($GLOBALS['con'], trim(strip_tags($_SESSION['import_sheet_data'][$r][$value]))),0,$ar_dest_fields[$field]['maxlength']))."', ";
							endif;
						endif;
					endif;
				endforeach;
				if (!$err_row) :
					$sql = "INSERT INTO import_guests SET ".$set.
							"user_id = ".$_SESSION['user_id'].", ".
							"event_id = ".$_SESSION['active_event']." ";
					//mysqli_query($GLOBALS['con'], $sql) or die('Database Error! '.mysqli_error($GLOBALS['con']).' ==== '.$sql.' === ');
					mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
				endif;
			endfor;
			unset($_SESSION['import_sheet_data']);
			$sql = "SELECT * FROM import_guests WHERE user_id = ".$_SESSION['user_id']."  AND event_id = ".$_SESSION['active_event']." ORDER BY last_name, state, city, zip, street ";
			$result = mysqli_query($GLOBALS['con'], $sql);
			$validate_function = 'return validate_step3();';
		elseif ($import_in_progress) :
			$sql = "SELECT * FROM import_guests WHERE user_id = ".$_SESSION['user_id']."  AND event_id = ".$_SESSION['active_event']." ORDER BY last_name, state, city, zip, street ";
			$result = mysqli_query($GLOBALS['con'], $sql);
			$validate_function = 'return validate_step3();';
		else :
			$_POST['step'] = 1;
			$err_flag = true;
			$form_message = "Import failed! &nbsp;System session error. &nbsp;Please try importing again.";
		endif;
	else :
		echo '<script>';
		echo 'window.location.href = "index.php?IX=ez_guide";';
		echo '</script>';
		exit();
	endif;
?>

<script>
	var active_tab = '';
	var current_guest_id = 0;
	var current_func = '';
	var drop_parent;

	function set_drag_drop()
	{
		$("div.import_source_field").draggable({ 
			containment: "#tab_content_general", 
			//revert: 'invalid', 
			revert: function(is_valid_drop)
			{
				if (!is_valid_drop)
				{
					drop_parent.find('.import_destination_drop').hide();
					drop_parent.find('input.dest_xref').first().val($(this).attr('xref'));
					return true;
				}
			},
			//scroll: false,
			helper: 'clone',
            //appendTo: 'body',
			zIndex: 99999,
			cursor: 'move',
			start : function() 
			{
				this.style.display="none";
				drop_parent = $(this).parent();
				$(this).parent().find('.import_destination_drop').show();
				$(this).parent().find('input.dest_xref').first().val('');
			},
			stop: function() 
			{
				this.style.display="";
			}
		});
		$('div.import_destination_drop').droppable({
			accept: 'div.import_source_field',
			drop: function( event, ui ) 
			{
				$(this).hide();
				$(this).parent().append(ui.draggable);
				$(this).parent().find('input.dest_xref').first().val(ui.draggable.attr('xref'));
			}
		});
		$('div.import_source_field').droppable({
			accept: 'div.import_source_field',
			drop: function( event, ui ) 
			{
				$('#cell_' + ui.draggable.attr('id')).append(ui.draggable);
			}
		});
	}

	primary_window_open = function (w_id,x,y)
	{
		var open_timer = 500;
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		//Set height and width to mask to fill up the whole screen
		$('#primary_guests_mask').css({'width':maskWidth,'height':maskHeight});
		 
		//transition effect    
		//$('#mask').fadeIn(open_timer);   
		$('#primary_guests_mask').fadeTo(0,0.8); 
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
		//Set the popup window to center
		//$(w_id).css('top',  winH/2-$(w_id).height()/2);
		//$(w_id).css('left', winW/2-$(w_id).width()/2);
	 
		//transition effect
		$('#' + w_id).fadeIn(open_timer);
	}
		
	primary_window_close = function ()
	{
		$('#primary_guests_mask, #primary_guests_window').hide();
		//$('#terms_content').html(window_terms_orig_html);
	}
	
	
	primary_window_popup = function (w_id)
	{
		//$('#terms_content').html(window_terms_orig_html);
		primary_window_open(w_id);
		$('#primary_window_content').load('ajax.php?call=data_import_ajax&func=load_primary',
				function() 
				{
				} );
	}

	validate_step2 = function()
	{
		if ($('input.required').filter( function() { return !this.value; }).length > 0)
		{
			alert('Required fields must be mapped!');
			return false;
		}
		else
		{
			return true;
		}
	}

	validate_step3 = function()
	{
		if ($('tr.import_row:visible').length > 0)
		{
			alert('All imported guests must be either classified or discarded!  Click [CANCEL] to finish the import classification later.');
			return false;
		}
		else
		{
			return true;
		}
	}

	select_primary = function(func, rec_id)
	{
		if (func == 'secondary' || func == 'child')
		{
			current_guest_id = rec_id;
			current_func = func;
			primary_window_popup('primary_guests_window');
		}
	}

	cancel_primary = function()
	{
		primary_window_close();
		$('input[name=classify_' + current_guest_id + ']').attr('checked', null);
		current_guest_id = 0;
		current_func = '';
	}
	
	set_primary_guest = function(primary_id)
	{
		primary_window_close();
		$('input[name=classify_' + current_guest_id + ']').attr('checked', null);
		import_classify(current_func, current_guest_id, primary_id);
		current_guest_id = 0;
		current_func = '';
	}

	import_classify = function(func, rec_id, primary_id)
	{
		if (arguments.length == 2)
		{
			primary_id = 0;
		}
		$('#ajax_load').load('ajax.php?call=data_import_ajax&func=' + func + '&id=' + encodeURI(rec_id) + '&primary_id=' + encodeURI(primary_id), 
				function() 
				{
					if ($('#ajax_load').text() == 'Success!')
					{
						$('#import_row_' + rec_id).hide(250);
						//alert('here');
					}
					setTimeout(function() {$('#ajax_load').text('') }, 500);
				} );
	}

	discard_all = function()
	{
		if (confirm('Are you sure?  This action is not reversible.'))
		{
			$('#ajax_load').load('ajax.php?call=data_import_ajax&func=discard_all', 
					function() 
					{
						if ($('#ajax_load').text() == 'Success!')
						{
							window.location.href = 'index.php?IX=ez_guide';
						}
						else
						{
							alert('Error!  Please contact our support team for help.');
						}
					} );
		}
	}

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

<h1>Import Guests from Excel<sup>&reg;</sup> - Step <?php echo $_POST['step']; ?></h1>
<?php get_help_guide('help_data_import'); ?>
<?php echo form_message($form_message); ?>

<form name="frm_import" id="frm_import" method="post" action="" enctype="multipart/form-data" onsubmit="<?php echo $validate_function; ?>" >
	<input name="ajax_event_submitted" type="hidden" value="1" />
	<input name="step" type="hidden" value="<?php echo $_POST['step'] + 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;">
		<?php 
			if ($_POST['step'] == 1) :
				$next_button = 'Next';
		?>
				<div class="form_header">
					Import File Selection 
				</div>
				<div style="text-align:center; margin:10px;">
					<p>Make sure your import spreadsheet data starts at the very top with the first row containing either field names or guest information.</p>
					<p>Each guest must be on a separate row.  Separate First and Last name fields are required.</p>
					<p>You will be able to map all columns in the next step.</p>
					<p>For Excel<sup>&reg;</sup> files, only the active sheet will be imported.</p>
				</div>
				Select file to import: &nbsp;
				<input type="file" name="import_file" /><br /><br />
				<input type="checkbox" name="first_row_field_names" value="1" /> First row contains field names
		<?php 
			elseif ($_POST['step'] == 2) :
				$next_button = 'Next';
		?>
				<div class="form_header">
					Import Field Mapping<br />
				</div>
				<input type="hidden" name="first_row_field_names" value="<?php echo $_POST['first_row_field_names']; ?>" />
				<div style="text-align:center; margin:10px;">
					Drag your import file source fields from the top section to the destination fields in the bottom section.
				</div>
				<div class="form_header">
					Source Fields
				</div>
		<?php 
				//var_dump($_SESSION['import_sheet_data']);
				//var_dump($_SESSION['import_sheet_data'][1]);
				echo '<div class="import_source_data">';
				echo '<div class="import_source_columns" id="source_columns">';
				echo '<table><tr>';
				foreach ($_SESSION['import_sheet_data'][1] as $key => $value) :
					echo '<td id="cell_source_'.$key.'">';
					echo '<div class="import_source_field" id="source_'.$key.'" xref="'.$key.'">';
					echo '<div class="import_source_label">';
					if ($_POST['first_row_field_names'] == '1') :
						echo strip_tags($_SESSION['import_sheet_data'][1][$key]);
						$r_start = 2;
					else :
						echo 'Column '.$key;
						$r_start = 1;
					endif;
					echo '</div>';
					for ($r = $r_start; $r <= min($r_start + 4,count($_SESSION['import_sheet_data'])); $r++) :
						echo strip_tags($_SESSION['import_sheet_data'][$r][$key]).'<br />';
					endfor;
					echo '</div>';
					echo '</td>';
				endforeach;
				echo '</tr></table>';
				echo '</div>';
				echo '</div>';
		?>
				<div class="form_header">
					Destination Fields
				</div>
		<?php
				echo '<div class="import_source_data">';
				echo '<div class="import_source_columns">';
				echo '<table><tr>';
				foreach ($ar_dest_fields as $value) :
					echo '<td>';
					echo '<div class="import_destination_field">';
					echo '<div class="import_destination_label">';
					echo $value['field'].'<br />';
					$required = '';
					if ($value['required']) :
						echo '<span style="color:#ff0000; font-style:italic;">*Required*</span>';
						$required = ' required';
					endif;
					echo '</div>';
					echo '<input name="dest_field-'.$value['dbfield'].'" id="dest_field-'.$value['dbfield'].'" type="hidden" class="dest_xref'.$required.'" value=""  />';
					echo '<div class="import_destination_drop">';
					echo '<br /><br />DROP<br />HERE';
					echo '</div>';
					echo '<div>';
					echo '</td>';
				endforeach;
				echo '</tr></table>';
				echo '</div>';
				echo '</div>';
			elseif ($_POST['step'] == 3) :
				$next_button = 'Finish';
		?>
				<div class="form_header">
					Imported Guest Classification / Family Grouping 
				</div>
				<div style="text-align:center; margin-bottom:10px;">
					You must classify guests before import can be completed. Once each record is classified, it will disappear from the grid below.
				</div>
				<div id="ajax_load" style="position:absolute; top:15px; right:15px; width:75px; height:18px; font-weight:bold;">
				</div>
				<?php
					/*
					$primary_guest_id = 0;
					while ($row = mysqli_fetch_object($result)) :
						echo $row->last_name.' '.$row->first_name.'<br />';
					endwhile;
					*/
				?>
				<div class="db-grid" id="div_db_grid">
					<table id="db_grid_main" class="dbgrid" align="center" cellpadding="0" cellspacing="1" border="0" style="background-color:#ffffff;" >
						<thead>
							<tr>
								<td align="center" class="data-grid-label">&nbsp;
								</td>
								<td colspan="5" align="center" class="data-grid-label">
									Imported Guest Record Classification
								</td>
							</tr>
							<tr>
								<td width="375" align="center" class="data-grid-label">
									Imported Guest Information
								</td>
								<td width="75" align="center" class="data-grid-label">
									Primary Adult
								</td>
								<td width="75" align="center" class="data-grid-label">
									Significant Other
								</td>
								<td width="75" align="center" class="data-grid-label">
									Child with Primary
								</td>
								<td width="75" align="center" class="data-grid-label">
									Individual Child
								</td>
								<td width="75" align="center" class="data-grid-label">
									Discard Record
								</td>
							</tr>
						</thead>
						<tbody>
							<?php
								$primary_guest_id = 0;
								while ($row = mysqli_fetch_object($result)) :
							?>
									<tr id="import_row_<?php echo $row->id; ?>" class="import_row">
										<td class="data-grid-var" >
											<b><?php echo format_guest_name_string($row->salutation, $row->first_name, $row->last_name, $row->suffix); ?></b><br />
											<?php echo $row->street.' '.$row->city.' '.$row->state.' '.$row->zip; ?>
										</td>
										<td class="data-grid-var" align="center">
											<input name="classify_<?php echo $row->id; ?>" class="import_radio" type="radio" onclick="import_classify('primary', <?php echo $row->id; ?>)" />
										</td>
										<td class="data-grid-var" align="center">
											<input name="classify_<?php echo $row->id; ?>" class="import_radio" type="radio" onclick="select_primary('secondary', <?php echo $row->id; ?>)" />
										</td>
										<td class="data-grid-var" align="center">
											<input name="classify_<?php echo $row->id; ?>" class="import_radio" type="radio" onclick="select_primary('child', <?php echo $row->id; ?>)" />
										</td>
										<td class="data-grid-var" align="center">
											<input name="classify_<?php echo $row->id; ?>" class="import_radio" type="radio" onclick="import_classify('child_individual', <?php echo $row->id; ?>)" />
										</td>
										<td class="data-grid-var" align="center">
											<input name="classify_<?php echo $row->id; ?>" class="import_radio" type="radio" onclick="import_classify('discard', <?php echo $row->id; ?>)" />
										</td>
									</tr>
							<?php
								endwhile;
							?>
						</tbody>
					</table>
				</div>


		<?php 
			endif;
		?>
	</div>
	<!-- -------------------------------------------------------------------------------------------------------------- -->
	<div class="form_strip">
		<input type="button" name="xsubmit" value="<?php echo $next_button; ?>" onclick="this.form.submit();" />
		&nbsp;&nbsp;
		<?php
			if ($_POST['step'] == 3) :
		?>
				<input type="button" value="Discard All" onclick="discard_all();" />
				&nbsp;&nbsp;
		<?php
			endif;
		?>
		<input type="button" value="Cancel" onclick="window.location.href = 'index.php?IX=ez_guide';" />
	</div>
</form>

<div class="window" id="primary_guests_window" style=" position:fixed; left:50%; margin-left:-240px; top:150px; bottom:150px; width:480px; background-color:#f3f3f3;">
	<h3>Select Primary Guest</h3>
	<div class="terms_content" id="primary_window_content" style="font-size:16px; position:absolute; top:35px; bottom:30px; left:20px; right:20px; overflow:auto;">
		<div style="text-align:center; padding-top:100px;">
			<img src="img/loading.gif" />
		</div>
	</div>
	<div style="width:100%; text-align:center; position:absolute; bottom:15px; left:0px;">
		<input type="button" value="Cancel" onclick="cancel_primary();" />
	</div>
</div>
<div id="primary_guests_mask" class="mask" onclick="//primary_window_close();">
</div>

Youez - 2016 - github.com/yon3zu
LinuXploit