Code Duplication    Length = 5-6 lines in 4 locations

admin.php 1 location

@@ 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

php/JodelAccount.php 3 locations

@@ 511-516 (lines=6) @@
508
509
        $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')");
510
        
511
        if($result === false)
512
        {
513
            $error = db_error();
514
            echo $error;
515
            error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error);
516
        }
517
518
        if($result->num_rows == 0)
519
        {
@@ 543-547 (lines=5) @@
540
        $result = $db->query("INSERT INTO votes (device_uid, postId, type)
541
                        VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
542
        
543
        if($result === false){
544
                $error = db_error();
545
                echo $error;
546
                echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
547
        }       
548
    }
549
550
    function registerAccount($location) {
@@ 575-580 (lines=6) @@
572
                        "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
573
574
        $success = TRUE;
575
        if($result === false){
576
                $error = $db->error();
577
                echo $error;
578
                echo "Adding account failed: (" . $result->errno . ") " . $result->error;
579
                $success = FALSE;
580
        }   
581
        
582
        return $device_uid;
583
    }