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/vx_testing/usa/professional-grant-services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/vx_testing/usa/professional-grant-services/set_appointment.php
<?php
	include_once($_SERVER['DOCUMENT_ROOT']."/vx/lib/inc.php");
	if(!empty($_POST['appointment_time'])) {
		//appointment_time (2018-09-12 08:00:00|||davidc|jason)
		$arr = explode('|||',$_POST['appointment_time']);
		$start_date = $arr[0];
		$end_date = date('Y-m-d H:i:s',strtotime('+30 minute',strtotime($start_date)));
		$arr2 = explode('|',$arr[1]);
		$username = $arr2[0];
		if(count($arr2)>1) {
			$rand = rand(0,count($arr2)-1);
			$username = $arr2[$rand];
		}
		
		$emp_appointment_lengths = array();
		$emp_appointment_lengths['bonniek'] = '30';
		$emp_appointment_lengths['davidc'] = '30';
		$emp_appointment_lengths['leslieg'] = '30';
		$emp_appointment_lengths['chriss'] = '30';
		$emp_appointment_lengths['jason'] = '30';
		$emp_appointment_lengths['danielled'] = '30';
		$emp_appointment_lengths['west'] = '30';
		
		if(!empty($emp_appointment_lengths[$username])) {
			$end_date = date('Y-m-d H:i:s',strtotime('+'.$emp_appointment_lengths[$username].' minute',strtotime($start_date)));			
		}
		
		$client_res = $db->query("SELECT first,last,email,phone_1,address1,city,state,zip
								FROM lc2{$siteCode}_lc.lc_reseller
								WHERE id='".clean($user)."'");
		if(empty($client_res)) {
			die();
		}
		$client_info = $client_res[0];
		$profile_res = $db->query("SELECT grant_category,how_use_money,makes_ideal_candidate,money_needed,business_start_expand,business_plan,business_name,years_in_business,number_of_employees,gender,age,citizenship,income,business_type,has_website,website,use_business_to_help_area,will_make_jobs,employed_type,credit_score,military_service,woman_owned,available_savings,available_credit_cards,available_other,any_other_money,any_other_money_explain
									FROM coaching_allocator.profile
									WHERE leads_id='".clean($coaching_lead_id)."'");
		$profile_info = $profile_res[0];
		
		track_member_action('Create Appointment',$username.' - '.$start_date);
		
		$is_there = $db->query("SELECT id FROM coaching_allocator.leads
							WHERE leaddb='".clean($siteCode)."'
							AND leadid='".clean($user)."'");
		if(!empty($is_there)) {
			$coaching_lead_id = $is_there[0]['id'];
		} else {
			$db->query("INSERT INTO coaching_allocator.leads
						(
							leaddb
							,leadid
							,synergy_client_id
							,allocationdate
							,printdate
							,quality
							,importdate
							,count_lead
						) VALUES (
							'".clean($siteCode)."'
							,'".clean($user)."'
							,'0'
							,NOW()
							,'0000-00-00'
							,'A+'
							,NOW()
							,1
						)");
			$coaching_lead_id = $db->last_insert_id();
		}
		
		if(empty($profile_info)) {
			/*if(!in_array($username,array('danielled','west'))) {
				$emp_arr = array('danielled','west');
				$rand = rand(0,1);
				$username = $emp_arr[$rand];
			}
			if(!empty($emp_appointment_lengths[$username])) {
				$end_date = date('Y-m-d H:i:s',strtotime('+'.$emp_appointment_lengths[$username].' minute',strtotime($start_date)));			
			}*/
		} else {
			/*if($profile_info->available_savings*1 + $profile_info->available_credit_cards*1 + $profile_info->available_other*1 < 3000) {
				if(!in_array($username,array('danielled','west'))) {
					$emp_arr = array('danielled','west');
					$rand = rand(0,1);
					$username = $emp_arr[$rand];
				}
				if(!empty($emp_appointment_lengths[$username])) {
					$end_date = date('Y-m-d H:i:s',strtotime('+'.$emp_appointment_lengths[$username].' minute',strtotime($start_date)));			
				}
			}*/
		}
		
		$res = $db->query("SELECT employee_id_code,email,first_name,fullname FROM surfcrm.employees WHERE username='".clean($username)."'");
		$is_there = $db->get_results("SELECT id FROM surfcrm.calendar
									WHERE username='".$db->clean($username)."'
									AND start_date_time='".$db->clean($start_date)."'
									AND type_label IN ('usa_close')");
		if(!empty($is_there)) {
			die('already_there');
		}
		$db->query("INSERT INTO surfcrm.calendar
					(
						timeclock_id
						,username
						,role
						,start_date_time
						,end_date_time
						,site_code
						,client_id
						,type_id
						,type_label
						,client_name
						,client_email
						,client_phone
						,active
						,new
						,ts
					) VALUES (
						'".clean($res[0]['employee_id_code'])."'
						,'".clean($username)."'
						,'Coaching'
						,'".clean($start_date)."'
						,'".clean($end_date)."'
						,'".clean($siteCode)."'
						,'".clean($coaching_lead_id)."'
						,'2'
						,'usa_close'
						,'".clean($client_info['first'].' '.$client_info['last'])."'
						,'".clean($client_info['email'])."'
						,'".clean($client_info['phone_1'])."'
						,'1'
						,'1'
						,NOW()
					)");
		$today = date('w');
		$printdate = (in_array($today,array('0','5','6'))) ? date('Y-m-d',strtotime('next monday')) : date('Y-m-d');
		$db->query("UPDATE coaching_allocator.leads
					SET
						marketer='".clean($username)."'
						,closer='".clean($username)."'
						,code='A'
						,codedate=NOW()
						,closer_action='A'
						,closer_actiondate=NOW()
						,printdate='".clean($printdate)."'
						,has_been_set=1
						,setdate=NOW()
					WHERE id='".clean($coaching_lead_id)."'");
		$db->query("INSERT INTO coaching_allocator.leadlog
					(
						leadid
						,marketer
						,codetype
						,code
						,codedate
					) VALUES (
						'".clean($coaching_lead_id)."'
						,'".clean($username)."'
						,'closer_action'
						,'A'
						,NOW()
					)");
		$db->query("UPDATE coaching_allocator.professional_services_time_impressions
					SET clicked=1
					WHERE site_code='".clean($siteCode)."'
					AND client_id='".clean($user)."'
					AND username='".clean($username)."'
					AND date_shown='".clean(date('Y-m-d',strtotime($start_date)))."'");
		$db->query("UPDATE coaching_allocator.leads
					SET current_stage='Video - Form - Appt - No Show, Never Talked'
					,stage_set_by='SurfCRM'
					,stage_set_on=NOW()
					,stage_next_email='12'
					,stage_next_email_date='".date('Y-m-d',strtotime('+14 day'))."'
					WHERE id='".clean($coaching_lead_id)."'
					AND current_stage='No Appointment - Never Talked To'");
		
		//Send email to Heinz and Closer
		$body = "<p>{$client_info['first']} {$client_info['last']} has made an appointment with {$res[0]['fullname']} at {$start_date}.</p>";
		$video_start_res = $db->query("SELECT ts FROM tracker.`member_actions` WHERE site_code='".clean($siteCode)."' AND client_id='".clean($user)."' AND action='Started Video'");
		$video_finish_res = $db->query("SELECT ts FROM tracker.`member_actions` WHERE site_code='".clean($siteCode)."' AND client_id='".clean($user)."' AND action='Watched Video'");
		$appointment_video_start_res = $db->query("SELECT ts FROM tracker.`member_actions` WHERE site_code='".clean($siteCode)."' AND client_id='".clean($user)."' AND action='Started Appointment Video'");
		$appointment_video_finish_res = $db->query("SELECT ts FROM tracker.`member_actions` WHERE site_code='".clean($siteCode)."' AND client_id='".clean($user)."' AND action='Watched Appointment Video'");
		$qna_video_start_res = $db->query("SELECT ts FROM tracker.`member_actions` WHERE site_code='".clean($siteCode)."' AND client_id='".clean($user)."' AND action='Started QNA Video'");
		$qna_video_finish_res = $db->query("SELECT ts FROM tracker.`member_actions` WHERE site_code='".clean($siteCode)."' AND client_id='".clean($user)."' AND action='Watched QNA Video'");
		$body .= "<p><strong>Jason Vid Started</strong>: ".((!empty($video_start_res)) ? date('M j, Y, g:i a',strtotime($video_start_res[0]['ts'])) : 'Not Done').'</p>';
		$body .= "<p><strong>Jason Vid Finished</strong>: ".((!empty($video_finish_res)) ? date('M j, Y, g:i a',strtotime($video_finish_res[0]['ts'])) : 'Not Done').'</p>';
		$body .= "<p><strong>Appointment Vid Started</strong>: ".((!empty($appointment_video_start_res)) ? date('M j, Y, g:i a',strtotime($appointment_video_start_res[0]['ts'])) : 'Not Done').'</p>';
		$body .= "<p><strong>Appointment Vid Finished</strong>: ".((!empty($appointment_video_finish_res)) ? date('M j, Y, g:i a',strtotime($appointment_video_finish_res[0]['ts'])) : 'Not Done').'</p>';
		$body .= "<p><strong>QA Vid Started</strong>: ".((!empty($qna_video_start_res)) ? date('M j, Y, g:i a',strtotime($qna_video_start_res[0]['ts'])) : 'Not Done').'</p>';
		$body .= "<p><strong>QA Vid Finished</strong>: ".((!empty($qna_video_finish_res)) ? date('M j, Y, g:i a',strtotime($qna_video_finish_res[0]['ts'])) : 'Not Done').'</p>';
		
		$body .= "<p>Their application info:</p>";
		foreach($client_info as $k=>$v) {
			if(is_array($v)) {
				$body .= '<p><strong>'.$k.'</strong>: '.implode(', ',$v).'</p>';
			} else {
				$body .= '<p><strong>'.$k.'</strong>: '.$v.'</p>';
			}
		}
		foreach($profile_info as $k=>$v) {
			if(is_array($v)) {
				$body .= '<p><strong>'.$k.'</strong>: '.implode(', ',$v).'</p>';
			} else {
				$body .= '<p><strong>'.$k.'</strong>: '.$v.'</p>';
			}
		}
		//mailgun_send_message($res[0]['email'],'NoReply@'.$siteDomain,'USA Professional Grant Services Appointment',$body,'1','professional_grant_services','','',$siteCode,$user);
		
		if(!empty($_POST['send_reminder_text'])) {
			$db->query("INSERT INTO coaching_allocator.appointment_email_queue
						(
							leadid
							,type
							,special_type
							,to_email
							,from_user
							,appointment_time
							,send_time
							,ts
						) VALUES (
							'".clean($coaching_lead_id)."'
							,'text'
							,'usa_close'
							,'".clean($client_info['phone_1'])."'
							,'".clean($username)."'
							,'".clean($start_date)."'
							,'".clean(date('Y-m-d H:i:s',strtotime('-60 minute',strtotime($start_date))))."'
							,NOW()
						)");
		}
		if(!empty($_POST['send_reminder_email'])) {
			if(date('Y-m-d')==date('Y-m-d',strtotime($start_date))) {
				$pretty_date = date('F jS \a\t g:i a',strtotime($start_date)).' MST';
				/*$body = "<p>{$client_info['first']},</p>
						<p>Thank you for scheduling an appointment to speak with me. Our appointment is set for {$pretty_date}.  When we speak, I'll get to know your project a little better, explain the professional writing and researching services to you and answer any questions you might have.</p>
						<p>We've been in business for over 18 years. Our professionals have decades of experience and have helped hundreds of companies through the application process. To prepare for our conversation, please visit our company website by clicking the link below:</p>
						<p><a href=\"https://usbusinessfundingsolutions.com\">www.usbusinessfundingsolutions.com</a></p>
						<p>Please have a computer or tablet available for our appointment so I can give you the appropriate information.</p>
						<p>I look forward to speaking with you!</p>
						<p>{$res[0]['first_name']}<br />US Business Funding Solutions<br />800-858-1052 ext. {$res[0]['ext']}</p>";
				$attachments = array();
				$ics_link = ICSGenerator($start_date,$end_date,'US Business Funding Solutions Overview','I\'ll get to know your project a little better, explain the professional writing and researching services to you and answer any questions you might have.','Over the Phone',$res[0]['first_name'],$res[0]['email']);
				$attachments[] = $ics_link;
				mailgun_send_message($_SESSION['email'],$res[0]['email'],"Grant Help Appointment and Website Link",$body,'1','professional_grant_services_appointment','','',$siteCode,$user,$attachments,'',0);
				unlink($ics_link);*/
				$db->query("INSERT INTO coaching_allocator.appointment_email_queue
								(
									leadid
									,type
									,special_type
									,to_email
									,from_user
									,appointment_time
									,send_time
									,ts
								) VALUES (
									'".clean($coaching_lead_id)."'
									,'email'
									,'usa_close'
									,'".clean($client_info['email'])."'
									,'".clean($username)."'
									,'".clean($start_date)."'
									,'".clean(date('Y-m-d H:i:s',strtotime('-2 hour',strtotime($start_date))))."'
									,NOW()
								)");
			} else {
				if(!empty($_POST['send_reminder_email'])) {
					$db->query("INSERT INTO coaching_allocator.appointment_email_queue
								(
									leadid
									,type
									,special_type
									,to_email
									,from_user
									,appointment_time
									,send_time
									,ts
								) VALUES (
									'".clean($coaching_lead_id)."'
									,'email'
									,'usa_close'
									,'".clean($client_info['email'])."'
									,'".clean($username)."'
									,'".clean($start_date)."'
									,'".clean(date('Y-m-d H:i:s',strtotime('-24 hour',strtotime($start_date))))."'
									,NOW()
								)");
				}
			}
		}
		
		//Check USA upsell allocator and remove if needed
		$is_there = $db->get_results("SELECT id,disposition,datecreated FROM allocator.leads WHERE leadtype='sales' AND leaddb='{$siteCode}' AND leadid='{$user}'");
		$action_taken = 'Nothing';
		if(!empty($is_there)) {
			if($is_there[0]->disposition=='SALE') {
				$action_taken = 'Nothing';				
			} else {
				$db->query("DELETE FROM allocator.leads WHERE id='".$db->clean($is_there[0]->id)."'");
				$db->query("DELETE FROM surfcrm.client_tabs WHERE tab_site_code='".$db->clean($siteCode)."' AND tab_id='".$db->clean($is_there[0]->id)."'");
				//$db->query("UPDATE allocator.leads SET disposition='Not Interested / Hangup',dispositiondate=NOW() WHERE id='".clean($is_there[0]->id)."'");
				$action_taken = 'Removed Upsell Lead';
			}
		}
		$db->query("INSERT INTO lc2admin.professional_services_remove_upsell_allocator
					(
						site_code
						,client_id
						,client_name
						,action_taken
						,ts
					) VALUES (
						'".clean($siteCode)."'
						,'".clean($user)."'
						,'".clean($client_info['first'].' '.$client_info['last'])."'
						,'".clean($action_taken)."'
						,NOW()
					)");
		
		$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;
		}
		if(!empty($emp_appointment_lengths[$emp])) {
			$appointment_minutes = $emp_appointment_lengths[$emp];
		} else {
			$appointment_minutes = '20';
		}
		$pretty_start_time = '';
		if($timezone_offset=='0') {
			$pretty_start_time = date('g:i',strtotime($start_date));
			$pretty_end_time = date('g:i a',strtotime('+'.$appointment_minutes.' minute',strtotime($start_date)));
		} elseif($timezone_offset*1 < 0) {
			$timezone_offset_minus = $timezone_offset*-1;
			$pretty_start_time = date('g:i',strtotime('-'.$timezone_offset_minus.' hour',strtotime($start_date)));
			$pretty_end_time = date('g:i a',strtotime('-'.$timezone_offset_minus.' hour',strtotime('+'.$appointment_minutes.' minute',strtotime($start_date))));
		} else {
			$pretty_start_time = date('g:i',strtotime('+'.$timezone_offset.' hour',strtotime($start_date)));
			$pretty_end_time = date('g:i a',strtotime('+'.$timezone_offset.' hour',strtotime('+'.$appointment_minutes.' minute',strtotime($start_date))));
		}
		
		$marketer_res = $db->get_results("SELECT first_name FROM surfcrm.employees WHERE username='".$db->clean($username)."'");
		$marketer = $marketer_res[0]->first_name;
		
		//Check if they have watched the video
		$watched_qna_video = $db->query("SELECT id
										FROM tracker.member_actions
										WHERE site_code='".clean($siteCode)."'
										AND client_id='".clean($user)."'
										AND action='Watched QNA Video'");
		?>
		<center style="font-family: 'Montserrat', sans-serif;">
			<h2>Thank You</h2>
			<div style="padding:20px 0px;">
				<h3>Your appointment is confirmed for:</h3>
				<h2><?= date('l, F jS, Y',strtotime($start_date));?><br /><?= $pretty_start_time;?></h2>
				<h2><small>You will be speaking with <strong><?= $marketer;?></strong></h2>
				<div>
					<div class="video">
						<p style="font-size:18px;">Next, please <strong>Confirm Your Appointment</strong> by clicking the <strong>Confirmation Email link</strong> we just sent to your Email.</p>
						<div style="float:left;padding-right:10px;"><img src="https://usbusinessfundingsolutions.com/images/8748009.png" style="width:64px;" /></div>
						<p style="font-size:18px;text-align:left;">***Check your <strong>SPAM, Promotions, Updates, or Social folders</strong> to find your <strong>Confirmation Email</strong>. Once located, move it to your Inbox to make sure future emails go directly there.***</p>
						<div style="clear:both;"></div>
					</div>
				</div>
			</div>
		</center>
		<style>
			.video {
				margin:10px auto;
				width:640px;
				position:relative;
				max-width:90%;
			}
		</style>
		<?php if(empty($watched_qna_video)) { ?>
		<script>
			function track_qna_video_watched() {
				var str="track_video=1";
				$.ajax({
				  method: "POST",
				  url: "/vx/usa/professional-grant-services/track_qna_video_watched.php",
				  data: str
				}).done(function( msg ) {
				});
			}
			var tracked_qna_video_started = false;
			function track_qna_video_started() {
				if(!tracked_qna_video_started) {
					tracked_qna_video_started = true;
					var str="track_video=1";
					$.ajax({
					  method: "POST",
					  url: "/vx/usa/professional-grant-services/track_qna_video_started.php",
					  data: str
					}).done(function( msg ) {
					});
				}
			}
			var marked_qna_tracked = false;
			function check_track_qna_video(me) {
				track_qna_video_started();
				if(me.currentTime >= 450) {
					if(!marked_qna_tracked) {
						track_qna_video_watched();
						marked_qna_tracked = true;
					}
				}
			}
		</script>
		<div class="video">
			<video src="https://surfcrm.com/training_calls/videos/usa_professional_services_qna.mp4" poster="https://surfcrm.com/training_calls/videos/usa_professional_services_qna.png" ontimeupdate="check_track_qna_video(this);" controls style="width:100%;"></video>
		</div>
		<?php } ?>
		<?php
		$to = $client_info['email'];
		$from = $res[0]['email'];
		$subject = 'Appointment Confirmation';
		$body = '<center style="font-family: \'Montserrat\', sans-serif;">
				<h2>Thank You</h2>
				<div>
					<h3>Your appointment is set for:</h3>
					<h2>' . date('l, F jS, Y',strtotime($start_date)).'<br />'. $pretty_start_time.' - '.$pretty_end_time.'</h2>
					<h2><small>You will be speaking with <strong>'.$marketer.'</strong></small></h2><small>
					<p style="font-size:18px;">To prepare for our conversation, please <strong>visit our company website,</strong></p>
					<p style="font-size:22px;"><a href="https://usbusinessfundingsolutions.com/confirm_appointment.php?site_code='.$siteCode.'&client_id='.$user.'" target="_blank" style="color:blue;">Confirm Your Appointment</a></p>
				</small></div><small>
			</small></center>';
		$tag = 'Professional Services Appointment Confirmation';
		$bcc = '';
		//echo $from.' - '.$body;
		$response = mailgun_send_message($to,$from,$subject,$body,1,$tag,'',$bcc,'',0,array(),'',0);
	}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit