| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/handjobcafe.com/public_html/members/js/jRating/php/ |
Upload File : |
<?php
$aResponse['error'] = false;
$aResponse['message'] = '';
// ONLY FOR THE DEMO, YOU CAN REMOVE THIS VAR
$aResponse['server'] = '';
// END ONLY FOR DEMO
if(isset($_POST['action']))
{
if(htmlentities($_POST['action'], ENT_QUOTES, 'UTF-8') == 'rating')
{
/*
* vars
*/
$id = intval($_POST['idBox']);
$rate = floatval($_POST['rate']);
// YOUR MYSQL REQUEST HERE or other thing :)
/*
*
*/
$config[database] = 'y27qpdhz';
$config[db_host] = 'localhost';
$config[db_user] = 'feswosc1';
$config[db_pass] = 'zvr0!17wvtpn';
mysql_connect($config[db_host], $config[db_user], $config[db_pass]);
mysql_select_db($config[database]);
$today = date("Y-m-d");
mysql_query("UPDATE updates SET rate_sum=rate_sum+$rate, total_rates=total_rates+1 WHERE id=$id");
// if request successful
$success = true;
// else $success = false;
// json datas send to the js file
if($success)
{
$aResponse['message'] = 'Your rate has been successfuly recorded. Thanks for your rate :)';
// ONLY FOR THE DEMO, YOU CAN REMOVE THE CODE UNDER
$aResponse['server'] = '<strong>Success answer :</strong> Success : Your rate has been recorded. Thanks for your rate :)<br />';
$aResponse['server'] .= '<strong>Rate received :</strong> '.$rate.'<br />';
$aResponse['server'] .= '<strong>ID to update :</strong> '.$id;
// END ONLY FOR DEMO
echo json_encode($aResponse);
}
else
{
$aResponse['error'] = true;
$aResponse['message'] = 'An error occured during the request. Please retry';
// ONLY FOR THE DEMO, YOU CAN REMOVE THE CODE UNDER
$aResponse['server'] = '<strong>ERROR :</strong> Your error if the request crash !';
// END ONLY FOR DEMO
echo json_encode($aResponse);
}
}
else
{
$aResponse['error'] = true;
$aResponse['message'] = '"action" post data not equal to \'rating\'';
// ONLY FOR THE DEMO, YOU CAN REMOVE THE CODE UNDER
$aResponse['server'] = '<strong>ERROR :</strong> "action" post data not equal to \'rating\'';
// END ONLY FOR DEMO
echo json_encode($aResponse);
}
}
else
{
$aResponse['error'] = true;
$aResponse['message'] = '$_POST[\'action\'] not found';
// ONLY FOR THE DEMO, YOU CAN REMOVE THE CODE UNDER
$aResponse['server'] = '<strong>ERROR :</strong> $_POST[\'action\'] not found';
// END ONLY FOR DEMO
echo json_encode($aResponse);
}