File indexing completed on 2024-12-22 05:33:20
0001 <?php 0002 $aResponse['error'] = false; 0003 $aResponse['message'] = ''; 0004 0005 0006 if(isset($_POST['action'])) 0007 { 0008 if(htmlentities($_POST['action'], ENT_QUOTES, 'UTF-8') == 'rating') 0009 { 0010 /* 0011 * vars 0012 */ 0013 $id = intval($_POST['idBox']); 0014 $rate = floatval($_POST['rate']); 0015 0016 // YOUR MYSQL REQUEST HERE or other thing :) 0017 /* 0018 * 0019 */ 0020 0021 // if request successful 0022 $success = true; 0023 // else $success = false; 0024 0025 0026 // json datas send to the js file 0027 if($success) 0028 { 0029 $aResponse['message'] = 'Your rate has been successfuly recorded. Thanks for your rate :)'; 0030 0031 echo json_encode($aResponse); 0032 } 0033 else 0034 { 0035 $aResponse['error'] = true; 0036 $aResponse['message'] = 'An error occured during the request. Please retry'; 0037 0038 0039 echo json_encode($aResponse); 0040 } 0041 } 0042 else 0043 { 0044 $aResponse['error'] = true; 0045 $aResponse['message'] = '"action" post data not equal to \'rating\''; 0046 0047 0048 echo json_encode($aResponse); 0049 } 0050 } 0051 else 0052 { 0053 $aResponse['error'] = true; 0054 $aResponse['message'] = '$_POST[\'action\'] not found'; 0055 0056 0057 echo json_encode($aResponse); 0058 }