| 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";
$event_id = mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']));
else :
$action = "Add New";
endif;
else :
exit();
endif;
//********** Check for appropriate payments and redirect to upgrade if necessary *********
if ($action == 'Add New') :
$pmt_err = false;
$sql_pmt = "SELECT SUM(pmt_cred_deb) AS ct_p FROM payments WHERE user_id = ".$_SESSION['user_id'];
$result_pmt = mysqli_query($GLOBALS['con'], $sql_pmt) or die('Database Error!');
if (mysqli_num_rows($result_pmt) > 0) :
$row_pmt = mysqli_fetch_object($result_pmt);
$sql_ev = "SELECT COUNT(id) AS ct_e FROM events WHERE user_id = ".$_SESSION['user_id'];
$result_ev = mysqli_query($GLOBALS['con'], $sql_ev) or die('Database Error!');
if (mysqli_num_rows($result_ev) > 0) :
$row_ev = mysqli_fetch_object($result_ev);
if ($row_pmt->ct_p <= $row_ev->ct_e) :
$pmt_err = true;
endif;
else :
$pmt_err = true;
endif;
else :
$pmt_err = true;
endif;
if ($pmt_err) :
echo '<script>';
echo 'window.location.href = "index.php?IX=upgrade";';
echo '</script>';
return;
endif;
endif;
//****************************************************************************************
if (!empty($_GET['tab'])) :
$active_tab = $_GET['tab'];
else :
$active_tab = 'event';
endif;
if (empty($_POST['temple_rename'])) :
$_POST['temple_rename'] = 'Temple';
endif;
if (empty($_POST['av_rename'])) :
$_POST['av_rename'] = 'Main Venue';
endif;
if (empty($_POST['kv_rename'])) :
$_POST['kv_rename'] = 'Kids Venue';
endif;
if (empty($_POST['bv_rename'])) :
$_POST['bv_rename'] = 'Brunch Venue';
endif;
if (empty($_POST['dv_rename'])) :
$_POST['dv_rename'] = 'Dinner Venue';
endif;
if ($_POST['ajax_event_submitted'] == '1') :
if (isset($_POST['active_tab'])) :
$active_tab = $_POST['active_tab'];
else :
$active_tab = 'event';
endif;
$ar_err = array();
if (!empty($_POST['dv_name'])) :
if (empty($_POST['dv_rename'])) :
$ar_err['dv_rename'] = 'Venue Type cannot be blank!';
$err_flag = true;
$err_tab = 'dv';
endif;
endif;
if (!empty($_POST['bv_name'])) :
if (empty($_POST['bv_rename'])) :
$ar_err['bv_rename'] = 'Venue Type cannot be blank!';
$err_flag = true;
$err_tab = 'bv';
endif;
endif;
if (!empty($_POST['kv_name'])) :
if (empty($_POST['kv_rename'])) :
$ar_err['kv_rename'] = 'Venue Type cannot be blank!';
$err_flag = true;
$err_tab = 'kv';
endif;
endif;
if (!empty($_POST['av_name'])) :
if (empty($_POST['av_rename'])) :
$ar_err['av_rename'] = 'Venue Type cannot be blank!';
$err_flag = true;
$err_tab = 'av';
endif;
endif;
if (!empty($_POST['temple_name'])) :
if (empty($_POST['temple_rename'])) :
$ar_err['temple_rename'] = 'Venue Type cannot be blank!';
$err_flag = true;
$err_tab = 'temple';
endif;
endif;
if (empty($_POST['event_name'])) :
$ar_err['event_name'] = 'Event name is required!';
$err_flag = true;
$err_tab = 'event';
endif;
if (!empty($_POST['event_date'])) :
if (!IsDate($_POST['event_date'])) :
$ar_err['event_date'] = 'Event date invalid!';
$err_flag = true;
$err_tab = 'event';
endif;
endif;
if (!$err_flag) :
$set = "event_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['event_name']))."', ".
"event_date = ".nzdate($_POST['event_date']).", ".
"bm_child_1 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['bm_child_1']))."', ".
"bm_child_2 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['bm_child_2']))."', ".
"bm_child_3 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['bm_child_3']))."', ".
"family_address = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_address']))."', ".
"family_address2 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_address2']))."', ".
"family_city = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_city']))."', ".
"family_state = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_state']))."', ".
"family_zip = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_zip']))."', ".
"family_country = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_country']))."', ".
"family_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['family_phone']))."', ".
"event_website = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['event_website']))."', ".
"event_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['event_email']))."', ".
"event_facebook = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['event_facebook']))."', ".
"event_pinterest = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['event_pinterest']))."', ".
venue_db_set('temple').", ".
venue_db_set('av').", ".
venue_db_set('kv').", ".
venue_db_set('bv').", ".
venue_db_set('dv');
if ($action == 'Edit') :
//var_dump($_POST);
$sql = "UPDATE events set ".
$set.
"WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
if (!empty($_POST['copy_g'])) :
$db_err = '';
mysqli_query($GLOBALS['con'], "START TRANSACTION");
$sql_copy = "INSERT INTO guests (copy_from_id, user_id, event_id, guest_type, primary_guest_id, salutation, last_name, first_name, suffix, street, street2, city, state, zip, country, phone, mobile, email, facebook) ".
" SELECT id, user_id, ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id'])).", guest_type, primary_guest_id, salutation, last_name, first_name, suffix, street, street2, city, state, zip, country, phone, mobile, email, facebook ".
" FROM guests WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['copy_g'])),'0')." ";
//mysqli_query($GLOBALS['con'], $sql_copy) or $db_err = $db_err.'==='.mysqli_error($GLOBALS['con']).'==='.$sql_copy;
mysqli_query($GLOBALS['con'], $sql_copy) or $db_err = $db_err.' Database error! ';
$sql_primary = "UPDATE guests g1 SET g1.primary_guest_id = primary_guest_copy_id(g1.primary_guest_id, g1.event_id, g1.user_id) ".
"WHERE g1.guest_type IN ('S', 'C') AND g1.user_id = ".$_SESSION['user_id']." AND g1.event_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." ";
//mysqli_query($GLOBALS['con'], $sql_primary) or $db_err = $db_err.'==='.mysqli_error($GLOBALS['con']).'==='.$sql_primary;
mysqli_query($GLOBALS['con'], $sql_primary) or $db_err = $db_err.' Database error! ';
if (empty($db_err)) :
mysqli_query($GLOBALS['con'], "COMMIT");
else :
mysqli_query($GLOBALS['con'], "ROLLBACK");
//echo $db_err;
endif;
endif;
if (!empty($_POST['copy_v'])) :
$db_err = '';
mysqli_query($GLOBALS['con'], "START TRANSACTION");
$sql_copy = "INSERT INTO vendors (user_id, event_id, ".
"category_id, vendor_name, street, street2, city, state, zip, country, website, main_phone, ".
"billing_street, billing_street2, billing_city, billing_state, billing_zip, billing_country, comments, ".
"contact_1_name, contact_1_title, contact_1_phone, contact_1_mobile, contact_1_email, ".
"contact_2_name, contact_2_title, contact_2_phone, contact_2_mobile, contact_2_email, ".
"contact_3_name, contact_3_title, contact_3_phone, contact_3_mobile, contact_3_email, ".
"rating, referrer, source,".
"ref_1_name, ref_1_phone, ref_1_email, ref_1_comment, ".
"ref_2_name, ref_2_phone, ref_2_email, ref_2_comment, ".
"ref_3_name, ref_3_phone, ref_3_email, ref_3_comment ".
") ".
" SELECT user_id, ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id'])).", ".
"category_id, vendor_name, street, street2, city, state, zip, country, website, main_phone, ".
"billing_street, billing_street2, billing_city, billing_state, billing_zip, billing_country, comments, ".
"contact_1_name, contact_1_title, contact_1_phone, contact_1_mobile, contact_1_email, ".
"contact_2_name, contact_2_title, contact_2_phone, contact_2_mobile, contact_2_email, ".
"contact_3_name, contact_3_title, contact_3_phone, contact_3_mobile, contact_3_email, ".
"rating, referrer, source,".
"ref_1_name, ref_1_phone, ref_1_email, ref_1_comment, ".
"ref_2_name, ref_2_phone, ref_2_email, ref_2_comment, ".
"ref_3_name, ref_3_phone, ref_3_email, ref_3_comment ".
" FROM vendors WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['copy_v'])),'0')." ";
//mysqli_query($GLOBALS['con'], $sql_copy) or $db_err = $db_err.'==='.mysqli_error($GLOBALS['con']).'==='.$sql_copy;
mysqli_query($GLOBALS['con'], $sql_copy) or $db_err = $db_err.' Database error! ';
if (empty($db_err)) :
mysqli_query($GLOBALS['con'], "COMMIT");
else :
mysqli_query($GLOBALS['con'], "ROLLBACK");
echo $db_err;
endif;
endif;
$form_message = "Saved sucessfully!";
if ($_POST['xsubmit'] == 'Save & Close') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=events'";
echo "</SCRIPT>";
endif;
else :
if ($action == 'Add New') :
$sql = "INSERT INTO events SET ".
"user_id = ".$_SESSION['user_id'].", ".
$set;
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
$_REQUEST['id'] = last_id();
$last_event_id = $_REQUEST['id'];
//$result_insert = mysqli_query($GLOBALS['con'], "SELECT LAST_INSERT_ID() AS LastID");
//$row_insert = mysqli_fetch_array($result_insert);
//$last_event_id = $row_insert['LastID'];
//$_REQUEST['id'] = $last_event_id;
$sql = "UPDATE users SET active_event = ".$last_event_id." WHERE id = ".$_SESSION['user_id'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
$_SESSION['active_event'] = $last_event_id;
if (!empty($_POST['copy_g'])) :
$db_err = '';
mysqli_query($GLOBALS['con'], "START TRANSACTION");
$sql_copy = "INSERT INTO guests (copy_from_id, user_id, event_id, guest_type, primary_guest_id, salutation, last_name, first_name, suffix, street, street2, city, state, zip, country, phone, mobile, email, facebook) ".
" SELECT id, user_id, ".$last_event_id.", guest_type, primary_guest_id, salutation, last_name, first_name, suffix, street, street2, city, state, zip, country, phone, mobile, email, facebook ".
" FROM guests WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['copy_g'])),'0')." ";
mysqli_query($GLOBALS['con'], $sql_copy) or die('Database Error!');
$sql_primary = "UPDATE guests g1 SET g1.primary_guest_id = primary_guest_copy_id(g1.primary_guest_id, g1.event_id, g1.user_id) ".
"WHERE g1.guest_type IN ('S', 'C') AND g1.user_id = ".$_SESSION['user_id']." AND g1.event_id = ".$last_event_id." ";
mysqli_query($GLOBALS['con'], $sql_primary) or die('Database Error!');
if (empty($db_err)) :
mysqli_query($GLOBALS['con'], "COMMIT");
else :
mysqli_query($GLOBALS['con'], "ROLLBACK");
echo $db_err;
endif;
endif;
if (!empty($_POST['copy_v'])) :
$db_err = '';
mysqli_query($GLOBALS['con'], "START TRANSACTION");
$sql_copy = "INSERT INTO vendors (user_id, event_id, ".
"category_id, vendor_name, street, street2, city, state, zip, country, website, main_phone, ".
"billing_street, billing_street2, billing_city, billing_state, billing_zip, billing_country, comments, ".
"contact_1_name, contact_1_title, contact_1_phone, contact_1_mobile, contact_1_email, ".
"contact_2_name, contact_2_title, contact_2_phone, contact_2_mobile, contact_2_email, ".
"contact_3_name, contact_3_title, contact_3_phone, contact_3_mobile, contact_3_email, ".
"rating, referrer, source,".
"ref_1_name, ref_1_phone, ref_1_email, ref_1_comment, ".
"ref_2_name, ref_2_phone, ref_2_email, ref_2_comment, ".
"ref_3_name, ref_3_phone, ref_3_email, ref_3_comment ".
") ".
" SELECT user_id, ".$last_event_id.", ".
"category_id, vendor_name, street, street2, city, state, zip, country, website, main_phone, ".
"billing_street, billing_street2, billing_city, billing_state, billing_zip, billing_country, comments, ".
"contact_1_name, contact_1_title, contact_1_phone, contact_1_mobile, contact_1_email, ".
"contact_2_name, contact_2_title, contact_2_phone, contact_2_mobile, contact_2_email, ".
"contact_3_name, contact_3_title, contact_3_phone, contact_3_mobile, contact_3_email, ".
"rating, referrer, source,".
"ref_1_name, ref_1_phone, ref_1_email, ref_1_comment, ".
"ref_2_name, ref_2_phone, ref_2_email, ref_2_comment, ".
"ref_3_name, ref_3_phone, ref_3_email, ref_3_comment ".
" FROM vendors WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['copy_v'])),'0')." ";
//mysqli_query($GLOBALS['con'], $sql_copy) or $db_err = $db_err.'==='.mysqli_error($GLOBALS['con']).'==='.$sql_copy;
mysqli_query($GLOBALS['con'], $sql_copy) or $db_err = $db_err.' Database error! ';
if (empty($db_err)) :
mysqli_query($GLOBALS['con'], "COMMIT");
else :
mysqli_query($GLOBALS['con'], "ROLLBACK");
echo $db_err;
endif;
endif;
$form_message = "Saved sucessfully!";
if ($_POST['xsubmit'] == 'Save & Close') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=events'";
echo "</SCRIPT>";
endif;
endif;
endif;
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else:
if ($action == 'Edit') :
$sql = "SELECT * FROM events WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id'];
$result = mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
if (mysqli_num_rows($result) > 0) :
$row = mysqli_fetch_object($result);
$_POST['event_name'] = $row->event_name;
$_POST['event_date'] = nzdate_display($row->event_date);
$_POST['bm_child_1'] = $row->bm_child_1;
$_POST['bm_child_2'] = $row->bm_child_2;
$_POST['bm_child_3'] = $row->bm_child_3;
$_POST['family_address'] = $row->family_address;
$_POST['family_address2'] = $row->family_address2;
$_POST['family_city'] = $row->family_city;
$_POST['family_state'] = $row->family_state;
$_POST['family_zip'] = $row->family_zip;
$_POST['family_country'] = $row->family_country;
$_POST['family_phone'] = $row->family_phone;
$_POST['event_website'] = $row->event_website;
$_POST['event_email'] = $row->event_email;
$_POST['event_facebook'] = $row->event_facebook;
$_POST['event_pinterest'] = $row->event_pinterest;
venue_db_get('temple', $row);
venue_db_get('av', $row);
venue_db_get('kv', $row);
venue_db_get('bv', $row);
venue_db_get('dv', $row);
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 ($("#event_name").val() > "")
{
$("#header_repeater").text(" - " + $("#event_name").val());
}
}
$(document).ready(function()
{
switch_tab('<?php echo $active_tab; ?>');
update_header();
$(':input').change(function() {sheet_dirty = true;} );
}
)
</script>
<h1>Bar/Bat Mitzvah - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php get_notes(); ?>
<?php get_help_guide('help_event_form_'.$active_tab); ?>
<?php echo form_message($form_message); ?>
<form style="" name="frm_event" id="frm_event" 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="event" />
<!-- -------------------------------------------------------------------------------------------------------------- -->
<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="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=events'" />
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_strip">
<div class="tab_header" id="tab_event" onclick="switch_tab('event');">
Bar/Bat Mitzvah
</div>
<div class="tab_header" id="tab_family" onclick="switch_tab('family');">
Bar/Bat Mitzvah Family
</div>
<div class="tab_header" id="tab_temple" onclick="switch_tab('temple');">
<?php echo venue_decode('temple',$event_id); ?>
</div>
<div class="tab_header" id="tab_av" onclick="switch_tab('av');">
<?php echo venue_decode('av',$event_id); ?>
</div>
<div class="tab_header" id="tab_kv" onclick="switch_tab('kv');">
<?php echo venue_decode('kv',$event_id); ?>
</div>
<div class="tab_header" id="tab_bv" onclick="switch_tab('bv');">
<?php echo venue_decode('bv',$event_id); ?>
</div>
<div class="tab_header" id="tab_dv" onclick="switch_tab('dv');">
<?php echo venue_decode('dv',$event_id); ?>
</div>
</div>
<div class="cleardiv">
</div>
<div class="tab_content" id="tab_content_event">
<div class="form_header">
Bar/Bat Mitzvah Information
</div>
<table class="input_block">
<tr>
<td>
Bar/Bat Mitzvah Name
</td>
<td>
<input name="event_name" id="event_name" type="text" maxlength="150" onblur="update_header();" value="<?php echo $_POST['event_name']; ?>" />
<?php show_form_error($ar_err['event_name']); ?>
</td>
</tr>
<tr>
<td>
Bar/Bat Mitzvah Date
</td>
<td>
<input name="event_date" id="event_date" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" value="<?php echo $_POST['event_date']; ?>" />
<?php show_form_error($ar_err['event_date']); ?>
</td>
</tr>
<tr>
<td>
Child 1
</td>
<td>
<input name="bm_child_1" id="bm_child_1" type="text" maxlength="100" value="<?php echo $_POST['bm_child_1']; ?>" />
<?php show_form_error($ar_err['bm_child_1']); ?>
</td>
</tr>
<tr>
<td>
Child 2
</td>
<td>
<input name="bm_child_2" id="bm_child_2" type="text" maxlength="100" value="<?php echo $_POST['bm_child_2']; ?>" />
<?php show_form_error($ar_err['bm_child_2']); ?>
</td>
</tr>
<tr>
<td>
Child 3
</td>
<td>
<input name="bm_child_3" id="bm_child_3" type="text" maxlength="100" value="<?php echo $_POST['bm_child_3']; ?>" />
<?php show_form_error($ar_err['bm_child_3']); ?>
</td>
</tr>
<?php
$copy_g = false;
$copy_v = false;
$copy_e = false;
if (empty($_REQUEST['id'])) :
$copy_g = true;
$copy_v = true;
$sql_copy_e = "SELECT id, event_name FROM events WHERE user_id = ".$_SESSION['user_id']." ";
$result_copy_e = mysqli_query($GLOBALS['con'], $sql_copy_e) or die('Database Error!');
$copy_e = (mysqli_num_rows($result_copy_e) > 0);
else :
$sql_copy_g = "SELECT id FROM guests WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." ";
$result_copy_g = mysqli_query($GLOBALS['con'], $sql_copy_g) or die('Database Error!');
$copy_g = (mysqli_num_rows($result_copy_g) <= 0);
$sql_copy_v = "SELECT id FROM vendors WHERE user_id = ".$_SESSION['user_id']." AND event_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." ";
$result_copy_v = mysqli_query($GLOBALS['con'], $sql_copy_v) or die('Database Error!');
$copy_v = (mysqli_num_rows($result_copy_v) <= 0);
$sql_copy_e = "SELECT id, event_name FROM events WHERE user_id = ".$_SESSION['user_id']." AND id <> ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." ";
$result_copy_e = mysqli_query($GLOBALS['con'], $sql_copy_e) or die('Database Error!');
$copy_e = (mysqli_num_rows($result_copy_e) > 0);
/*
*/
endif;
if (($copy_g || $copy_v) && $copy_e) :
?>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan="2" align="center" style="font-weight:bold;">
Copy data from another event ↓↓ <br /><br />
</td>
</tr>
<?php
endif;
if ($copy_g && $copy_e) :
?>
<tr>
<td>
Copy Guests from:
</td>
<td>
<select name="copy_g" id="copy_g" >
<option value="">Select an event...</option>
<?php
mysqli_data_seek($result_copy_e, 0);
while ($row_copy_e = mysqli_fetch_object($result_copy_e)) :
$selected = '';
if ($_POST['copy_g'] == $row_copy_e->id) :
$selected = 'selected="selected"';
endif;
echo '<option value="'.$row_copy_e->id.'" '.$selected.'>'.$row_copy_e->event_name.'</option>';
endwhile;
?>
</select>
</td>
</tr>
<?php
endif;
if ($copy_v && $copy_e) :
?>
<tr>
<td>
Copy Vendors from:
</td>
<td>
<select name="copy_v" id="copy_v" >
<option value="">Select an event...</option>
<?php
mysqli_data_seek($result_copy_e, 0);
while ($row_copy_e = mysqli_fetch_object($result_copy_e)) :
$selected = '';
if ($_POST['copy_v'] == $row_copy_e->id) :
$selected = 'selected="selected"';
endif;
echo '<option value="'.$row_copy_e->id.'" '.$selected.'>'.$row_copy_e->event_name.'</option>';
endwhile;
?>
</select>
</td>
</tr>
<?php
endif;
?>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_content" id="tab_content_family">
<div class="form_header">
Family Information
</div>
<table class="input_block">
<tr>
<td>
Address
</td>
<td>
<input tabindex="1" name="family_address" id="family_address" type="text" maxlength="100" value="<?php echo $_POST['family_address']; ?>" />
<?php show_form_error($ar_err['family_address']); ?>
</td>
<td>
Phone
</td>
<td>
<input tabindex="7" name="family_phone" id="family_phone" type="text" maxlength="20" value="<?php echo $_POST['family_phone']; ?>" />
<?php show_form_error($ar_err['family_phone']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input tabindex="2" name="family_address2" id="family_address2" type="text" maxlength="100" value="<?php echo $_POST['family_address2']; ?>" />
<?php show_form_error($ar_err['family_address2']); ?>
</td>
<td>
Event Website
</td>
<td>
<input tabindex="8" name="event_website" id="event_website" type="text" class="link_field" maxlength="150" value="<?php echo $_POST['event_website']; ?>" /><a id="linkout_event_website" target="_blank" href="<?php echo format_http($_POST['event_website']); ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['event_website']); ?>
</td>
</tr>
<tr>
<td>
City
</td>
<td>
<input tabindex="3" name="family_city" id="family_city" type="text" maxlength="100" value="<?php echo $_POST['family_city']; ?>" />
<?php show_form_error($ar_err['family_city']); ?>
</td>
<td>
Email
</td>
<td>
<input tabindex="9" name="event_email" id="event_email" type="text" class="mail_field" maxlength="100" value="<?php echo $_POST['event_email']; ?>" /><a id="linkout_event_email" href="mailto:<?php echo $_POST['event_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['event_email']); ?>
</td>
</tr>
<tr>
<td>
State
</td>
<td>
<?php
$sql_str = "SELECT DISTINCT country_sort_code, country FROM states order by country_sort_code";
$result_country = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$sql_union = '';
$str_union = '';
while ($row_country = mysqli_fetch_object($result_country)) :
$sql_union .= $str_union." (SELECT '__', '- - - - - - ".$row_country->country." - - - - - -') ".
"UNION (SELECT state, state_name FROM states WHERE country_sort_code = ".$row_country->country_sort_code." ORDER BY state_name) ";
$str_union = ' UNION ';
endwhile;
//echo $sql_union;
auto_complete('family_state', $_POST['family_state'], $_POST['family_state'], $sql_union, null, null, null, 4, "set_country('family_state', 'family_country');");
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
echo '<script> var ar_states = []; ';
while ($row = mysqli_fetch_object($result)) :
echo 'ar_states["'.$row->state.'"] = "'.$row->country.'";'.PHP_EOL;
endwhile;
echo '</script>';
?>
<?php /* ?>
<select tabindex="4" name="family_state" id="family_state" onchange="set_country('family_state', 'family_country');" >
<option value="">State/Province...</option>
<?php
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$hold_country = '';
while ($row = mysqli_fetch_object($result)) :
if ($hold_country != $row->country) :
echo '<option value="">- - - - - - '.$row->country.' - - - - - -</option>';
$hold_country = $row->country;
endif;
$selected = '';
if ($_POST['family_state'] == $row->state) :
$selected = 'selected="selected"';
endif;
echo '<option attr_country="'.$row->country.'" value="'.$row->state.'" '.$selected.'>'.$row->state_name.'</option>';
endwhile;
?>
</select>
<?php */ ?>
<?php show_form_error($ar_err['family_state']); ?>
</td>
<td>
Facebook
</td>
<td>
<input tabindex="10" name="event_facebook" id="event_facebook" type="text" class="link_field" maxlength="150" value="<?php echo $_POST['event_facebook']; ?>" /><a id="linkout_event_facebook" target="_blank" href="<?php echo format_http($_POST['event_facebook']); ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['event_facebook']); ?>
</td>
</tr>
<tr>
<td>
Zip Code
</td>
<td>
<input tabindex="5" name="family_zip" id="family_zip" type="text" maxlength="15" value="<?php echo $_POST['family_zip']; ?>" />
<?php show_form_error($ar_err['family_zip']); ?>
</td>
<td>
Pinterest
</td>
<td>
<input tabindex="11" name="event_pinterest" id="event_pinterest" type="text" class="link_field" maxlength="150" value="<?php echo $_POST['event_pinterest']; ?>" /><a id="linkout_event_pinterest" target="_blank" href="<?php echo format_http($_POST['event_pinterest']); ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['event_pinterest']); ?>
</td>
</tr>
<tr>
<td>
Country
</td>
<td>
<input tabindex="6" name="family_country" id="family_country" type="text" maxlength="15" value="<?php echo $_POST['family_country']; ?>" />
<?php show_form_error($ar_err['family_country']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<?php
venue_render('temple');
venue_render('av');
venue_render('kv');
venue_render('bv');
venue_render('dv');
?>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<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="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=events'" />
<input type="hidden" name="xsubmit" id="xsubmit" />
</div>
</form>
<?php
function venue_render($venue)
{
?>
<div class="tab_content" id="tab_content_<?php echo $venue; ?>">
<div class="form_header">
<?php echo venue_decode($venue,$event_id); ?> Information
</div>
<div style="text-align:center">
<img src="img/exclamation.png" style="vertical-align:middle;" /> Please be sure to fill in both "Event" and "Venue" for those events that you would like to use.
</div>
<table class="input_block">
<tr>
<td class="exclamation">
Event
</td>
<td>
<input tabindex="1" name="<?php echo $venue; ?>_rename" id="<?php echo $venue; ?>_rename" type="text" maxlength="20" value="<?php echo $_POST[$venue.'_rename']; ?>" />
<?php show_form_error($ar_err[$venue.'_rename']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="exclamation">
Venue
</td>
<td>
<input tabindex="1" name="<?php echo $venue; ?>_name" id="<?php echo $venue; ?>_name" type="text" maxlength="100" value="<?php echo $_POST[$venue.'_name']; ?>" />
<?php show_form_error($ar_err[$venue.'_name']); ?>
</td>
<td>
Phone
</td>
<td>
<input tabindex="16" name="<?php echo $venue; ?>_phone" id="<?php echo $venue; ?>_phone" type="text" maxlength="20" value="<?php echo $_POST[$venue.'_phone']; ?>" />
<?php show_form_error($ar_err[$venue.'_phone']); ?>
</td>
</tr>
<tr>
<td>
Address
</td>
<td>
<input tabindex="2" name="<?php echo $venue; ?>_address" id="<?php echo $venue; ?>_address" type="text" maxlength="100" value="<?php echo $_POST[$venue.'_address']; ?>" />
<?php show_form_error($ar_err[$venue.'_address']); ?>
</td>
<td>
Contact
</td>
<td>
<input tabindex="17" name="<?php echo $venue; ?>_contact" id="<?php echo $venue; ?>_contact" type="text" maxlength="100" value="<?php echo $_POST[$venue.'_contact']; ?>" />
<?php show_form_error($ar_err[$venue.'_contact']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input tabindex="3" name="<?php echo $venue; ?>_address2" id="<?php echo $venue; ?>_address2" type="text" maxlength="100" value="<?php echo $_POST[$venue.'_address2']; ?>" />
<?php show_form_error($ar_err[$venue.'_address2']); ?>
</td>
<td>
Alt. Phone
</td>
<td>
<input tabindex="18" name="<?php echo $venue; ?>_alt_phone" id="<?php echo $venue; ?>_alt_phone" type="text" maxlength="20" value="<?php echo $_POST[$venue.'_alt_phone']; ?>" />
<?php show_form_error($ar_err[$venue.'_alt_phone']); ?>
</td>
</tr>
<tr>
<td>
City
</td>
<td>
<input tabindex="4" name="<?php echo $venue; ?>_city" id="<?php echo $venue; ?>_city" type="text" maxlength="100" value="<?php echo $_POST[$venue.'_city']; ?>" />
<?php show_form_error($ar_err[$venue.'_city']); ?>
</td>
<td>
Alt. Contact
</td>
<td>
<input tabindex="19" name="<?php echo $venue; ?>_alt_contact" id="<?php echo $venue; ?>_alt_contact" type="text" maxlength="100" value="<?php echo $_POST[$venue.'_alt_contact']; ?>" />
<?php show_form_error($ar_err[$venue.'_alt_contact']); ?>
</td>
</tr>
<tr>
<td>
State
</td>
<td>
<?php
$sql_str = "SELECT DISTINCT country_sort_code, country FROM states order by country_sort_code";
$result_country = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$sql_union = '';
$str_union = '';
while ($row_country = mysqli_fetch_object($result_country)) :
$sql_union .= $str_union." (SELECT '__', '- - - - - - ".$row_country->country." - - - - - -') ".
"UNION (SELECT state, state_name FROM states WHERE country_sort_code = ".$row_country->country_sort_code." ORDER BY state_name) ";
$str_union = ' UNION ';
endwhile;
//echo $sql_union;
auto_complete($venue.'_state', $_POST[$venue.'_state'], $_POST[$venue.'_state'], $sql_union, null, null, null, 5, "set_country('".$venue."_state', '".$venue."_country');");
/*
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
echo '<script> var ar_states = []; ';
while ($row = mysqli_fetch_object($result)) :
echo 'ar_states["'.$row->state.'"] = "'.$row->country.'";'.PHP_EOL;
endwhile;
echo '</script>';
*/
?>
<?php /* ?>
<select tabindex="5" name="<?php echo $venue; ?>_state" id="<?php echo $venue; ?>_state" onchange="set_country('<?php echo $venue; ?>_state', '<?php echo $venue; ?>_country');" >
<option value="">State/Province...</option>
<?php
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$hold_country = '';
while ($row = mysqli_fetch_object($result)) :
if ($hold_country != $row->country) :
echo '<option value="">- - - - - - '.$row->country.' - - - - - -</option>';
$hold_country = $row->country;
endif;
$selected = '';
if ($_POST[$venue.'_state'] == $row->state) :
$selected = 'selected="selected"';
endif;
echo '<option attr_country="'.$row->country.'" value="'.$row->state.'" '.$selected.'>'.$row->state_name.'</option>';
endwhile;
?>
</select>
<?php */ ?>
<?php show_form_error($ar_err[$venue.'_state']); ?>
</td>
<td>
Website
</td>
<td>
<input tabindex="20" name="<?php echo $venue; ?>_website" id="<?php echo $venue; ?>_website" type="text" class="link_field" maxlength="150" value="<?php echo $_POST[$venue.'_website']; ?>" /><a id="linkout_<?php echo $venue; ?>_website" target="_blank" href="<?php echo format_http($_POST[$venue.'_website']); ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err[$venue.'_website']); ?>
</td>
</tr>
<tr>
<td>
Zip Code
</td>
<td>
<input tabindex="6" name="<?php echo $venue; ?>_zip" id="<?php echo $venue; ?>_zip" type="text" maxlength="15" value="<?php echo $_POST[$venue.'_zip']; ?>" />
<?php show_form_error($ar_err[$venue.'_zip']); ?>
</td>
<td>
Email
</td>
<td>
<input tabindex="21" name="<?php echo $venue; ?>_email" id="<?php echo $venue; ?>_email" type="text" class="mail_field" maxlength="100" value="<?php echo $_POST[$venue.'_email']; ?>" /><a id="linkout_<?php echo $venue; ?>_email" href="mailto:<?php echo $_POST[$venue.'_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err[$venue.'_email']); ?>
</td>
</tr>
<tr>
<td>
Country
</td>
<td>
<input tabindex="7" name="<?php echo $venue; ?>_country" id="<?php echo $venue; ?>_country" type="text" maxlength="50" value="<?php echo $_POST[$venue.'_country']; ?>" />
<?php show_form_error($ar_err[$venue.'_country']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Date
</td>
<td>
<input tabindex="8" name="<?php echo $venue; ?>_date" id="<?php echo $venue; ?>_date" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="15" value="<?php echo $_POST[$venue.'_date']; ?>" />
<?php show_form_error($ar_err[$venue.'_date']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Time
</td>
<td>
<input tabindex="9" name="<?php echo $venue; ?>_time" id="<?php echo $venue; ?>_time" type="text" maxlength="15" value="<?php echo $_POST[$venue.'_time']; ?>" />
<?php show_form_error($ar_err[$venue.'_time']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Est. # of People
</td>
<td>
<input tabindex="10" name="<?php echo $venue; ?>_est_people" id="<?php echo $venue; ?>_est_people" type="text" maxlength="15" onblur="val_int_field(this);" value="<?php echo $_POST[$venue.'_est_people']; ?>" />
<?php show_form_error($ar_err[$venue.'_est_people']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Est. # of Adults
</td>
<td>
<input tabindex="11" name="<?php echo $venue; ?>_est_adults" id="<?php echo $venue; ?>_est_adults" type="text" maxlength="15" onblur="val_int_field(this);" value="<?php echo $_POST[$venue.'_est_adults']; ?>" />
<?php show_form_error($ar_err[$venue.'_est_adults']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Est. # of Kids
</td>
<td>
<input tabindex="12" name="<?php echo $venue; ?>_est_kids" id="<?php echo $venue; ?>_est_kids" type="text" maxlength="15" onblur="val_int_field(this);" value="<?php echo $_POST[$venue.'_est_kids']; ?>" />
<?php show_form_error($ar_err[$venue.'_est_kids']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Est. # of Tables
</td>
<td>
<input tabindex="13" name="<?php echo $venue; ?>_est_tables" id="<?php echo $venue; ?>_est_tables" type="text" maxlength="15" onblur="val_int_field(this);" value="<?php echo $_POST[$venue.'_est_tables']; ?>" />
<?php show_form_error($ar_err[$venue.'_est_tables']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Food Choices
</td>
<td>
<input tabindex="14" name="<?php echo $venue; ?>_food" id="<?php echo $venue; ?>_food" type="text" maxlength="75" value="<?php echo $_POST[$venue.'_food']; ?>" />
<?php show_form_error($ar_err[$venue.'_food']); ?>
<br />Comma separated - ex: Fish, Chicken, Kids meal
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Comments
</td>
<td colspan="3">
<textarea tabindex="15" name="<?php echo $venue; ?>_comments" id="<?php echo $venue; ?>_comments" cols="80" rows="5"><?php echo $_POST[$venue.'_comments']; ?></textarea>
<?php show_form_error($ar_err[$venue.'_comments']); ?>
</td>
</tr>
</table>
</div>
<?php
}
function venue_db_set($venue)
{
$str_db_set =
$venue."_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_name']))."', ".
$venue."_rename = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_rename']))."', ".
$venue."_address = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_address']))."', ".
$venue."_address2 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_address2']))."', ".
$venue."_city = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_city']))."', ".
$venue."_state = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_state']))."', ".
$venue."_zip = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_zip']))."', ".
$venue."_country = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_country']))."', ".
$venue."_date = ".nzdate($_POST[$venue.'_date']).", ".
$venue."_time = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_time']))."', ".
$venue."_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_phone']))."', ".
$venue."_contact = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_contact']))."', ".
$venue."_alt_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_alt_phone']))."', ".
$venue."_alt_contact = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_alt_contact']))."', ".
$venue."_website = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_website']))."', ".
$venue."_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_email']))."', ".
$venue."_food = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_food']))."', ".
$venue."_comments = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_comments']))."', ".
$venue."_est_people = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_est_people'])),'0').", ".
$venue."_est_adults = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_est_adults'])),'0').", ".
$venue."_est_kids = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_est_kids'])),'0').", ".
$venue."_est_tables = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST[$venue.'_est_tables'])),'0')." ";
return $str_db_set;
}
function venue_db_get($venue, $row)
{
$_POST[$venue.'_name'] = $row->{$venue.'_name'};
$_POST[$venue.'_rename'] = $row->{$venue.'_rename'};
$_POST[$venue.'_address'] = $row->{$venue.'_address'};
$_POST[$venue.'_address2'] = $row->{$venue.'_address2'};
$_POST[$venue.'_city'] = $row->{$venue.'_city'};
$_POST[$venue.'_state'] = $row->{$venue.'_state'};
$_POST[$venue.'_zip'] = $row->{$venue.'_zip'};
$_POST[$venue.'_country'] = $row->{$venue.'_country'};
$_POST[$venue.'_date'] = nzdate_display($row->{$venue.'_date'});
$_POST[$venue.'_time'] = $row->{$venue.'_time'};
$_POST[$venue.'_phone'] = $row->{$venue.'_phone'};
$_POST[$venue.'_contact'] = $row->{$venue.'_contact'};
$_POST[$venue.'_alt_phone'] = $row->{$venue.'_alt_phone'};
$_POST[$venue.'_alt_contact'] = $row->{$venue.'_alt_contact'};
$_POST[$venue.'_website'] = $row->{$venue.'_website'};
$_POST[$venue.'_email'] = $row->{$venue.'_email'};
$_POST[$venue.'_food'] = $row->{$venue.'_food'};
$_POST[$venue.'_comments'] = $row->{$venue.'_comments'};
$_POST[$venue.'_est_people'] = number_format($row->{$venue.'_est_people'},0,'.',',');
$_POST[$venue.'_est_adults'] = number_format($row->{$venue.'_est_adults'},0,'.',',');
$_POST[$venue.'_est_kids'] = number_format($row->{$venue.'_est_kids'},0,'.',',');
$_POST[$venue.'_est_tables'] = number_format($row->{$venue.'_est_tables'},0,'.',',');
/*
*/
}
?>