| 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/coaching_sites/usbusinessfundingsolutions.com/member/ajax/ |
Upload File : |
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/php_header.php');
if(!empty($_POST['question'])) {
$client = $db->get_results("SELECT first,last,phone_1 as phone,email,client_type FROM lc2synment_lc.lc_reseller WHERE id='".$db->clean($_SESSION['Client']['id'])."'");
$coach = str_replace('%40','@',$_POST['research_coach']);
$coach_res = $db->get_results("SELECT username FROM surfcrm.employees WHERE work_email='".$db->clean($coach)."'");
$coach_username = (empty($coach_res)) ? '' : $coach_res[0]->username;
$profiles = $db->get_results("
SELECT id,date_entered
FROM client_profile
WHERE client_id = '".$db->clean($_SESSION['Client']['id'])."'
LIMIT 1;
");
$research_coach = '';
if(!empty($profiles)) {
$profile = $profiles[0];
$profile_id = $profile->id;
$grdb_profile_id_arr = $db->get_results("SELECT assigned_agent,profiles_id FROM grdb.grd_profiles WHERE site_code='synment' AND site_profiles_id='{$profile_id}'");
$grdb_profile_id = $grdb_profile_id_arr[0]->profiles_id;
$research_coach_arr = $db->get_results("SELECT fname,email,ext FROM grdb.grd_users WHERE users_id=(SELECT assigned_agent FROM grdb.grd_profiles WHERE profiles_id='".$db->clean($grdb_profile_id)."')");
$research_coach = $research_coach_arr[0]->email;
$research_coach_name = $research_coach_arr[0]->fname;
$research_coach_phone = "(800) 858-1052 ext ".$research_coach_arr[0]->ext;
if($research_coach=='jeremy@synergytpsreports.com') {
$research_coach = 'example_research_coach@example.com';
$research_coach_phone = '(555) 555-5555 ext 5';
}
$coach_username_res = $db->get_results("SELECT username FROM surfcrm.employees WHERE agent_id='".$db->clean($grdb_profile_id_arr[0]->assigned_agent)."'");
$coach_username = $coach_username_res[0]->username;
}
if(!empty($research_coach)) {
$coach = $research_coach;
}
$body = '';
foreach($client[0] as $k=>$v) {
$body .= "$k: $v\n";
}
$subject = (!empty($_POST['client_type'])) ? 'Question From '.$_POST['client_type'].' Client' : 'Question From Research Client';
$body .= "\nquestion: ".urldecode($_POST['question']);
$headers = "From:\"{$client[0]->first} {$client[0]->last}\" <{$client[0]->email}>\r\nReplyTo:\"{$client[0]->first} {$client[0]->last}\" <{$client[0]->email}>\r\n";
$to = $coach;
$from = 'NoReply@usbusinessfundingsolutions.com';
$subject = 'USBusinessFundingSolutions Contact - Funding Sources';
$message = nl2br($body);
$tag = 'Research Coach Contact Form';
$cc = '';
$bcc = '';
$site_code = 'synment';
$client_id = $_SESSION['Client']['id'];
$attachments = array();
//include_once($_SERVER['DOCUMENT_ROOT'].'/member/php/mailgun.php');
//mailgun_send_message($to,$from,$subject,$message,1,$tag,$cc,$bcc,$site_code,$client_id,$attachments,$client[0]->email,1);
//if(mail($coach.$extra_to,$subject,$body,$headers)) {
$db->query("INSERT INTO lc2synment_lc.coach_email_inboxes
(
client_id
,coach_username
,ts
,username
,result
,subject
,body
,sender_name
,has_seen
,from_email
,to_header
) VALUES (
'".$db->clean($client_id)."'
,'".$db->clean($coach_username)."'
,NOW()
,'".$db->clean($client[0]->first.' '.$client[0]->last)."'
,'INBOX'
,'".$db->clean($subject)."'
,'".$db->clean($message)."'
,'".$db->clean($client[0]->first.' '.$client[0]->last)."'
,0
,'".$db->clean($client[0]->email)."'
,'".$db->clean($to)."'
)");
die('success');
//} else {
// die('failure: no question was provided.');
//}
} else {
die('failure: no question was provided.');
}
?>