| 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/mitzvahm/planner/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
if (isset($_SESSION['user_id'])) :
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) :
$action = "Edit";
else :
$action = "Add New";
endif;
else :
exit();
endif;
//var_dump($_POST);
$active_tab = 'general';
if ($_POST['ajax_event_submitted'] == '1') :
if (isset($_POST['active_tab'])) :
$active_tab = $_POST['active_tab'];
else :
$active_tab = 'general';
endif;
$ar_err = array();
if (empty($_POST['description'])) :
$ar_err['description'] = 'Description is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (empty($_POST['venue'])) :
$ar_err['venue'] = 'Event is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (!$err_flag) :
$set = "description = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['description']))."', ".
"venue = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['venue']))."', ".
"size_xs = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['size_xs'])),'0').", ".
"size_s = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['size_s'])),'0').", ".
"size_m = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['size_m'])),'0').", ".
"size_l = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['size_l'])),'0').", ".
"size_xl = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['size_xl'])),'0').", ".
"size_xxl = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['size_xxl'])),'0').", ".
"gender_m = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['gender_m'])),'0').", ".
"gender_f = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['gender_f'])),'0')." ";
if ($action == 'Edit') :
$sql = "UPDATE favors set ".$set.
" WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
else :
if ($action == 'Add New') :
$sql = "INSERT INTO favors SET ".
"user_id = ".$_SESSION['user_id'].", ".
"event_id = ".$_SESSION['active_event'].", ".
$set;
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
$_REQUEST['id'] = last_id();
endif;
endif;
$form_message = "Saved sucessfully!";
if ($_POST['xsubmit'] == 'Save & Close') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=favors'";
echo "</SCRIPT>";
endif;
if ($_POST['xsubmit'] == 'Save & New') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=favors_form'";
echo "</SCRIPT>";
endif;
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else:
if ($action == 'Edit') :
$sql = "SELECT * FROM favors WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
$result = mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
if (mysqli_num_rows($result) > 0) :
$row = mysqli_fetch_object($result);
$_POST['description'] = $row->description;
$_POST['venue'] = $row->venue;
$_POST['size_xs'] = $row->size_xs;
$_POST['size_s'] = $row->size_s;
$_POST['size_m'] = $row->size_m;
$_POST['size_l'] = $row->size_l;
$_POST['size_xl'] = $row->size_xl;
$_POST['size_xxl'] = $row->size_xxl;
$_POST['gender_m'] = $row->gender_m;
$_POST['gender_f'] = $row->gender_f;
else :
echo form_fatal_error('Invalid Operation!');
return;
endif;
endif;
endif;
?>
<script>
var active_page = '<?php echo $_GET['IX']; ?>';
var active_tab = '';
update_header = function()
{
if ($("#category_id").val() > "")
{
//alert($("#category_id").val());
$("#header_repeater").text(" - " + $("#description").val());
}
}
$(document).ready(function()
{
switch_tab('<?php echo $active_tab; ?>');
update_header();
$(':input').change(function() {sheet_dirty = true;} );
}
)
</script>
<h1>Favor Definition - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php get_notes(); ?>
<?php get_help_guide('help_favors_form_'.$active_tab); ?>
<?php echo form_message($form_message); ?>
<form style="" name="frm_favor" id="frm_favor" 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="general" />
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="form_strip">
<input type="button" value="Save" onclick="sheet_dirty = false; this.form.submit();" />
<input type="button" value="Save & Close" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Save & New" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=favors'" />
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_strip">
<div class="tab_header" id="tab_general" onclick="switch_tab('general');">
General Information
</div>
</div>
<div class="cleardiv">
</div>
<div class="tab_content" id="tab_content_general">
<div class="form_header">
Favor Details
</div>
<table class="input_block">
<tr>
<td>
Description
</td>
<td>
<input name="description" id="description" type="text" maxlength="25" onchange="update_header();" value="<?php echo $_POST['description']; ?>" />
<?php show_form_error($ar_err['description']); ?>
</td>
</tr>
<tr>
<td>
Event
</td>
<td>
<select name="venue" id="venue" style="width:130px;" >
<option value="">Event...</option>
<option value="temple" <?php if ($_POST['venue'] == 'temple') {echo 'selected="selected"';} ?> ><?php echo venue_decode('temple'); ?></option>
<option value="av" <?php if ($_POST['venue'] == 'av') {echo 'selected="selected"';} ?> ><?php echo venue_decode('av'); ?></option>
<option value="kv" <?php if ($_POST['venue'] == 'kv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('kv'); ?></option>
<option value="bv" <?php if ($_POST['venue'] == 'bv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('bv'); ?></option>
<option value="dv" <?php if ($_POST['venue'] == 'dv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('dv'); ?></option>
</select>
<?php show_form_error($ar_err['venue']); ?>
</td>
</tr>
<tr>
<td>
Available Sizes
</td>
<td>
<input name="size_xs" id="size_xs" type="checkbox" value="1" <?php if ($_POST['size_xs'] == 1) : echo 'checked="checked"'; endif; ?> /> XS<br />
<input name="size_s" id="size_s" type="checkbox" value="1" <?php if ($_POST['size_s'] == 1) : echo 'checked="checked"'; endif; ?> /> S<br />
<input name="size_m" id="size_m" type="checkbox" value="1" <?php if ($_POST['size_m'] == 1) : echo 'checked="checked"'; endif; ?> /> M<br />
<input name="size_l" id="size_l" type="checkbox" value="1" <?php if ($_POST['size_l'] == 1) : echo 'checked="checked"'; endif; ?> /> L<br />
<input name="size_xl" id="size_xl" type="checkbox" value="1" <?php if ($_POST['size_xl'] == 1) : echo 'checked="checked"'; endif; ?> /> XL<br />
<input name="size_xxl" id="size_xxl" type="checkbox" value="1" <?php if ($_POST['size_xxl'] == 1) : echo 'checked="checked"'; endif; ?> /> XXL<br />
<?php show_form_error($ar_err['size']); ?>
</td>
</tr>
<tr>
<td>
Available Genders
</td>
<td>
<input name="gender_m" id="gender_m" type="checkbox" value="1" <?php if ($_POST['gender_m'] == 1) : echo 'checked="checked"'; endif; ?> /> Male<br />
<input name="gender_f" id="gender_f" type="checkbox" value="1" <?php if ($_POST['gender_f'] == 1) : echo 'checked="checked"'; endif; ?> /> Female<br />
<?php show_form_error($ar_err['gender']); ?>
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="form_strip">
<input type="button" value="Save" onclick="sheet_dirty = false; this.form.submit();" />
<input type="button" value="Save & Close" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Save & New" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=favors'" />
<input type="hidden" name="xsubmit" id="xsubmit" />
</div>
</form>