| @@ 65-69 (lines=5) @@ | ||
| 62 | . "','" . $db->escape_string($_POST['device_uid']) |
|
| 63 | . "','" . $db->escape_string($_POST['rights']) . "')"); |
|
| 64 | ||
| 65 | if($result === false){ |
|
| 66 | $error = db_error(); |
|
| 67 | error_log($error); |
|
| 68 | error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | //Vote |
|
| @@ 502-507 (lines=6) @@ | ||
| 499 | ||
| 500 | $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
|
| 501 | ||
| 502 | if($result === false) |
|
| 503 | { |
|
| 504 | $error = db_error(); |
|
| 505 | echo $error; |
|
| 506 | error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error); |
|
| 507 | } |
|
| 508 | ||
| 509 | if($result->num_rows == 0) |
|
| 510 | { |
|
| @@ 534-538 (lines=5) @@ | ||
| 531 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
|
| 532 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
|
| 533 | ||
| 534 | if($result === false){ |
|
| 535 | $error = db_error(); |
|
| 536 | echo $error; |
|
| 537 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
|
| 538 | } |
|
| 539 | } |
|
| 540 | ||
| 541 | function registerAccount($location) { |
|
| @@ 566-571 (lines=6) @@ | ||
| 563 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
|
| 564 | ||
| 565 | $success = TRUE; |
|
| 566 | if($result === false){ |
|
| 567 | $error = $db->error(); |
|
| 568 | echo $error; |
|
| 569 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
|
| 570 | $success = FALSE; |
|
| 571 | } |
|
| 572 | ||
| 573 | return $device_uid; |
|
| 574 | } |
|