403Webshell
Server IP : 172.67.201.108  /  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/hotel-dev/public_html/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/hotel-dev/public_html/mod/survey_form.php
<?php
	use classes\lib\SurveyEngine;

	include('_mod_security.php');

	form_prep('frm_survey', 'basic_info');
	if ($_POST['ajax_event_submitted'] == '1') :
		$config = HTMLPurifier_Config::createDefault();
		$purifier = new HTMLPurifier($config);
		$_POST['batch_email_html'] = $purifier->purify($_POST['batch_email_html']);
		form_prep_submit();
		form_validate_all();
		if (!$err_flag) :
			try {
				$db->beginTransaction();
				$set = sql_set_update(true) . form_generate_set();
				if ($action == 'Edit') :
					$sql = "UPDATE surveys set ".$set.
						"WHERE id = ".nz(trim($_REQUEST['id']), '0')." ";
					$db->query($sql);
					post_set_update();
				else :
					if ($action == 'Add New') :
						$sql = "INSERT INTO surveys SET ".
							sql_set_create().
							$set;
						$db->query($sql);
						$_REQUEST['id'] = last_id();
						$_POST['id'] = $_REQUEST['id'];
						post_set_create_update();
					endif;
				endif;
				$db->commit();
			} catch(Exception $e) {
				db_err_rollback($e);
			}
			$form_message = "Saved sucessfully!";
			form_uid_reset();
			if ($_POST['xsubmit'] == 'Save & Close') :
				echo "<SCRIPT>";
				echo "appstack_pop()";
				echo "</SCRIPT>";
			endif;
			if ($_POST['xsubmit'] == 'Save & New') :
				echo "<SCRIPT>";
				echo "window.location.href = 'index.php?IX=survey_form&ref=".urlencode($_REQUEST['ref'])."&event_id=".$_GET['event_id']."'";
				echo "</SCRIPT>";
			endif;
			if ($_POST['xsubmit'] == 'Send') :
				echo "<SCRIPT>";
				echo "window.location.href = 'index.php?IX=batch_email&type=survey&ref=".urlencode($_REQUEST['ref'])."&survey_id=".nz(trim($_REQUEST['id']), '0')."&event_id=".$_GET['event_id']."'";
				echo "</SCRIPT>";
			endif;
		else :
			$active_tab = $err_tab;
			$form_message = "Errors found!";
		endif;
	else:
		if ($action == 'Edit') :
			$sql = "SELECT * FROM surveys WHERE id = ".nz(trim($_REQUEST['id']), '0')." ";
			if (!get_row_to_post($sql)) :
				echo form_fatal_error('Invalid Operation!');
				return;
			endif;
		else :
			if (!empty($_REQUEST['event_id'])) :
				$_POST['event_id'] = $_GET['event_id'];
			endif;
		endif;
	endif;
	
?>

