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

@@ 497-502 (lines=6) @@
494
495
        $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')");
496
        
497
        if($result === false)
498
        {
499
            $error = db_error();
500
            echo $error;
501
            error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error);
502
        }
503
504
        if($result->num_rows == 0)
505
        {
@@ 529-533 (lines=5) @@
526
        $result = $db->query("INSERT INTO votes (device_uid, postId, type)
527
                        VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
528
        
529
        if($result === false){
530
                $error = db_error();
531
                echo $error;
532
                echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
533
        }       
534
    }
535
536
    function registerAccount($location) {
@@ 561-566 (lines=6) @@
558
                        "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
559
560
        $success = TRUE;
561
        if($result === false){
562
                $error = $db->error();
563
                echo $error;
564
                echo "Adding account failed: (" . $result->errno . ") " . $result->error;
565
                $success = FALSE;
566
        }   
567
        
568
        return $device_uid;
569
    }