403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/newusafunding.com/vx/usa/professional-grant-services_old/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/newusafunding.com/vx/usa/professional-grant-services_old/appointment2.php
<?
/**
  * This framework has been created for a multitude of grant research websites.
  *
  * @copyright 2016-2021 Synergy Pro Marketing
  * @author Aaron Campbell <aaron@synergymentoring.com>
  *	@license None, All Rights Reserved
  * @package Business
  */
  	include_once($_SERVER['DOCUMENT_ROOT']."/vx/lib/inc.php");
	if(!empty($_GET['username'])) {
		header("Location: appointment2.php");
		exit(0);
	}
	track_member_action('Page Visit','Professional Grant Services Appointment');
	
	function shuffle_assoc(&$array) {
        $keys = array_keys($array);

        shuffle($keys);

        foreach($keys as $key) {
            $new[$key] = $array[$key];
        }

        $array = $new;

        return true;
    }
	
	$_SESSION['visited_professional_services'] = '1';
	
	$client_res = $db->query("SELECT * FROM lc2{$siteCode}_lc.lc_reseller
							WHERE id='".clean($user)."'");
	if(!empty($client_res)) {
		$client_info = $client_res[0];
		$client_info['address'] = $client_info['address1'];
		$client_info['cell_phone'] = phone_number($client_info['phone_1']);
		$client_info['work_phone'] = phone_number($client_info['phone_1']);
		$client_profile_res = $db->query("SELECT p.money,p.description FROM lc2{$siteCode}_lc.lead_profile p
										LEFT JOIN lc2{$siteCode}_lc.lc_leads l ON l.id=p.lead_id
										WHERE l.customerID='".clean($user)."'");
		if(!empty($client_profile_res)) {
			$client_info['description'] = $client_profile_res[0]['description'];
			$client_info['money'] = $client_profile_res[0]['money'];
		}
		if($client_info['visited_professional_services_page']=='0') {
			$db->query("UPDATE lc2{$siteCode}_lc.lc_reseller SET visited_professional_services_page=1 WHERE id='".clean($user)."'");
		}
	} else {
		$client_info = array();
	}
	
	$is_jeremy = false;
	$marketer_res = $db->query("SELECT marketer FROM coaching_allocator.leads
									WHERE leaddb='".clean($siteCode)."'
									AND leadid='".clean($user)."'");
	if(!empty($marketer_res[0]['marketer'])) {
		if($marketer_res[0]['marketer']=='jeremy') {
			$is_jeremy = true;
		}
		$marketer_res = $db->query("SELECT e.username as 'marketer',e.first_name,e.work_email,s.extension
									FROM surfcrm.employees e
									LEFT JOIN surfcrm.softphone_logins s ON s.id=e.softphone_id
									WHERE e.username='".clean($marketer_res[0]['marketer'])."'");
	}
	
	$timezone_offset = 0;
	if(!empty($client_info['zip'])) {
		$timezone_res = $db->query("SELECT timezone FROM geo.zip_codes WHERE zip='".clean($client_info['zip'])."'");
		if(!empty($timezone_res)) {
			$timezone_offset = ($timezone_res[0]['timezone'] - (-7));
		}
	}
	$timezone_offset_pretty = array(
		'0' => 'Mountain Time'
		,'-1' => 'Pacific Time'
		,'-2' => 'Alaska Time'
		,'-4' => 'Hawaii Time'
		,'1' => 'Central Time'
		,'2' => 'Eastern Time'
	);
	if(empty($timezone_offset_pretty[$timezone_offset])) {
		$timezone_offset = 0;
	}
	
	$dates = array();
	$appointment_dates = array();
	$first_date = date('Y-m-d');
	$bus_days = 0;
	while($bus_days<4) {
		$first_date = date('Y-m-d',strtotime('+1 day',strtotime($first_date)));
		if(date('w',strtotime($first_date))=='0' || date('w',strtotime($first_date))=='6') {
			continue;
		}
		//$appointment_count = rand(6,10);
		$appointment_data = array();
		$date = $first_date;
		if($bus_days==0) {
			$start_time = $date.' 09:00:00';
		} else {
			$start_time = $date.' 09:00:00';
		}
		$end_time = $date.' 15:30:00';
		
		$usernames = array();
		$usernames[] = 'danielled';
		$usernames[] = 'danielled';
		$usernames[] = 'danielled';
		$usernames[] = 'danielled';
		$usernames[] = 'danielled';
		$usernames[] = 'west';
		$usernames[] = 'west';
		$usernames[] = 'west';
		$usernames[] = 'west';
		$usernames[] = 'west';
		
		$today = date('Y-m-d');
		$appointment_count = count($usernames);
		$emp_appointment_lengths = array();
		$emp_appointment_lengths['bonniek'] = '45';
		$emp_appointment_lengths['davidc'] = '30';
		$emp_appointment_lengths['leslieg'] = '30';
		$emp_appointment_lengths['chriss'] = '30';
		$emp_appointment_lengths['jasons'] = '30';
		$emp_appointment_lengths['danielled'] = '30';
		$emp_appointment_lengths['west'] = '30';
		
		/*if(date('w',strtotime($start_time))=='6') {
			$usernames = array('jasons');
			$start_time = $date.' 06:00:00';
			$end_time = $date.' 09:00:00';
		}*/
		
		if(date('Y-m-d',strtotime($start_time))==date('Y-m-d')) {
			$start_time = date('Y-m-d H',strtotime('+2 hour')).':00:00';
			$now = date('Y-m-d H:i:s',strtotime('+2 hour'));
			while(strtotime($start_time)<=strtotime($now)) {
				$start_time = date('Y-m-d H:i:s',strtotime('+15 minute',strtotime($start_time)));
			}
		}
		
		$res = $db->query("SELECT username, start_date_time, end_date_time
							FROM surfcrm.calendar
							WHERE username IN ('".implode("','",$usernames)."')
							AND '".clean($date)."' BETWEEN DATE(start_date_time) AND DATE(end_date_time)");
		$emp_times = array();
		$emps_appointment_can_do = array();
		foreach($res as $r) {
			$emp_times[strtolower($r['username'])][] = $r;
		}
		while(strtotime($start_time) < strtotime($end_time)) {
			$can_do = true;
			$emp_blocked = 0;
			$emps_cant_do = array();
			foreach($emp_times as $emp=>$emp_data) {
				if(!empty($emp_appointment_lengths[$emp])) {
					$appointment_minutes = $emp_appointment_lengths[$emp];
				} else {
					$appointment_minutes = '20';
				}
				$current_end_time = date('Y-m-d H:i:s',strtotime('+'.$appointment_minutes.' minute',strtotime($start_time)));
				$ignore_me = false;
				if(strtotime($start_time) < strtotime(date('Y-m-d',strtotime($start_time)).' 09:00:00') ||
					strtotime($start_time) > strtotime(date('Y-m-d',strtotime($start_time)).' 16:30:00')) {
					$emp_blocked++;
					$emps_cant_do[] = $emp;
					$ignore_me = true;
				}
				if(!$ignore_me) {
					foreach($emp_data as $r) {
						$in_appointment = false;
						if(strtotime($start_time) >= strtotime($r['start_date_time']) && strtotime($start_time) < strtotime($r['end_date_time'])) {
							//start date inside of current appointment
							$in_appointment = true;
						} elseif(strtotime($current_end_time) > strtotime($r['start_date_time']) && strtotime($current_end_time) <= strtotime($r['end_date_time'])) {
							//end date inside of current appointment
							$in_appointment = true;
						} elseif(strtotime($start_time) < strtotime($r['start_date_time']) && strtotime($current_end_time) > strtotime($r['end_date_time'])) {
							//appointment inside of the time
							$in_appointment = true;
						} elseif(strtotime($start_time) >= strtotime($r['start_date_time']) && strtotime($current_end_time) <= strtotime($r['end_date_time'])) {
							$in_appointment = true;
						}
						if($in_appointment) {
							$emp_blocked++;
							$emps_cant_do[] = $emp;
							break;						
						}
					}
				}
				if($emp_blocked==count($usernames)) {
					$can_do = false;
					break;
				}
			}
			if($can_do) {
				$emps_can_do = array();
				foreach($usernames as $emp) {
					if(!in_array($emp,$emps_cant_do)) {
						$emps_can_do[] = $emp;
					}
				}
				$pretty_start_time = '';
				if($timezone_offset=='0') {
					$pretty_start_time = date('g:i a',strtotime($start_time));
				} elseif($timezone_offset*1 < 0) {
					$timezone_offset_minus = $timezone_offset*-1;
					$pretty_start_time = date('g:i a',strtotime('-'.$timezone_offset_minus.' hour',strtotime($start_time)));
				} else {
					$pretty_start_time = date('g:i a',strtotime('+'.$timezone_offset.' hour',strtotime($start_time)));
				}
				$appointment_key = $start_time.'|||'.implode('|',$emps_can_do);
				foreach($emps_can_do as $emp_can_do) {
					$emps_appointment_can_do[$emp_can_do][] = $start_time;
				}
				$appointment_data[$start_time] = $pretty_start_time;
			}
			$start_time = date('Y-m-d H:i:s',strtotime('+15 minute',strtotime($start_time)));
		}
		if(count($appointment_data)<6) {
			continue;
		}
		if(count($appointment_data)<$appointment_count) {
			$appointment_count = count($appointment_data);
		}
		$username_counts = array();
		foreach($usernames as $username) {
			$username_counts[$username]++;
		}
		shuffle_assoc($username_counts);
		
		$used_times = array();
		$emps_times_used = array();
		foreach($username_counts as $k=>$v) {
			if(count($emps_appointment_can_do[$k])<$v) {
				$v = $emps_appointment_can_do[$k];
			}
			for($i=0;$i<$v;$i++) {
				$found = false;
				$num_tries = 50;
				while(!$found) {
					$num_tries--;
					if($num_tries<0) {
						break;
					}
					$rand = rand(0,count($emps_appointment_can_do[$k])-1);
					if(!in_array($emps_appointment_can_do[$k][$rand],$used_times)) {
						$used_times[] = $emps_appointment_can_do[$k][$rand];
						$emps_times_used[$k][] = $emps_appointment_can_do[$k][$rand];
						$found = true;
					}
				}
			}
		}
		foreach($emps_times_used as $k=>$v) {
			foreach($emps_times_used[$k] as $time) {
				$db->query("INSERT INTO coaching_allocator.professional_services_time_impressions
							(
								username
								,date_shown
								,ts
								,site_code
								,client_id
							) VALUES (
								'".$db->clean($k)."'
								,'".date('Y-m-d',strtotime($time))."'
								,NOW()
								,'".$db->clean($siteCode)."'
								,'".$db->clean($user)."'
							)");
				$appointment_dates[$date][] = array('key'=>$time.'|||'.$k,'value'=>$appointment_data[$time]);
			}
		}
		uasort($appointment_dates[$date],function($a,$b) {
			$date_a = substr($a['key'],0,strpos($a['key'],'|||')-1);
			$date_b = substr($b['key'],0,strpos($b['key'],'|||')-1);
			return strtotime($date_a) - strtotime($date_b);
		});
		/*$nums = array();
		for($i=0;$i<$appointment_count;$i++) {
			$found = false;
			while(!$found) {
				$rand = rand(0,count($appointment_data)-1);
				if(!in_array($rand,$nums)) {
					$nums[] = $rand;
					$found = true;
				}
			}
		}
		sort($nums);
		foreach($nums as $num) {
			$j=0;
			foreach($appointment_data as $k=>$v) {
				if($j==$num) {
					$appointment_dates[$date][] = array('key'=>$k,'value'=>$v);
					break;
				}
				$j++;
			}
		}*/
		
		if(!empty($appointment_dates[$first_date])) {
			$dates[] = $first_date;
			$bus_days++;			
		}
	}
?>
<style>
	#application_info {
		padding:10px 0px 20px 0px;
		position:relative;
		margin-top:10px;
	}
	.datepicker_box,.datepicker_time_box {
		width:90%;
		background: #c9f1fd;
		border: 1px solid #00a4d3;
		border-radius: 10px;
		text-align:center;
		padding:10px;
	}
	.datepicker_date, .datepicker_time {
		display:inline-block;
		padding: 5px 10px;
		border:2px solid black;
		border-radius: 10px;
		background:white;
		width:90%;
		margin: 5px auto;
		cursor:pointer;
	}
	
	.datepicker_date.datepicker_selected, .datepicker_time.datepicker_selected {
		border:2px solid #008db1;
		background: #4dd7fa;
	}
	
	.vamiddle, .vamiddle input {
		vertical-align:middle;
		font-size:20px;
	}
	
	.vamiddle input {
		margin:0px 10px;
	}
	
	.schedule_appointment {
		background: #91e4fb;
		border:2px solid #00a4d3;
		font-size:24px;
		font-style:italic;
		cursor:pointer;
		padding:10px 20px;
		border-radius:10px;
		margin-top:10px;
	}
</style>
<script>
var current_appointment_date = '';
var current_appointment_time = '';
function select_appointment_date(me,dt,pretty_dt) {
	$('#appointment_time_label').html(pretty_dt);
	$('.datepicker_date.datepicker_selected').removeClass('datepicker_selected');
	$(me).addClass('datepicker_selected');
	current_appointment_date = dt;
	$('.appointment_times').hide();
	$('#appointment_times_' + dt).show();
}
function select_appointment_time(me,dt) {
	$('.datepicker_time.datepicker_selected').removeClass('datepicker_selected');
	$(me).addClass('datepicker_selected');
	current_appointment_time = dt;
}
function schedule_appointment(me) {
	var errors = '';
	if(current_appointment_time=='') {
		alert("You need to select an appointment time");
	} else {
		$(me).hide();
		$(me).removeAttr('onclick');
		var str = '';
		str += 'appointment_time=' + encodeURIComponent(current_appointment_time);
		str += '&send_reminder_text=' + (($('#send_text_reminder').is(':checked')) ? '1' : '0');
		str += '&send_reminder_email=' + (($('#send_email_reminder').is(':checked')) ? '1' : '0');
		$.ajax({
			  method: "POST",
			  url: "/vx/usa/professional-grant-services/set_appointment.php",
			  data: str
			}).done(function( msg ) {
				if(msg=='already_there') {
					alert('Somebody else just selected this appointment time. Please choose another one.');
				} else {
					$('#application_info').html(msg);
				}
			});
	}
}
$('document').ready(function() {
	$('.datepicker_date:first').click();
});
</script>
<div class="relative block" ng-controller="Members" style="height:100%; min-height:400px; margin:0px auto; max-width:1000px; background: white;">
	<div style="padding:0px 10px;">
		<center><h1>Appointment for Professional Grant Services</h1></center>
		<?php if(!empty($marketer_res[0]['marketer']) && !$is_jeremy) { ?>
		<div class="video">
			<div class="row">
				<div class="company_info_label">
				You are currently working with <?= $marketer_res[0]['first_name'];?>.<br />
				If you have any questions you can call them at 800-858-1052 ext. <?= $marketer_res[0]['extension'];?>,<br />
				or email them at <?= $marketer_res[0]['work_email'];?>.
				</div>
			</div>
		</div>
		<?php } elseif($already_filled_out) { ?>
		<div class="video">
			<div class="row">
				<h1>Your application is being reviewed</h1>
				<div class="confirm_text_block">
					You will receive an email and text message once a decision as been made.
				</div>
			</div>
		</div>
		<?php } else { ?>
		<div id="application_info">
			<h2>Select a Time To Meet with an Admissions Director</h2>
			<div>
				<div class="row" style="padding:20px 0px;">
					<div class="col-sm-4">
						<h3>Select a Date</h3>
						<div class="datepicker_box">
							<?php $i=0; foreach($dates as $date) { $i++; ?>
								<div class="datepicker_date <?= ($i==1) ? 'datepicker_selected' : '';?>" onclick="select_appointment_date(this,'<?= $date;?>','<?= date('l, F jS',strtotime($date));?>'); return false;"><?= date('l, M j',strtotime($date));?></div>
							<?php } ?>
						</div>
					</div>
					<div class="col-sm-8">
						<h3>Select an Available Time on <span id="appointment_time_label"><?= date('l, F jS',strtotime($dates[0]));?></span></h3>
						<div class="datepicker_time_box">
							<?php $i=0; foreach($appointment_dates as $date=>$date_data) { $i++; ?>
							<div class="appointment_times" id="appointment_times_<?= $date;?>" style="<?= ($i==1) ? 'display:block;' : 'display:none;';?>">
								<div class="row">
									<?php $j=0; foreach($date_data as $k=>$v) { $j++; ?>
										<?= ($j%2==1) ? '</div><div class="row">' : '';?>
										<div class="col-sm-6">
											<div class="datepicker_time" onclick="select_appointment_time(this,'<?= $v['key'];?>'); return false;"><?= $v['value'];?></div>
										</div>
									<?php } ?>
								</div>
							</div>
							<?php } ?>
						</div>
					</div>
				</div>
				<div class="row">
					<label class="vamiddle"><input type="checkbox" id="send_text_reminder" checked name="send_text_reminder" />Yes, please send me a text message reminder about my appointment.</label>
				</div>
				<div class="row">
					<label class="vamiddle"><input type="checkbox" id="send_email_reminder" checked name="send_email_reminder" />Yes, please also send me an email reminder as well.</label>
				</div>
				<div class="row">
					<center>
						<button class="schedule_appointment" onclick="schedule_appointment(this); return false;">Schedule Appointment</button>
					</center>
				</div>
			</div>
		</div>
		<?php } ?>
	</div>
</div>
<?
	$title = "Professional Grant Services : ".$siteName;
	include_once($_SERVER['DOCUMENT_ROOT']."/vx/usa/layout/body.php");
?>

Youez - 2016 - github.com/yon3zu
LinuXploit