Code Duplication    Length = 6-6 lines in 3 locations

php/JodelAccount.php 3 locations

@@ 362-367 (lines=6) @@
359
360
        $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')");
361
        
362
        if($result === false)
363
        {
364
            $error = db_error();
365
            echo $error;
366
            error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error);
367
        }
368
369
        if($result->num_rows == 0)
370
        {
@@ 394-399 (lines=6) @@
391
        $result = $db->query("INSERT INTO votes (device_uid, postId, type)
392
                        VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
393
        
394
        if($result === false){
395
                $error = db_error();
396
                echo $error;
397
                echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
398
        }       
399
    }
400
401
    function registerAccount($location) {
402
        $accountCreator = new CreateUser();
@@ 426-431 (lines=6) @@
423
                        "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
424
425
        $success = TRUE;
426
        if($result === false){
427
                $error = db_error();
428
                echo $error;
429
                echo "Adding account failed: (" . $result->errno . ") " . $result->error;
430
                $success = FALSE;
431
        }   
432
        
433
        return $device_uid;
434
    }