| Server IP : 104.21.21.239 / Your IP : 216.73.217.99 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/wwwdevplanner/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
switch($_GET['func']) :
case 'load_labels' :
$sql = "SELECT * FROM labels WHERE manufacturer = '".mysqli_real_escape_string($GLOBALS['con'], $_GET['manufacturer'])."' AND feed_type = 'S' ORDER BY label_name ";
$result = mysqli_query($GLOBALS['con'], $sql);
echo '<select name="label_id" id="label_id" onchange="load_label_details($(this).val())">';
while($row = mysqli_fetch_object($result)) :
echo '<option value="'.$row->id.'">'.$row->label_name.'</option>';
endwhile;
echo '</select>';
break;
case 'load_label_details' :
$sql = "SELECT * FROM labels WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], $_GET['id'])." ";
$result = mysqli_query($GLOBALS['con'], $sql);
if (mysqli_num_rows($result) > 0) :
$row = mysqli_fetch_object($result);
if ($row->unit_measure == 'mm') :
$uom_factor = 100.0;
$uom_unit = ' mm';
$uom_dec = 0;
elseif ($row->unit_measure == 'in') :
$uom_factor = 2540.0;
$uom_unit = ' in.';
$uom_dec = 3;
endif;
$page_dimension_x = $row->margin_left + ($row->horiz_pitch * $row->columns) * 1.0;
$page_dimension_y = $row->margin_top + ($row->vert_pitch * $row->rows) * 1.0;
if ($page_dimension_y > $page_dimension_x) :
$orientation = 'P';
else :
$orientation = 'L';
endif;
$detail = '<table>';
$detail .= '<tr><td>Width:</td><td>'.number_format($row->width / $uom_factor, $uom_dec).$uom_unit.'</td></tr>';
$detail .= '<tr><td>Height:</td><td>'.number_format($row->height / $uom_factor, $uom_dec).$uom_unit.'</td></tr>';
$detail .= '<tr><td>Horiz. pitch:</td><td>'.number_format($row->horiz_pitch / $uom_factor, $uom_dec).$uom_unit.'</td></tr>';
$detail .= '<tr><td>Vert. pitch:</td><td>'.number_format($row->vert_pitch / $uom_factor, $uom_dec).$uom_unit.'</td></tr>';
$detail .= '<tr><td>Left margin:</td><td>'.number_format($row->margin_left / $uom_factor, $uom_dec).$uom_unit.'</td></tr>';
$detail .= '<tr><td>Top margin:</td><td>'.number_format($row->margin_top / $uom_factor, $uom_dec).$uom_unit.'</td></tr>';
$detail .= '<tr><td>Across:</td><td>'.$row->columns.'</td></tr>';
$detail .= '<tr><td>Down:</td><td>'.$row->rows.'</td></tr>';
$detail .= '</table>';
$layout = '<table style="width:100%; height:100%" cellspacing="2">';
for ($r = 1; $r <= $row->rows; $r++) :
$layout .= '<tr>';
for ($c = 1; $c <= $row->columns; $c++) :
$layout .= '<td class="label_active" id="layout_cell_'.$r.'_'.$c.'" onclick="set_starting_label('.$r.','.$c.')"> ';
$layout .= '</td>';
endfor;
$layout .= '</tr>';
endfor;
$layout .= '</table>';
echo json_encode(array('label_details' => $detail,
'label_layout' => $layout,
'label_width' => $row->width,
'label_height' => $row->height,
'label_horiz_pitch' => $row->horiz_pitch,
'label_vert_pitch' => $row->vert_pitch,
'label_margin_left' => $row->margin_left,
'label_margin_top' => $row->margin_top,
'label_columns' => $row->columns,
'label_rows' => $row->rows,
'label_unit_measure' => $row->unit_measure,
'label_orientation' => $orientation
));
endif;
break;
case 'load_label_guests' :
//var_dump($_GET);
if ($_GET['rpt'] == 'invitation_labels') :
$sql = "SELECT g.id, g.invitation_text, g.salutation, g.first_name, g.last_name, g.suffix ".
"FROM guests g WHERE (g.invite_temple = 1 OR g.invite_av = 1 OR g.invite_kv = 1 OR g.invite_dv = 1 OR g.invite_bv = 1) AND g.invitation_send = 1 ".
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_GET['rpt'] == 'thank_you_labels') :
$sql = "SELECT g.id, g.invitation_text, g.salutation, g.first_name, g.last_name, g.suffix ".
"FROM guests g WHERE g.gift_received = 1 AND g.gift_thank_you <> 1 ".
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_GET['rpt'] == 'favor_labels') :
$sql = "SELECT g.id, g.first_name, g.last_name ".
"FROM guests g INNER JOIN guests_favors gf ON (g.id = gf.guest_id) WHERE g.rsvp_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])." = 1 AND gf.favor_id = ".mysqli_real_escape_string($GLOBALS['con'], $_GET['fid'])." ".
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_GET['rpt'] == 'placecard_labels') :
$sql = "SELECT g.id, g.placecard_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])."_text, g.salutation, g.first_name, g.last_name, g.suffix FROM guests g INNER JOIN tables t ON (g.table_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])." = t.id) ".
"WHERE g.guest_type <> 'G' AND g.invite_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])." = 1 AND g.rsvp_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])." = 1 AND g.placecard_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])." = 1 ".
"AND g.user_id = ".$_SESSION['user_id']." AND g.event_id = ".$_SESSION['active_event']." ".
"ORDER BY g.last_name, g.first_name";
endif;
//echo $sql.'=====';
$result = mysqli_query($GLOBALS['con'], $sql);
if (mysqli_num_rows($result) > 0) :
while($row = mysqli_fetch_object($result)) :
if (!empty($row->invitation_text)) :
$guest_text = $row->invitation_text;
elseif (!empty($row->{"placecard_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])."_text"})) :
$guest_text = $row->{"placecard_".mysqli_real_escape_string($GLOBALS['con'], $_GET['venue'])."_text"};
else :
$guest_text = format_guest_name_string($row->salutation, $row->first_name, $row->last_name, $row->suffix);
endif;
echo '<input type="checkbox" name="label_specific_id_list[]" value="'.$row->id.'" /> '.$guest_text.'<br />';
endwhile;
else :
echo 'No data for report!';
endif;
break;
case 'generate_pdf' :
ini_set('display_errors', '0');
ini_set("pcre.backtrack_limit","10000000");
ini_set("memory_limit","1024M");
include("mpdf61/mpdf.php");
if ($_POST['label_unit_measure'] == 'in') :
$format = 'Letter';
elseif ($_POST['label_unit_measure'] == 'mm' && $_POST['manufacturer'] == 'Herma A5') :
$format = 'A5';
else :
$format = 'A4';
endif;
$margin_top = $_POST['label_margin_top'] / 100;
$margin_left = $_POST['label_margin_left'] / 100;
$margin_bottom = 0;
$margin_right = 0;
$cell_spacing_horiz = ($_POST['label_horiz_pitch'] - $_POST['label_width']) / 100;
$cell_spacing_vert = ($_POST['label_vert_pitch'] - $_POST['label_height']) /100;
$cell_width = $_POST['label_width'] / 100;
$cell_height = $_POST['label_height'] / 100;
$cell_horiz_pitch = $_POST['label_horiz_pitch'] / 100;
$cell_vert_pitch = $_POST['label_vert_pitch'] / 100;
$inner_cell_width = $cell_width * 0.95;
$inner_cell_height = $cell_height * 0.95;
$inner_cell_margin_left = $cell_width * 0.04;
$inner_cell_margin_top = $cell_height * 0.02;
$line_height_factor = ($_POST['font_size'] + 1) / ($_POST['font_size']);
$page_dimension_x = $margin_left + ($cell_horiz_pitch * $_POST['label_columns']) * 1.0;
$page_dimension_y = $margin_top + ($cell_vert_pitch * $_POST['label_rows']) * 1.0;
if ($page_dimension_y > $page_dimension_x) :
$orientation = '';
else :
$orientation = '-L';
endif;
$alignment = $_POST['alignment'];
$mpdf=new mPDF('',$format.$orientation,'','',$margin_left,$margin_right,$margin_top,$margin_bottom,0,0, $orientation);
$mpdf->debug = false;
$mpdf->useOnlyCoreFonts = false; // false is default
//$mpdf->SetAutoFont(AUTOFONT_RTL);
$mpdf->keep_table_proportions = true;
$mpdf->SetProtection(array('copy','print','modify','annot-forms','fill-forms','extract','assemble','print-highres'), '', '');
$mpdf->SetTitle("MitzvahOrganizer.com - Report");
$mpdf->SetAuthor("MitzvahOrganizer.com");
$mpdf->SetDisplayMode('fullpage');
$html = '<html><body style="font-family: '.$_POST['font_style'].'; font-size: '.$_POST['font_size'].'pt; line-height: '.($_POST['font_size'] + 1).'pt; ">';
/*
ob_start();
var_dump($_POST);
$result = ob_get_clean();
$html .= $result;
*/
$current_venue = mysqli_real_escape_string($GLOBALS['con'], trim($_POST['venue']));
$guest_id_list = '';
if ($_POST['print_selection'] == 'specific') :
$guest_id_list = implode(',', $_POST['label_specific_id_list']);
$guest_id_list = ' AND g.id IN ('.$guest_id_list.') ';
endif;
if ($_POST['rpt'] == 'invitation_labels') :
$sql = "SELECT g.*,(SELECT s.state_name from states s WHERE s.state = g.state) AS state_name ".
"FROM guests g WHERE (g.invite_temple = 1 OR g.invite_av = 1 OR g.invite_kv = 1 OR g.invite_dv = 1 OR g.invite_bv = 1) AND g.invitation_send = 1 ".$guest_id_list.
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_POST['rpt'] == 'thank_you_labels') :
$sql = "SELECT g.*,(SELECT s.state_name from states s WHERE s.state = g.state) AS state_name ".
"FROM guests g WHERE g.gift_received = 1 AND g.gift_thank_you <> 1 ".$guest_id_list.
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_POST['rpt'] == 'favor_labels') :
$sql = "SELECT g.id, g.first_name, g.last_name, gf.size, gf.gender ".
"FROM guests g INNER JOIN guests_favors gf ON (g.id = gf.guest_id) WHERE g.rsvp_".mysqli_real_escape_string($GLOBALS['con'], $_POST['venue'])." = 1 AND gf.favor_id = ".nz(mysqli_real_escape_string($GLOBALS['con'], $_POST['favor_selection']),'0')." ".$guest_id_list.
"AND g.user_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['user_id'])." AND g.event_id = ".mysqli_real_escape_string($GLOBALS['con'], $_SESSION['active_event'])." ORDER BY g.last_name, g.first_name ";
elseif ($_POST['rpt'] == 'placecard_labels') :
$sql = "SELECT g.*, t.table_no, t.table_desc FROM guests g INNER JOIN tables t ON (g.table_".$current_venue." = t.id) ".
"WHERE g.guest_type <> 'G' AND g.invite_".$current_venue." = 1 AND g.rsvp_".$current_venue." = 1 AND g.placecard_".$current_venue." = 1 ".$guest_id_list.
"AND g.user_id = ".$_SESSION['user_id']." AND g.event_id = ".$_SESSION['active_event']." ".
"ORDER BY g.last_name, g.first_name";
endif;
$result = mysqli_query($GLOBALS['con'], $sql);
$row_count = mysqli_num_rows($result);
$page_count = 0;
$print_on = false;
$row_ix = 0;
if ($row_count > 0) :
while($row_ix < $row_count) :
$page_count = $page_count + 1;
if ($_POST['print_direction'] == 'ad') :
for ($r = 1; $r <= $_POST['label_rows']; $r++) :
for ($c = 1; $c <= $_POST['label_columns']; $c++) :
format_label();
endfor;
endfor;
else :
for ($c = 1; $c <= $_POST['label_columns']; $c++) :
for ($r = 1; $r <= $_POST['label_rows']; $r++) :
format_label();
endfor;
endfor;
endif;
if ($row_ix < $row_count) :
$html .= '<pagebreak />';
endif;
endwhile;
else :
$html .= 'No data for report!';
endif;
//$html .= 'dimension x: '.$page_dimension_x.' y: '.$page_dimension_y.' orientation: '.$orientation;
$html .= '</body></html>';
$mpdf->WriteHTML($html);
$mpdf->Output();
break;
endswitch;
function format_label()
{
global $row, $result, $row_ix, $html, $print_on, $r, $c, $cell_width, $cell_height, $cell_left, $cell_top, $cell_horiz_pitch, $cell_vert_pitch, $inner_cell_width, $inner_cell_height, $inner_cell_margin_left, $inner_cell_margin_top, $line_height_factor, $current_venue, $alignment;
if (!$print_on) :
if ($r >= $_POST['label_start_row'] && $c >= $_POST['label_start_column']) :
$print_on = true;
endif;
endif;
$cell_left = ($c - 1) * $cell_horiz_pitch;
$cell_top = ($r - 1) * $cell_vert_pitch;
/*
if ($_POST['rpt'] == 'placecard_labels') :
$table_css = ' width:'.$inner_cell_width.'mm; text-align:center; ';
else :
$table_css = '';
endif;
*/
$table_css = ' width:'.$inner_cell_width.'mm; text-align:'.$alignment.'; ';
$html .= '<div style="position:fixed; overflow:hidden; width:'.$cell_width.'mm; height:'.$cell_height.'mm; left: '.$cell_left.'mm; top:'.$cell_top.'mm; " >';
$html .= '<div style="width:'.$inner_cell_width.'mm; height:'.$inner_cell_height.'mm; margin-left:'.$inner_cell_margin_left.'mm; margin-top:'.$inner_cell_margin_top.'mm; overflow:hidden; ">';
$html .= '<table style="overflow:hidden; line-height:'.$line_height_factor.';"><tr><td style="white-space:wrap; padding:0; padding-left:2mm; padding-right:2mm; height:'.$inner_cell_height.'mm; '.$table_css.'">';
if ($print_on) :
if ($row = mysqli_fetch_object($result)) :
$row_ix = $row_ix + 1;
if ($_POST['rpt'] == 'favor_labels') :
$html .= $row->first_name.' '.$row->last_name.'<br /><br />';
if (!empty($row->size) && $_POST['favor_print_size'] == '1') :
$html .= 'Size: '.$row->size.'<br />';
endif;
if (!empty($row->gender) && $_POST['favor_print_gender'] == '1') :
$html .= 'Gender: '.$row->gender.'<br />';
endif;
elseif ($_POST['rpt'] == 'placecard_labels') :
if (!empty($row->{'placecard_'.$current_venue.'_text'})) :
$html .= $row->{'placecard_'.$current_venue.'_text'};
else :
$html .= format_guest_name_string($row->salutation, $row->first_name, $row->last_name, $row->suffix);
endif;
if (!empty($row->{'placecard_'.$current_venue.'_text2'})) :
$html .= '<br />'.$row->{'placecard_'.$current_venue.'_text2'};
endif;
if ($_POST['placecard_table_numbers'] == '1') :
$html .= '<br />#'.$row->table_no.'';
endif;
if ($_POST['placecard_table_names'] == '1') :
$html .= '<br />'.$row->table_desc.'';
endif;
else :
if ($_POST['state_names'] == 'long' && !empty($row->state_name)) :
$row->state = $row->state_name;
endif;
$html .= format_address($row->invitation_text, $row->invitation_text2, $row->salutation, $row->first_name, $row->last_name, $row->suffix, $row->street, $row->street2, $row->city, $row->state, $row->zip, $row->country);
endif;
endif;
else :
$html .= ' ';
endif;
$html .= '</td></tr></table>';
$html .= '</div>';
$html .= '</div>';
}
?>