-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveRating.php
More file actions
35 lines (23 loc) · 903 Bytes
/
saveRating.php
File metadata and controls
35 lines (23 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
if (isset($_REQUEST['user_id']) && isset($_REQUEST['fnm_id']) && isset($_REQUEST['rating'])) {
include_once 'globalConsts.php';
session_start();
$user_id=$_COOKIE["user_id"];
$query = "Insert INTO user_rating (UR_UserID,UR_Rating,UR_FNM_ID) values(" . $_REQUEST['user_id'] . "," . $_REQUEST['rating'] . ",'" . $_REQUEST['fnm_id'] . "')";
mysql_connect(SERVER_ADDRESS, USER, PASS);
if (mysqli_connect_errno()) {
//echo "Could not connect to database";
$response["success"] = 0;
$response["message"] = "Failed to connect to database";
echo json_encode($response);
exit;
}
mysql_select_db(DATABASE);
$result = mysql_query($query);
if ($result) {
$response["success"] = 1;
$response['query'] = $query;
}
echo json_encode($response);
}
?>