| 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 : |
<?php include('_mod_security.php'); ?>
<?php
if ($_POST['ajax_event_submitted'] == '1') :
foreach($_POST as $key=>$value) :
if (substr($key, 0, 7) == 'hon_id_') :
$hon_id = substr($key, 7);
if (!empty($_POST['honor_'.$hon_id]) || !empty($_POST['honor_desc_'.$hon_id]) || !empty($_POST['guest_id_mask_'.$hon_id]) || !empty($_POST['personal_name_'.$hon_id]) || !empty($_POST['hebrew_name_'.$hon_id]) || !empty($_POST['comments_'.$hon_id])) :
if (empty($_POST['honor_'.$hon_id])) :
$ar_err['honor_'.$hon_id] = 'Honor is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (empty($_POST['guest_id_'.$hon_id.'_mask'])) :
$ar_err['guest_id_'.$hon_id] = 'Guest name is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (empty($_POST['guest_id_'.$hon_id])) :
$ar_err['guest_id_'.$hon_id] = 'Guest name not in guest list!';
$err_flag = true;
$err_tab = 'general';
endif;
endif;
endif;
endforeach;
if (!$err_flag) :
foreach($_POST as $key=>$value) :
if (substr($key, 0, 7) == 'hon_id_') :
$hon_id = substr($key, 7);
$set =
"seq = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['seq_'.$hon_id])),'0').", ".
"honor = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['honor_'.$hon_id]))."', ".
"honor_desc = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['honor_desc_'.$hon_id]))."', ".
"guest_id = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['guest_id_'.$hon_id])),'0').", ".
"personal_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['personal_name_'.$hon_id]))."', ".
"hebrew_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['hebrew_name_'.$hon_id]))."', ".
"comments = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['comments_'.$hon_id]))."' ";
if ($hon_id == 'new') :
if (!empty($_POST['honor_'.$hon_id]) || !empty($_POST['honor_desc_'.$hon_id]) || !empty($_POST['guest_id_mask_'.$hon_id]) || !empty($_POST['personal_name_'.$hon_id]) || !empty($_POST['hebrew_name_'.$hon_id]) || !empty($_POST['comments_'.$hon_id])) :
$sql = "INSERT INTO honors SET ".
"user_id = ".$_SESSION['user_id'].", ".
"event_id = ".$_SESSION['active_event'].", ".
$set;
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
endif;
else :
if (mysqli_real_escape_string($GLOBALS['con'], trim($_POST['hon_del_'.$hon_id])) == '1') :
$sql = "DELETE FROM honors WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['hon_id_'.$hon_id]))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
else :
$sql = "UPDATE honors SET ".
$set.
"WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['hon_id_'.$hon_id]))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
endif;
endif;
endif;
endforeach;
// ----- Reset honors after successful update ----
$sql = "SELECT * FROM honors WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY seq, id ";
$result = mysqli_query($GLOBALS['con'], $sql);
while($row = mysqli_fetch_object($result)) :
$_POST['seq_'.$row->id] = $row->seq;
$_POST['honor_'.$row->id] = $row->honor;
$_POST['honor_desc_'.$row->id] = $row->honor_desc;
$_POST['guest_id_'.$row->id] = $row->guest_id;
$_POST['personal_name_'.$row->id] = $row->personal_name;
$_POST['hebrew_name_'.$row->id] = $row->hebrew_name;
$_POST['comments_'.$row->id] = $row->comments;
endwhile;
unset($_POST['hon_id_new']);
unset($_POST['honor_new']);
unset($_POST['honor_new_mask']);
unset($_POST['honor_desc_new']);
unset($_POST['guest_id_new']);
unset($_POST['guest_id_new_mask']);
unset($_POST['personal_name_new']);
unset($_POST['hebrew_name_new']);
unset($_POST['comments_new']);
$form_message = "Saved sucessfully!";
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else :
$sql = "SELECT * FROM honors WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY seq, id ";
$result = mysqli_query($GLOBALS['con'], $sql);
while($row = mysqli_fetch_object($result)) :
$_POST['seq_'.$row->id] = $row->seq;
$_POST['honor_'.$row->id] = $row->honor;
$_POST['honor_desc_'.$row->id] = $row->honor_desc;
$_POST['guest_id_'.$row->id] = $row->guest_id;
$_POST['personal_name_'.$row->id] = $row->personal_name;
$_POST['hebrew_name_'.$row->id] = $row->hebrew_name;
$_POST['comments_'.$row->id] = $row->comments;
endwhile;
endif;
//var_dump($_POST);
$xls_sql = "SELECT h.honor, h.honor_desc, g.salutation, g.last_name, g.first_name, g.middle_name, g.suffix, h.personal_name, h.hebrew_name, h.comments FROM honors h INNER JOIN guests g ON (h.guest_id = g.id AND h.user_id = g.user_id AND h.event_id = g.event_id) WHERE h.user_id = ".$_SESSION['user_id']." AND h.event_id = ".$_SESSION['active_event']." ORDER BY h.seq, h.id";
$ix_list = "honors";
$ix_form = "guest_form&ref=rsvp";
?>
<script>
var ar_seq = [];
var ix = 0;
hon_delete = function(hon_id)
{
var answer = confirm('Are you sure? Make sure to SAVE the record for the deletion to take effect!');
if (answer == true)
{
$("#hon_del_" + hon_id).val('1');
$("#hon_row_" + hon_id).hide();
}
}
hon_move_up = function(hon_id)
{
var row = $('#hon_row_' + hon_id);
if (row.prev().attr('id') != 'hon_row_header')
{
var cur_seq = $('#seq_' + hon_id).val();
var new_seq = row.prev().find('input[id^="seq_"]').first().val();
$('#seq_' + hon_id).val(new_seq);
row.prev().find('input[id^="seq_"]').first().val(cur_seq);
row.insertBefore(row.prev());
}
}
hon_move_down = function(hon_id)
{
var row = $('#hon_row_' + hon_id);
if (row.next().attr('id') != 'hon_row_footer')
{
var cur_seq = $('#seq_' + hon_id).val();
var new_seq = row.next().find('input[id^="seq_"]').first().val();
$('#seq_' + hon_id).val(new_seq);
row.next().find('input[id^="seq_"]').first().val(cur_seq);
row.insertAfter(row.next());
}
}
$(document).ready(function()
{
/*
$(".up,.down").click(function()
{
var row = $(this).parents("tr:first");
if ($(this).is(".up")) {
row.insertBefore(row.prev());
} else {
row.insertAfter(row.next());
}
});
*/
})
// ****** Prepare popup form settings *****
var win_page = 'page_form.php';
var win_width = 600;
var win_height = 400;
var print_section = 'div_db_grid';
</script>
<h1>Ceremony Honors Worksheet</h1>
<?php
if (empty($_SESSION['active_event'])) :
?>
<h3>No Bar/Bat Mitzvah defined - please create or activate a Bar/Bat Mitzvah!</h3>
<?php
endif;
?>
<?php get_reports('honors'); ?>
<?php get_notes(); ?>
<?php get_help_guide('help_honors'); ?>
<?php echo form_message($form_message); ?>
<?php //include('mod/_db_navigator_bar.php'); ?>
<div id="ajax_update" style="width:1px; height:1px; display:none;">
</div>
<form style="" name="frm_honors" id="frm_honors" method="post" action="" >
<input name="ajax_event_submitted" type="hidden" value="1" />
<div class="db-grid" id="div_db_grid">
<table class="dbgrid" align="center" cellpadding="0" cellspacing="1" border="0" >
<thead>
<tr id="hon_row_header">
<td class="data-grid-label">
Sequence
</td>
<td width="145" align="center" class="data-grid-label">
Honor
</td>
<td width="120" align="center" class="data-grid-label">
Description
</td>
<td width="145" align="center" class="data-grid-label">
Guest Name
</td>
<td width="130" align="center" class="data-grid-label">
Personal Name
</td>
<td width="130" align="center" class="data-grid-label">
Hebrew Name
</td>
<td width="130" align="center" class="data-grid-label">
Comment
</td>
<td class="data-grid-label">
Delete
</td>
</tr>
</thead>
<tbody>
<?php
//mysqli_data_seek($result,0);
$seq_max = 0;
$sql = "SELECT * FROM honors WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY seq, id ";
$result = mysqli_query($GLOBALS['con'], $sql);
while($row = mysqli_fetch_object($result)) :
//var_dump($row);
//echo $row->id.' '.$row->guest_id.'<br />';
?>
<tr id="hon_row_<?php echo $row->id; ?>">
<td class="data-grid-var" align="center">
<input type="hidden" name="hon_id_<?php echo $row->id; ?>" id="hon_id_<?php echo $row->id; ?>" value="<?php echo $row->id; ?>" />
<input type="hidden" name="seq_<?php echo $row->id; ?>" id="seq_<?php echo $row->id; ?>" value="<?php echo $row->seq; ?>" />
<input type="hidden" name="hon_del_<?php echo $row->id; ?>" id="hon_del_<?php echo $row->id; ?>" value="0" />
<a class="up" href="javascript:hon_move_up(<?php echo $row->id; ?>);"><img src="img/arrow_up.png" style="border:none;" /></a>
<a class="down" href="javascript:hon_move_down(<?php echo $row->id; ?>);"><img src="img/arrow_down.png" style="border:none;" /></a>
</td>
<td class="data-grid-var" >
<?php
auto_complete('honor_'.$row->id, $_POST['honor_'.$row->id], $_POST['honor_'.$row->id], "SELECT honor_desc, honor_desc FROM honors_template ORDER BY seq, honor_desc ", false, 145);
?>
<?php show_form_error($ar_err['honor_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<input name="honor_desc_<?php echo $row->id; ?>" id="honor_desc_<?php echo $row->id; ?>" type="text" maxlength="100" style="width:120px;" value="<?php echo $_POST['honor_desc_'.$row->id]; ?>" />
<?php show_form_error($ar_err['honor_desc_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<?php
auto_complete('guest_id_'.$row->id, $_POST['guest_id_'.$row->id], format_guest_name($_POST['guest_id_'.$row->id]), "SELECT id, CONCAT_WS(' ',IF(TRIM(salutation) > '',TRIM(salutation),NULL), IF(TRIM(first_name) > '',TRIM(first_name),NULL), IF(TRIM(last_name) > '',TRIM(last_name),NULL), IF(TRIM(suffix) > '',TRIM(suffix),NULL)) AS formatted_name FROM guests WHERE guest_type <> 'G' AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ", true, 145);
?>
<?php show_form_error($ar_err['guest_id_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<input name="personal_name_<?php echo $row->id; ?>" id="personal_name_<?php echo $row->id; ?>" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['personal_name_'.$row->id]; ?>" />
<?php show_form_error($ar_err['personal_name_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<input name="hebrew_name_<?php echo $row->id; ?>" id="hebrew_name_<?php echo $row->id; ?>" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['hebrew_name_'.$row->id]; ?>" />
<?php show_form_error($ar_err['hebrew_name_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<input name="comments_<?php echo $row->id; ?>" id="comments_<?php echo $row->id; ?>" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['comments_'.$row->id]; ?>" />
<?php show_form_error($ar_err['comments_'.$row->id]); ?>
</td>
<td class="data-grid-var" align="center">
<a href="javascript:hon_delete(<?php echo $row->id; ?>);"><img src="img/delete_icon.gif" style="border:none;" /></a>
</td>
</tr>
<?php
$seq_max = $seq_mqx + $row->seq;
endwhile;
$seq_max = $seq_max + 100;
?>
<tr id="hon_row_footer">
<td colspan="8">
Add new honor below ↓ ↓
</td>
</tr>
<tr id="hon_row_new">
<td class="data-grid-var" align="center">
<input type="hidden" name="hon_id_new" id="hon_id_new" value="new" />
<input type="hidden" name="seq_new" id="seq_new" value="<?php echo $seq_max; ?>" />
</td>
<td class="data-grid-var" >
<?php
auto_complete('honor_new', $_POST['honor_new'], $_POST['honor_new'], "SELECT honor_desc, honor_desc FROM honors_template ORDER BY seq, honor_desc ", false, 145);
?>
<?php show_form_error($ar_err['honor_new']); ?>
</td>
<td class="data-grid-var" >
<input name="honor_desc_new" id="honor_desc_new" type="text" maxlength="100" style="width:120px;" value="<?php echo $_POST['honor_desc_new']; ?>" />
<?php show_form_error($ar_err['honor_desc_new']); ?>
</td>
<td class="data-grid-var" >
<?php
auto_complete('guest_id_new', $_POST['guest_id_new'], format_guest_name($_POST['guest_id_new']), "SELECT id, CONCAT_WS(' ',IF(TRIM(salutation) > '',TRIM(salutation),NULL), IF(TRIM(first_name) > '',TRIM(first_name),NULL), IF(TRIM(last_name) > '',TRIM(last_name),NULL), IF(TRIM(suffix) > '',TRIM(suffix),NULL)) AS formatted_name FROM guests WHERE guest_type <> 'G' AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ", true, 145);
//auto_complete('guest_id_new', $_POST['guest_id_new'], $_POST['guest_id_new'], "SELECT id, CONCAT_WS(' ',IF(TRIM(salutation) > '',TRIM(salutation),NULL), IF(TRIM(first_name) > '',TRIM(first_name),NULL), IF(TRIM(last_name) > '',TRIM(last_name),NULL), IF(TRIM(suffix) > '',TRIM(suffix),NULL)) AS formatted_name FROM guests WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ", true, 145);
?>
<?php show_form_error($ar_err['guest_id_new']); ?>
</td>
<td class="data-grid-var" >
<input name="personal_name_new" id="personal_name_new" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['personal_name_new']; ?>" />
<?php show_form_error($ar_err['personal_name_new']); ?>
</td>
<td class="data-grid-var" >
<input name="hebrew_name_new" id="hebrew_name_new" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['hebrew_name_new']; ?>" />
<?php show_form_error($ar_err['hebrew_name_new']); ?>
</td>
<td class="data-grid-var" >
<input name="comments_new" id="comments_new" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['comments_new']; ?>" />
<?php show_form_error($ar_err['comments_new']); ?>
</td>
<td class="data-grid-var" align="center">
</td>
</tr>
</tbody>
</table>
</div>
<div class="form_strip" style="border:none;">
<input type="button" name="xsubmit" value="Save" onclick="this.form.submit();" />
<input type="button" value="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=ez_guide'" />
<input type="button" value="Excel ®" onclick="exportExcel('<?php echo urlencode(sys_encrypt(gzcompress($xls_sql,6), $_SESSION['rand_key'])); ?>');" />
<input type="button" value="Print" onclick="printSection(print_section);" />
<input type="button" value="PDF" onclick="pdfSection(print_section);" />
</div>
</form>