<script>
	var active_page = '<?php echo $_REQUEST['IX']; ?>';
	var active_tab = '';

	update_header = function() {
		if ($("#description").val() > "" ) {
			$("#header_repeater").text(" - " + $("#description").val());
		}
	}

	function populate_template_fields() {
		$.ajax({
			url: 'ajax.php?call=survey_ajax&func=load_template&template_id=' + $('#survey_template_id').val(),
			dataType: 'json',
			success: function(json) {
				if (json.result == 'Success') {
					$('#batch_email_subject').val(json.default_email_subject);
					$('#batch_email_reply_name').val(json.default_email_reply_name);
					$('#batch_email_reply_address').val(json.default_email_reply_address);
					$('#cgr_type_id ').val(json.default_cgr_type_id );
					$('#batch_email_html').trumbowyg('html', json.default_email_html);
				} else {
					alert('Error: ' + json.result);
				}
			},
			error: function (request, status, error) {
				alert('Error! ' + status + ' ' + error);
			},
		});
	}

	function show_response_details(id, name) {
		hide_response_details();
		$.ajax({
			url: 'ajax.php?call=survey_ajax&func=load_responses_questions&response_id=' + id + '&name=' + name,
			dataType: 'json',
			success: function(json) {
				if (json.result == 'Success') {
					$('#grid_popup_contents').html(json.html);
					$('#grid_popup').show();
				} else {
					alert('Error: ' + json.result);
				}
			},
			error: function (request, status, error) {
				alert('Error! ' + status + ' ' + error);
			},
		});
	}
	
	function hide_response_details() {
		$('div.grid_popup').hide();
	}
	
	$(document).ready(function() {
		switch_tab('<?php echo $active_tab; ?>');
		update_header();
		$(':input:not(.search)').change(function() {sheet_dirty = true; } );
		editor = $('#batch_email_html').trumbowyg({
			removeformatPasted: true,
			btns: ['fontfamily'],
			btns: [
				['viewHTML'],
				['undo', 'redo'], // Only supported in Blink browsers
				['formatting'],
				['strong', 'em', 'del'],
				['superscript', 'subscript'],
				['link'],
				['insertImage'],
				['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
				['unorderedList', 'orderedList'],
				['horizontalRule'],
				['removeformat'],
				['fullscreen'],
				['fontfamily'],
			],
		});
	});
</script>

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

<form name="frm_survey" id="frm_survey" 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
		$strip_buttons = [
			'send' => [
				'show' => true,
				'caption' => empty($_POST['send_date']) ? 'Send...' : 'Re-send...',
				'js' => "$('#xsubmit').val('Send'); sheet_dirty = false; this.form.submit();",
			],
		];
		form_button_strip('top', $strip_buttons);
		form_tab_strip_start();
		form_tab_header('basic_info', 'Basic Info', 'admin,eventmgr');
		if (!empty($_REQUEST['id'])) :
			form_tab_header('responses', 'Responses', 'admin,eventmgr');
		endif;
		form_tab_strip_end();
		//******************************************************************************************
		form_tab_start('basic_info', 'Basic Info');

		form_column_start();
		form_field('id', 'text', 10, 0, false, false, true, '', '', 'id', 'Survey ID');
		form_field('event_id', 'text', 10, 0, false, false, true, '', '', 'event_id', 'Event ID');
		$sql = "SELECT id, description FROM survey_templates ORDER BY update_date DESC ";
		$result_templates = $db->query($sql) or die('Database Error!');
		$ar_templates = $result_templates->fetchAll(PDO::FETCH_KEY_PAIR);
		form_field(['fname'=>'survey_template_id', 'ftype'=>'select', 'fsize'=>25, 'frequired'=>true, 'fdbname'=>'survey_template_id', 'flabel'=>'Survey Template', 'ar_group'=>$ar_templates, 'onchange'=>'populate_template_fields();']);
		form_field('description', 'text', 100, 0, true, false, false, '', '', 'description', 'Description', [], '', 'update_header();');
		$sql = "SELECT id, cgr_type, points FROM cg_reward_types ORDER BY cgr_type ";
		$result = $db->query($sql) or die('Database Error!');
		$ar_cgr_types = $result->fetchAll(PDO::FETCH_GROUP);
		form_field('cgr_type_id', 'select', 50, 0, false, false, false, '', '', 'cgr_type_id', 'Reward Type', $ar_cgr_types, );
		form_field('batch_email_subject', 'text', 150, 0, true, false, false, '', '', 'batch_email_subject', 'Email Subject');
		form_field(['fname'=>'batch_email_reply_name', 'ftype'=>'text', 'fsize'=>100, 'frequired'=>false, 'fdbname'=>'batch_email_reply_name', 'flabel'=>'Email Reply To Name']);
		form_field(['fname'=>'batch_email_reply_address', 'ftype'=>'text', 'datatype'=>'email', 'fsize'=>100, 'frequired'=>false, 'fdbname'=>'batch_email_reply_address', 'flabel'=>'Email Reply To Address']);
		form_field('batch_email_cc', 'text', 150, 0, false, false, false, '', '', 'batch_email_cc', 'Email CC');
		form_field('batch_email_bcc', 'text', 150, 0, false, false, false, '', '', 'batch_email_bcc', 'Email BCC');
		form_field('expiration_date', 'date', 20, 0, true, false, true, '', 'date-pick dp-applied required', 'expiration_date', 'Expiration Date');
		form_field('send_date', 'datetime', 10, 0, false, false, true, '', '', 'send_date', 'Date Sent');
		form_column_end();

		form_column_start('max-width:750px;');
		form_field(['fname'=>'placeholder', 'ftype'=>'select', 'fsize'=>25, 'frequired'=>false, 'fdbname'=>'', 'flabel'=>'Placeholder - select to insert into HTML below', 'ar_group'=>SurveyEngine::PLACEHOLDERS, 'onchange'=>'insert_text_at_cursor(\'[\' + $(this).val() + \']\', false, \'batch_email_html\'); return false;']);
		form_field(['fname'=>'batch_email_html', 'ftype'=>'textarea', 'fsize'=>70, 'frows'=>20, 'frequired'=>false, 'fdbname'=>'batch_email_html', 'flabel'=>'Email HTML (TIP: use SHIFT+ENTER for Carriage Return)']);
		form_column_end();

		form_tab_end();

		if (!empty($_REQUEST['id'])) :
			//******************************************************************************************
			form_tab_start('responses', 'Responses');

			db_navigator_bar(['table_id'=>'db_grid_responses', 'print_section'=>'db_grid_responses', 'call'=>'survey_responses_ajax', 'sort_col'=>'4', 'sort_order'=>'0', 'subtab'=>'false', 'parm1'=>" AND srr.survey_id = ".nz($_REQUEST['id'], '0')." ", 'func'=>'grid', 'btn_addnew'=>false ]);

			form_tab_end();
		endif;
		//******************************************************************************************
		form_button_strip('bottom', $strip_buttons);
	?>
</form>

<div id="grid_popup" class="grid_popup" style="padding:18px!important;">
	<div style="position:absolute; right:0; top:0; padding:8px;">
		<a href="javascript:hide_response_details();">X</a>
	</div>
	<b><br>Survey Responses:</b>&nbsp;&nbsp;&nbsp;<br />
	<div id="grid_popup_contents">
	</div>
</div>

<script src="trumbowyg/dist/trumbowyg.min.js?ver=<?php echo filemtime(__DIR__.'/../trumbowyg/dist/trumbowyg.min.js') ?>"></script>
<script src="trumbowyg/dist/plugins/fontfamily/trumbowyg.fontfamily.min.js?ver=<?php echo filemtime(__DIR__.'/../trumbowyg/dist/plugins/fontfamily/trumbowyg.fontfamily.min.js') ?>"></script>

Youez - 2016 - github.com/yon3zu
LinuXploit