| 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) == 'can_id_') :
$can_id = substr($key, 7);
if (!empty($_POST['candle_'.$can_id]) || !empty($_POST['guest_names_'.$can_id.'_mask']) || !empty($_POST['nickname_'.$can_id]) || !empty($_POST['song_'.$can_id]) || !empty($_POST['comments_'.$can_id])) :
if (empty($_POST['candle_'.$can_id])) :
$ar_err['candle_'.$can_id] = 'Candle is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (empty($_POST['guest_names_'.$can_id.'_mask'])) :
$ar_err['guest_names_'.$can_id] = 'Guest name(s) are required!';
$err_flag = true;
$err_tab = 'general';
endif;
/*
if (empty($_POST['guest_id_'.$can_id])) :
$ar_err['guest_id_'.$can_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) == 'can_id_') :
$can_id = substr($key, 7);
$set =
"seq = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['seq_'.$can_id])),'0').", ".
"candle = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['candle_'.$can_id]))."', ".
"guest_names = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['guest_names_'.$can_id.'_mask']))."', ".
"nickname = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['nickname_'.$can_id]))."', ".
"song = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['song_'.$can_id]))."', ".
"comments = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['comments_'.$can_id]))."' ";
if ($can_id == 'new') :
if (!empty($_POST['candle_'.$can_id]) || !empty($_POST['guest_names_'.$can_id.'_mask']) || !empty($_POST['nickname_'.$can_id]) || !empty($_POST['song_'.$can_id]) || !empty($_POST['comments_'.$can_id])) :
$sql = "INSERT INTO candles 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['can_del_'.$can_id])) == '1') :
$sql = "DELETE FROM candles WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['can_id_'.$can_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 candles SET ".
$set.
"WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['can_id_'.$can_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 candles after successful update ----
$sql = "SELECT * FROM candles 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['candle_'.$row->id] = $row->candle;
$_POST['guest_names_'.$row->id] = $row->guest_names;
$_POST['nickname_'.$row->id] = $row->nickname;
$_POST['song_'.$row->id] = $row->song;
$_POST['comments_'.$row->id] = $row->comments;
endwhile;
unset($_POST['can_id_new']);
unset($_POST['candle_new']);
unset($_POST['candle_new_mask']);
unset($_POST['guest_names_new']);
unset($_POST['guest_names_new_mask']);
unset($_POST['nickname_new']);
unset($_POST['song_new']);
unset($_POST['comments_new']);
$form_message = "Saved sucessfully!";
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else :
$sql = "SELECT * FROM candles 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['candle_'.$row->id] = $row->candle;
$_POST['guest_names_'.$row->id] = $row->guest_names;
$_POST['nickname_'.$row->id] = $row->nickname;
$_POST['song_'.$row->id] = $row->song;
$_POST['comments_'.$row->id] = $row->comments;
endwhile;
endif;
//var_dump($_POST);
$xls_sql = "SELECT candle, guest_names, nickname, song, comments FROM candles WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY seq, id";
$ix_list = "candles";
$ix_form = "guest_form&ref=rsvp";
?>
<script>
var ar_seq = [];
var ix = 0;
can_delete = function(can_id)
{
var answer = confirm('Are you sure? Make sure to SAVE the record for the deletion to take effect!');
if (answer == true)
{
$("#can_del_" + can_id).val('1');
$("#can_row_" + can_id).hide();
}
}
can_move_up = function(can_id)
{
var row = $('#can_row_' + can_id);
if (row.prev().attr('id') != 'can_row_header')
{
var cur_seq = $('#seq_' + can_id).val();
var new_seq = row.prev().find('input[id^="seq_"]').first().val();
$('#seq_' + can_id).val(new_seq);
row.prev().find('input[id^="seq_"]').first().val(cur_seq);
row.insertBefore(row.prev());
}
}
can_move_down = function(can_id)
{
var row = $('#can_row_' + can_id);
if (row.next().attr('id') != 'can_row_footer')
{
var cur_seq = $('#seq_' + can_id).val();
var new_seq = row.next().find('input[id^="seq_"]').first().val();
$('#seq_' + can_id).val(new_seq);
row.next().find('input[id^="seq_"]').first().val(cur_seq);
row.insertAfter(row.next());
}
}
copy_guest_names = function(can_id)
{
$('#guest_names_' + can_id).val($('#guest_names_' + can_id + '_mask').val());
}
$(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>Candle Lighting 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('candlelighting'); ?>
<?php get_notes(); ?>
<?php get_help_guide('help_candles'); ?>
<?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_candles" id="frm_candles" 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="can_row_header">
<td class="data-grid-label">
Sequence
</td>
<td width="145" align="center" class="data-grid-label">
Candle
</td>
<td width="225" align="center" class="data-grid-label">
Guest Name(s)
</td>
<td width="130" align="center" class="data-grid-label">
Nickname
</td>
<td width="130" align="center" class="data-grid-label">
Song
</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);
$sql = "SELECT * FROM candles WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY seq, id ";
$result = mysqli_query($GLOBALS['con'], $sql);
$seq_max = 0;
$sql_guest = "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))";
while($row = mysqli_fetch_object($result)) :
?>
<tr id="can_row_<?php echo $row->id; ?>">
<td class="data-grid-var" align="center">
<input type="hidden" name="can_id_<?php echo $row->id; ?>" id="can_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="can_del_<?php echo $row->id; ?>" id="can_del_<?php echo $row->id; ?>" value="0" />
<a class="up" href="javascript:can_move_up(<?php echo $row->id; ?>);"><img src="img/arrow_up.png" style="border:none;" /></a>
<a class="down" href="javascript:can_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('candle_'.$row->id, $_POST['candle_'.$row->id], $_POST['candle_'.$row->id], "SELECT candle_desc, candle_desc FROM candles_template ORDER BY seq, candle_desc ", false, 145);
?>
<?php show_form_error($ar_err['candle_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<?php
auto_complete('guest_names_'.$row->id, $_POST['guest_names_'.$row->id], $_POST['guest_names_'.$row->id], "SELECT ".$sql_guest." AS formatted_name_data, ".$sql_guest." AS formatted_name FROM guests WHERE guest_type <> 'G' AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ", false, 225, null, null, "copy_guest_names('".$row->id."');");
?>
<?php show_form_error($ar_err['guest_names_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<input name="nickname_<?php echo $row->id; ?>" id="nickname_<?php echo $row->id; ?>" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['nickname_'.$row->id]; ?>" />
<?php show_form_error($ar_err['nickname_'.$row->id]); ?>
</td>
<td class="data-grid-var" >
<input name="song_<?php echo $row->id; ?>" id="song_<?php echo $row->id; ?>" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['song_'.$row->id]; ?>" />
<?php show_form_error($ar_err['song_'.$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:can_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="can_row_footer">
<td colspan="7">
Add new candle below ↓ ↓
</td>
</tr>
<tr id="can_row_new">
<td class="data-grid-var" align="center">
<input type="hidden" name="can_id_new" id="can_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('candle_new', $_POST['candle_new'], $_POST['candle_new'], "SELECT candle_desc, candle_desc FROM candles_template ORDER BY seq, candle_desc ", false, 145);
?>
<?php show_form_error($ar_err['candle_new']); ?>
</td>
<td class="data-grid-var" >
<?php
auto_complete('guest_names_new', $_POST['guest_names_new'], format_guest_name($_POST['guest_names_new']), "SELECT ".$sql_guest." AS formatted_name_data, ".$sql_guest." AS formatted_name FROM guests WHERE guest_type <> 'G' AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ", false, 225, null, null, "copy_guest_names('new');");
?>
<?php show_form_error($ar_err['guest_names_new']); ?>
</td>
<td class="data-grid-var" >
<input name="nickname_new" id="nickname_new" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['nickname_new']; ?>" />
<?php show_form_error($ar_err['nickname_new']); ?>
</td>
<td class="data-grid-var" >
<input name="song_new" id="song_new" type="text" maxlength="100" style="width:130px;" value="<?php echo $_POST['song_new']; ?>" />
<?php show_form_error($ar_err['song_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>