Code Duplication    Length = 5-6 lines in 4 locations

admin.php 1 location

@@ 53-57 (lines=5) @@
50
                    	. "','" . $db->escape_string($_POST['device_uid'])
51
                    	. "','" . $db->escape_string($_POST['rights']) . "')");
52
    
53
    if($result === false){
54
            $error = db_error();
55
            error_log($error);
56
            error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error);
57
    } 
58
}
59
60
//Vote

php/JodelAccount.php 3 locations

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