}
        $print_format = $this->_request['print_format'];
        $width = $this->_request['width'];
        $height = $this->_request['height'];
        $vat_rate = $this->_request['vat_rate'];
        $old_print_format = $this->_request['old_print_format'];
        $sql = 'update printer set ';
        $sql .= 'print_format = :print_format, ';
        $sql .= 'width = :width, ';
        $sql .= 'height = :height, ';
        $sql .= 'vat_rate = :vat_rate ';
        $sql .= 'where print_format = :old_print_format ';
        $stmt = $dbh->prepare($sql);
        $stmt->bindValue(":print_format", $print_format);
        $stmt->bindValue(":width", $width);
        $stmt->bindValue(":height", $height);
        $stmt->bindValue(":vat_rate", $vat_rate);
        $stmt->bindValue(":old_print_format", $old_print_format);
        if ($stmt->execute()) {
            $this->response(json_encode(array("result" => "success")), 200);
        } else {
            $this->response(json_encode($stmt->errorInfo()), 500);
        }
    }
}
//class
// Initiiate Library
$myservice = new MyService();
$myservice->processApi();
?>
 
                    if ($data[0]["password"] == $this->request['password']) {
                        $access = $this->random_str(50);
                        $columns = array("access", "uid");
                        $values = array($access, $data[0]["user_id"]);
                        if ($conn->insertData("sessions", $columns, $values)) {
                            return array("status" => "logged in", "uid" => $data[0]["user_id"], "accesshash" => $access);
                        } else {
                            return parent::_response("Failed to add user session", 500);
                        }
                    } else {
                        return parent::_response("Invalid Login", 403);
                    }
                } else {
                    return parent::_response("Failed to connect to DB", 500);
                }
            } else {
                return parent::_response("User or password not supplied", 400);
            }
        } else {
            return parent::_response("Incorrect login format or nothing sent", 400);
        }
    }
}
// end of class
//create the service
try {
    $API = new MyService($_REQUEST['request'], $_SERVER_['HTTP_ORIGIN']);
    echo $API->processAPI();
} catch (Exception $e) {
    echo json_encode(array("Error" => $e->getMessage()));
}