@@ 487-492 (lines=6) @@ | ||
484 | ||
485 | $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')"); |
|
486 | ||
487 | if($result === false) |
|
488 | { |
|
489 | $error = db_error(); |
|
490 | echo $error; |
|
491 | error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error); |
|
492 | } |
|
493 | ||
494 | if($result->num_rows == 0) |
|
495 | { |
|
@@ 519-523 (lines=5) @@ | ||
516 | $result = $db->query("INSERT INTO votes (device_uid, postId, type) |
|
517 | VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')"); |
|
518 | ||
519 | if($result === false){ |
|
520 | $error = db_error(); |
|
521 | echo $error; |
|
522 | echo "Adding Vote failed: (" . $result->errno . ") " . $result->error; |
|
523 | } |
|
524 | } |
|
525 | ||
526 | function registerAccount($location) { |
|
@@ 551-556 (lines=6) @@ | ||
548 | "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') "); |
|
549 | ||
550 | $success = TRUE; |
|
551 | if($result === false){ |
|
552 | $error = $db->error(); |
|
553 | echo $error; |
|
554 | echo "Adding account failed: (" . $result->errno . ") " . $result->error; |
|
555 | $success = FALSE; |
|
556 | } |
|
557 | ||
558 | return $device_uid; |
|
559 | } |
@@ 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 |