| 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/hotel-dev/public_html/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
form_prep('guests', 'basic_info');
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();
form_validate('first_name', 'string', true);
form_validate('last_name', 'string', true);
form_validate('company', 'string', true);
form_validate('phone', 'string', true);
form_validate('email', 'email', true);
if (!$err_flag) :
$set = "title = " . $db->quote(trim($_POST['title'])) . ", " .
"first_name = " . $db->quote(trim($_POST['first_name'])) . ", " .
"last_name = " . $db->quote(trim($_POST['last_name'])) . ", " .
"company = " . $db->quote(trim($_POST['company'])) . ", " .
"address = " . $db->quote(trim($_POST['address'])) . ", " .
"phone = " . $db->quote(trim($_POST['phone'])) . ", " .
"email = " . $db->quote(trim($_POST['email'])) . ", " .
"association_id = " . nz(trim($_POST['association_id']), '0') . ", " .
"active = " . nz(trim($_POST['active']), '0') . ", " .
"comments = " . $db->quote(trim($_POST['comments'])) . ", " .
sql_set_update();
if ($action == 'Edit') :
$sql = "UPDATE guests set " . $set .
"WHERE guest_id = " . nz(trim($_REQUEST['id']), '0') . " ";
$db->query($sql) or die('Database Error!');
//echo '==='.$sql.'===';
post_set_update();
else :
if ($action == 'Add New') :
$sql = "INSERT INTO guests SET " .
sql_set_create() .
$set;
//echo '==='.$sql.'===';
$db->query($sql) or die('Database Error!');
$_REQUEST['id'] = last_id();
$_POST['guest_id'] = $_REQUEST['id'];
post_set_create_update();
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=guest_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 guests WHERE guest_id = " . nz(trim($_REQUEST['id']), '0') . " ";
$result = $db->query($sql) or die('Database Error!');
if ($result->rowCount() > 0) :
$row = $result->fetch(PDO::FETCH_OBJ);
$_POST['guest_id'] = $row->guest_id;
$_POST['title'] = $row->title;
$_POST['first_name'] = $row->first_name;
$_POST['last_name'] = $row->last_name;
$_POST['company'] = $row->company;
$_POST['address'] = $row->address;
$_POST['phone'] = $row->phone;
$_POST['email'] = $row->email;
$_POST['association_id'] = $row->association_id;
$_POST['active'] = $row->active;
$_POST['comments'] = $row->comments;
post_set_load_create_update();
else :
echo form_fatal_error('Invalid Operation!');
return;
endif;
else :
if (!empty($_GET['association_id'])) :
$_POST['association_id'] = $_REQUEST['association_id'];
endif;
$_POST['active'] = 1;
endif;
endif;
?>
<script>
var active_page = '<?php echo $_REQUEST['IX']; ?>';
var active_tab = '';
guest_event_update = function(gid, eid, field, obj) {
//alert($(obj).val());
//alert($(obj).attr('type'));
var value = $(obj).val();
if ($(obj).attr('type').toLowerCase() == 'checkbox') {
if (obj.checked) {
value = 1;
} else {
value = 0;
}
}
switch (field) {
case 'rsvp_1':
if (value == 1) {
$("#conf_1_" + eid).prop('disabled', false);
$("#conf_1_" + eid).prop('checked', false);
$("#cancel_1_" + eid).prop('disabled', false);
$("#cancel_1_" + eid).prop('checked', false);
$("#attended_1_" + eid).prop('disabled', false);
$("#attended_1_" + eid).prop('checked', true);
$("#wait_1_" + eid).prop('checked', false);
$("#nbr_of_guests_" + eid).prop('disabled', false);
if ($("#nbr_of_guests_" + eid).val() == '') {
$("#nbr_of_guests_" + eid).val('1');
}
if ($("#nbr_of_guests_" + eid).val() > '1') {
$("#guest_name_" + eid).prop('disabled', false);
}
$("#invitor_" + eid).prop('disabled', false);
} else {
$("#conf_1_" + eid).prop('disabled', true);
$("#conf_1_" + eid).prop('checked', false);
$("#cancel_1_" + eid).prop('disabled', true);
$("#cancel_1_" + eid).prop('checked', false);
$("#attended_1_" + eid).prop('disabled', true);
$("#attended_1_" + eid).prop('checked', false);
if (!$("#wait_1_" + eid).prop('checked') && !$("#rsvp_2_" + eid).prop('checked') && !$("#wait_2_" + eid).prop('checked')) {
$("#nbr_of_guests_" + eid).prop('disabled', true);
$("#nbr_of_guests_" + eid).val('');
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
$("#invitor_" + eid).prop('disabled', true);
$("#invitor_" + eid).val('');
}
}
break;
case 'wait_1':
if (value == 1) {
$("#rsvp_1_" + eid).prop('checked', false);
$("#conf_1_" + eid).prop('disabled', true);
$("#conf_1_" + eid).prop('checked', false);
$("#cancel_1_" + eid).prop('disabled', true);
$("#cancel_1_" + eid).prop('checked', false);
$("#attended_1_" + eid).prop('disabled', true);
$("#attended_1_" + eid).prop('checked', false);
$("#nbr_of_guests_" + eid).prop('disabled', false);
if ($("#nbr_of_guests_" + eid).val() == '') {
$("#nbr_of_guests_" + eid).val('1');
}
if ($("#nbr_of_guests_" + eid).val() > '1') {
$("#guest_name_" + eid).prop('disabled', false);
}
$("#invitor_" + eid).prop('disabled', false);
} else {
if (!$("#wait_2_" + eid).prop('checked') && !$("#rsvp_2_" + eid).prop('checked') && !$("#rsvp_1_" + eid).prop('checked')) {
$("#nbr_of_guests_" + eid).prop('disabled', true);
$("#nbr_of_guests_" + eid).val('');
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
$("#invitor_" + eid).prop('disabled', true);
$("#invitor_" + eid).val('');
}
}
break;
case 'cancel_1':
if (value == 1) {
$("#rsvp_1_" + eid).prop('disabled', true);
$("#rsvp_1_" + eid).prop('checked', false);
$("#conf_1_" + eid).prop('disabled', true);
$("#conf_1_" + eid).prop('checked', false);
$("#attended_1_" + eid).prop('disabled', true);
$("#attended_1_" + eid).prop('checked', false);
if (!$("#wait_2_" + eid).prop('checked') && !$("#rsvp_2_" + eid).prop('checked') && !$("#rsvp_2_" + eid).prop('checked')) {
$("#nbr_of_guests_" + eid).prop('disabled', true);
$("#nbr_of_guests_" + eid).val('');
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
$("#invitor_" + eid).prop('disabled', true);
$("#invitor_" + eid).val('');
}
} else {
$("#rsvp_1_" + eid).prop('disabled', false);
}
break;
case 'rsvp_2':
if (value == 1) {
$("#conf_2_" + eid).prop('disabled', false);
$("#conf_2_" + eid).prop('checked', false);
$("#cancel_2_" + eid).prop('disabled', false);
$("#cancel_2_" + eid).prop('checked', false);
$("#attended_2_" + eid).prop('disabled', false);
$("#attended_2_" + eid).prop('checked', true);
$("#wait_2_" + eid).prop('checked', false);
$("#nbr_of_guests_" + eid).prop('disabled', false);
if ($("#nbr_of_guests_" + eid).val() == '') {
$("#nbr_of_guests_" + eid).val('1');
}
if ($("#nbr_of_guests_" + eid).val() > '1') {
$("#guest_name_" + eid).prop('disabled', false);
}
$("#invitor_" + eid).prop('disabled', false);
} else {
$("#conf_2_" + eid).prop('disabled', true);
$("#conf_2_" + eid).prop('checked', false);
$("#cancel_2_" + eid).prop('disabled', true);
$("#cancel_2_" + eid).prop('checked', false);
$("#attended_2_" + eid).prop('disabled', true);
$("#attended_2_" + eid).prop('checked', false);
if (!$("#wait_2_" + eid).prop('checked') && !$("#rsvp_1_" + eid).prop('checked') && !$("#wait_1_" + eid).prop('checked')) {
$("#nbr_of_guests_" + eid).prop('disabled', true);
$("#nbr_of_guests_" + eid).val('');
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
$("#invitor_" + eid).prop('disabled', true);
$("#invitor_" + eid).val('');
}
}
break;
case 'wait_2':
if (value == 1) {
$("#rsvp_2_" + eid).prop('checked', false);
$("#conf_2_" + eid).prop('disabled', true);
$("#conf_2_" + eid).prop('checked', false);
$("#cancel_2_" + eid).prop('disabled', true);
$("#cancel_2_" + eid).prop('checked', false);
$("#attended_2_" + eid).prop('disabled', true);
$("#attended_2_" + eid).prop('checked', false);
$("#nbr_of_guests_" + eid).prop('disabled', false);
if ($("#nbr_of_guests_" + eid).val() == '') {
$("#nbr_of_guests_" + eid).val('1');
}
if ($("#nbr_of_guests_" + eid).val() > '1') {
$("#guest_name_" + eid).prop('disabled', false);
}
$("#invitor_" + eid).prop('disabled', false);
} else {
if (!$("#wait_1_" + eid).prop('checked') && !$("#rsvp_1_" + eid).prop('checked') && !$("#rsvp_2_" + eid).prop('checked')) {
$("#nbr_of_guests_" + eid).prop('disabled', true);
$("#nbr_of_guests_" + eid).val('');
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
$("#invitor_" + eid).prop('disabled', true);
$("#invitor_" + eid).val('');
}
}
break;
case 'cancel_2':
if (value == 1) {
$("#rsvp_2_" + eid).prop('disabled', true);
$("#rsvp_2_" + eid).prop('checked', false);
$("#conf_2_" + eid).prop('disabled', true);
$("#conf_2_" + eid).prop('checked', false);
$("#attended_2_" + eid).prop('disabled', true);
$("#attended_2_" + eid).prop('checked', false);
if (!$("#wait_1_" + eid).prop('checked') && !$("#rsvp_1_" + eid).prop('checked') && !$("#rsvp_1_" + eid).prop('checked')) {
$("#nbr_of_guests_" + eid).prop('disabled', true);
$("#nbr_of_guests_" + eid).val('');
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
$("#invitor_" + eid).prop('disabled', true);
$("#invitor_" + eid).val('');
}
} else {
$("#rsvp_2_" + eid).prop('disabled', false);
}
break;
case 'nbr_of_guests':
if ($("#nbr_of_guests_" + eid).val() > '1') {
$("#guest_name_" + eid).prop('disabled', false);
} else {
$("#guest_name_" + eid).prop('disabled', true);
$("#guest_name_" + eid).val('');
}
break;
}
$('#ajax_update').load('ajax.php?call=event_ajax&function=guest' +
'&gid=' + gid +
'&eid=' + eid +
'&rsvp_1=' + val_checkbox($('#rsvp_1_' + eid + ':checked').val()) +
'&conf_1=' + val_checkbox($('#conf_1_' + eid + ':checked').val()) +
'&cancel_1=' + val_checkbox($('#cancel_1_' + eid + ':checked').val()) +
'&attended_1=' + val_checkbox($('#attended_1_' + eid + ':checked').val()) +
'&wait_1=' + val_checkbox($('#wait_1_' + eid + ':checked').val()) +
'&rsvp_2=' + val_checkbox($('#rsvp_2_' + eid + ':checked').val()) +
'&conf_2=' + val_checkbox($('#conf_2_' + eid + ':checked').val()) +
'&cancel_2=' + val_checkbox($('#cancel_2_' + eid + ':checked').val()) +
'&attended_2=' + val_checkbox($('#attended_2_' + eid + ':checked').val()) +
'&wait_2=' + val_checkbox($('#wait_2_' + eid + ':checked').val()) +
'&nbr_of_guests=' + $('#nbr_of_guests_' + eid).val() +
'&guest_name=' + $('#guest_name_' + eid).val() +
'&invitor=' + encodeURIComponent($('#invitor_' + eid).val()),
function() {
if ($('#ajax_update').html().toLowerCase == 'error')
alert('Error!');
});
}
update_header = function() {
if ($("#first_name").val() > "" && $("#last_name").val() > "") {
$("#header_repeater").text(" - " + $("#first_name").val() + ' ' + $("#last_name").val());
}
}
$(document).ready(function() {
switch_tab('<?php echo $active_tab; ?>');
update_header();
$(':input:not(.search)').change(function() {
sheet_dirty = true;
});
})
</script>
<h1>Guest - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>
<form name="frm_guest" id="frm_guest" 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">
<?php
form_tab_header('basic_info', 'Basic Info', 'admin,eventmgr');
if (!empty($_REQUEST['id'])) :
form_tab_header('events', 'Events', 'admin,eventmgr');
endif;
?>
</div>
<div class="cleardiv">
</div>
<div class="tab_content" id="tab_content_basic_info">
<div class="form_header">
Basic Info
</div>
<div class="input_column">
<?php
form_field('guest_id', 'text', 10, 0, false, false, true, '', '', 'guest_id', 'Guest ID');
form_field('first_name', 'text', 50, 0, true, false, false, '', '', 'first_name', 'First Name', array(), '', 'update_header();');
form_field('last_name', 'text', 50, 0, true, false, false, '', '', 'last_name', 'Last Name', array(), '', 'update_header();');
form_field('title', 'text', 50, 0, false, false, false, '', '', 'title', 'Title');
form_field('company', 'text', 75, 0, true, false, false, '', '', 'company', 'Company');
form_field('address', 'text', 75, 0, false, false, false, '', '', 'address', 'Address');
form_field('phone', 'text', 50, 0, true, false, false, '', '', 'phone', 'Phone');
form_field('email', 'text', 50, 0, true, false, false, '', '', 'email', 'Email');
$sql = "SELECT association_id, name FROM associations ORDER BY name ";
$result = $db->query($sql) or die('Database Error!');
$ar_associations = $result->fetchAll(PDO::FETCH_KEY_PAIR);
form_field('association_id', 'select', 50, 0, false, false, false, '', '', 'association_id', 'Association', $ar_associations);
form_field('active', 'checkbox', 50, 0, false, false, false, '', '', 'active', 'Active');
?>
</div>
<div class="input_column">
<?php
form_field('comments', 'textarea', 70, 9, false, false, false, '', '', 'comments', 'Comments');
?>
</div>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_content" id="tab_content_events">
<div class="form_header">
Events
</div>
<div id="ajax_update" style="width:1px; height:1px; display:none;">
</div>
<?php
$ix_form = 'event_form';
db_navigator_bar(array('table_id' => 'db_grid_events', 'form' => $ix_form, 'print_section' => 'db_grid_events', 'call' => 'guest_events_ajax', 'sort_col' => '2', 'sort_order' => '1', 'subtab' => 'true', 'parm1' => " " . nz($_REQUEST['id'], '0') . " ", 'func' => 'grid'));
?>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<?php form_button_strip('bottom'); ?>
</form>