HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //proc/thread-self/root/proc/thread-self/cwd/counselor/slot-schedule.php
<?php
	include_once('header.php');
	$counselor_id = $_SESSION['COUN-ID'];
	date_default_timezone_set('Asia/Calcutta');
	$curDateTime = date('Y-m-d H:i:s');

	if(isset($_POST['slot_book'])){
		if($_POST['counselorID'] == ''){
			$message = "<div class='danger form-group'><span> Your Session is out ! </span></div>";
		} else if($_POST['date'] == ''){
			$message = "<div class='danger form-group'><span> Select the Date Availability ! </span></div>";
		} else if($_POST['time_dur'] == ''){
			$message = "<div class='danger form-group'><span> Enter Time Duration ! </span></div>";
		} else if($_POST['time_slot_hr'] == ''){
			$message = "<div class='danger form-group'><span> Select Time Slot Hour ! </span></div>";
		} else if($_POST['time_slot_min'] == ''){
			$message = "<div class='danger form-group'><span> Select Time Slot Minute ! </span></div>";
		} else {
			$counselor_id = $_POST['counselorID'];
			$scheduled_date = $_POST['date'];
			$time_dur = $_POST['time_dur'];
			$time_slot_hr = $_POST['time_slot_hr'];
			$time_slot_min = $_POST['time_slot_min'];
			$pricing_for_slot = $_POST['pricing_for_slot'];
			$end_time_dur = $_POST['end_time_dur'];
			$status = 'Y';
		}
		// $_POST['date'];
		if($message == ''){
			echo $slot_create = "INSERT INTO wp_psy_slot_available SET counselor_id='$counselor_id', scheduled_date='$scheduled_date', time_dur='$time_dur', time_slot_hr='$time_slot_hr', time_slot_min='$time_slot_min', pricing_for_slot='$pricing_for_slot', add_date='$curDateTime', status='$status', end_time_dur='$end_time_dur',created_by='counselor',slot_status='S'";
			if($wpdb->query($slot_create)){
				$message = "<div class='success form-group'><span> Slot Added Successfully </span></div>";
			} else {
				$message = "<div class='danger form-group'><span> Slot Booking is not placed ! </span></div>";
			}
		}

	}
?>

<style>
	.page-title{
		float: left;
	    width: 100%;
	}
	.success{
		background: #008000b8;
	    padding: 10px;
	    color: #fff;
	    border-radius: 5px;
	}
	.danger{
		background: #ff0000ba;
	    padding: 10px;
	    color: #fff;
	    border-radius: 5px;
	}
	.endTime{
		border: none;
    	width: 100%;
    	padding: 10;
	}
</style>

<div class="page-inner">
    <div class="page-title">
		<div class="col-md-4">
			<h3>Scheduler</h3>
			<div class="page-breadcrumb">
				<ol class="breadcrumb">
					<li><a href="dashboard">Scheduler</a></li>
					<li class="active">Schedule Appointment</li>
				</ol>
			</div>
		</div>
    </div>
	
    <div id="main-wrapper">
		<div class="row">
			<div class="col-md-6">
				<div class="panel panel-white">
					<div class="panel-heading clearfix">
						<h4 class="panel-title">Book You Slot for Availability</h4>
                    </div>
                    <div class="panel-body">
                        <form method="post" enctype="multipart/form-data">
                        	<?php
                        		if(isset($message)){
                        			echo $message;
                        		}
                        	?>
							<div class="form-group">
								<label for="date">Select Date for Availability</label>
								<input type="text" class="form-control" id="date" name="date" autocomplete="off" placeholder="Select date">
                            </div>
							<div class="form-group">
								<label for="time_dur">Enter Time Duration (Min)</label>
                                <input type="number" class="form-control" id="time_dur" name="time_dur" placeholder="Enter Slot Timing">
							</div>
							<div class="form-group">
								<div class="col-md-3">
									<label for="time_slot_hr">Select Time</label>
								</div>
								<div class="col-md-5">
									<select class="form-control" id="time_slot_hr" name="time_slot_hr">
										<option value="0">Hour</option>
										<?php for($h=0; $h<=23; $h++){ ?>
										<option value="<?php echo sprintf('%02d', $h); ?>"><?php echo sprintf('%02d', $h); ?></option>
										<?php } ?>
									</select>
								</div>
								<div class="col-md-4">
									<select class="form-control" id="time_slot_min" name="time_slot_min">
										<option value="0">Min</option>
										<?php for($m=0; $m<=59; $m++){ ?>
										<option value="<?php echo sprintf('%02d', $m); ?>"><?php echo sprintf('%02d', $m); ?></option>
										<?php } ?>
									</select>
								</div>
							</div>
							<div class="form-group" id="ic" style="display:none;">
								<div class="col-md-3">
									<label for="end_time_dur"> End Slot Duration</label>
								</div>
								<div class="col-md-9" id="end_time">
									End Slot Hour
								</div>
							</div>
							<div class="form-group">
								<label for="pricing_for_slot">Price (INR)</label>
                                <input type="number" class="form-control" id="pricing_for_slot" name="pricing_for_slot" placeholder="Enter price for appointment" value="500">
							</div>
							<input type="hidden" name="counselorID" value="<?php echo $counselor_id; ?>">
							<!-- <button type="submit" class="btn btn-primary">Submit</button> -->
							<input type="submit" name="slot_book" Value="Book Slot" class="btn btn-primary">
						</form>
                    </div>
				</div>
			</div>
        </div>        
    </div><!-- Main Wrapper -->


    <div class="page-footer">
        <p class="no-s">shinemetrics.com</p>
    </div>
</div><!-- Page Inner -->

<link rel="stylesheet" type="text/css" href="assets/plugins/jquery-ui/jquery-ui.css" />
<script src="assets/plugins/jquery/jquery-2.1.3.min.js"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
<script src="https://momentjs.com/downloads/moment-with-locales.js"></script>

<script type="text/javascript" charset="utf-8">
	jQuery.noConflict();
    jQuery(document).ready(function () {
		jQuery("#date").datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy-mm-dd'
        });
	});

	$('#time_slot_min').on('change', function() {

		var hour = $('#time_slot_hr').val();
        var minutes = $('#time_slot_min').val();
        var slot_time = $('#time_dur').val();

		if(slot_time == 0 ){
			alert("Enter Time Slot First! " );
		} else if (hour == '' ){
			alert("Select Time Slot Hour to precise your booking ! ");
		} else if (minutes == '' ){
			alert("Select Time Slot Minutes to precise your booking !");
		} else {

	        var dt = new Date();
			var time = hour + ":" + minutes;
	        var end_time_dur = '<input type="text" name="end_time_dur" class="endTime" value="'+ moment.utc(time,'hh:mm').add(slot_time,'minutes').format('hh:mm') +'" readonly />';

			if(this.value != "0") {
			    $('#ic').show();
			    $('#end_time').html(end_time_dur);
			} else {
			    $('#ic').hide();
			}
		}
	});
</script>

<?php include_once('footer.php'); ?>