Slim framework error and cpainel JWT authentication

I have the following problem: Slim works without problems with jwt authentication. When I pass the files to my server's cpainel, slim middleware pales because the scripts are in the provider's folder outside of public_html. They even informed me that this can cause problems, but there is no solution. I can't place the provider's public_html folder because it can't find the path of the route.

My index.php

if (PHP_SAPI == & # 39; cli-server & # 39;) {
// To help the integrated PHP development server, check if the request was really for
// something that should probably be served as a static file
$ url = parse_url ($ _ SERVER (& # 39; REQUEST_URI & # 39;));
$ file = Direct . $ url (& # 39; route & # 39;);
if (is_file ($ file)) {
returns false;

}

}

demand Direct . & # 39; /../ autoload.php & # 39 ;;

session_start ();

// Instance the application
$ settings = require Direct . & # 39; /../ src / settings.php & # 39 ;;
$ app = new Slim App ($ settings);

// Configure dependencies
demand Direct . & # 39; /../ src / dependencies.php & # 39 ;;

// Register middleware
demand Direct . & # 39; /../ src / middleware.php & # 39 ;;

// Register routes
demand Direct . & # 39; /../ src / routes.php & # 39 ;;

// Run application
$ app-> run ();

My Middleware.php

// for example: $ app-> add (new Slim Csrf Guard);

$ app-> add (new Tuupola Middleware JwtAuthentication ((
"path" => "/ api", / * or ("/ api", "/ admin") * /
"attribute" => "decoded_token_data",
"secret" => "supersecretkeyyoushmitmitmitmittogithub",
"algorithm" => ("HS256"),
"error" => function ($ answer, $ arguments) {
$ data ("status") = "error";
$ data ("message") = $ arguments ("message");
return $ answer
-> withHeader ("Content-Type", "application / json")
-> write (json_encode ($ data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
}
)));

These codes work in Xampp. The problem is in cpainel

My test routes

$app->post('/login', function (Request $request, Response $response, array $args) {

$input = $request->getParsedBody();
$sql = "SELECT * FROM tab_usuario WHERE cadastro_usuario= :cadastro_usuario";
$sth = $this->db->prepare($sql);
$sth->bindParam("cadastro_usuario", $input('cadastro_usuario'));
$sth->execute();
$user = $sth->fetchObject();

// verify email address.
if(!$user) {
    return $this->response->withJson(('error' => true, 'message' => 'These credentials do not match our records.'));  
}

// verify password.
if (!password_verify($input('senha_usuario'),$user->senha_usuario)) {
    return $this->response->withJson(('error' => true, 'message' => 'These credentials do not match our records.'));  
}

$settings = $this->get('settings'); // get settings array.

$token = JWT::encode(('cod_usuario' => $user->cod_usuario, 'cadastro_usuario' => $user->cadastro_usuario), $settings('jwt')('secret'), "HS256");

return $this->response->withJson(('token' => $token));

});

$ app-> group (& # 39; / api & # 39 ;, function () use ($ app) {

$app->get('/user',function(Request $request, Response $response, array $args) {
    print_r($request->getAttribute('decoded_token_data'));       


});

});

$ app-> get (& # 39; / allproducts & # 39 ;, function ($ request, $ response, $ args) {
$ sth = $ this-> db-> prepare ("SELECT * FROM products");
$ sth-> execute ();
$ all = $ sth-> fetchAll ();
returns $ this-> response-> withJson ($ all);
});

I would like to know the options I have if it is not possible to use JWT with Slim. I need to protect the routes.

Stored procedures – Error handling in MySQL events

I have an event that runs every 15 minutes like this:

CREATE EVENT test_event_02
ON SCHEDULE EVERY 15 MINUTE
STARTS CURRENT_TIMESTAMP + 1 HOUR
ENDS CURRENT_TIMESTAMP + INTERVAL 2 YEAR
ON COMPLETION PRESERVE
DO
    CALL StoredProc_1(NOW());
    CALL StoredProc_2(NOW());
    .
    .
    .
    CALL StoredProc_10(NOW());

Now I want to add error handling is this event. But you should detect any error and insert the process name and the error message in the table FailedEvents (I.D, ProcName, Message)

Something like this:

CREATE EVENT test_event_02
ON SCHEDULE EVERY 15 MINUTE
STARTS CURRENT_TIMESTAMP + 1 HOUR
ENDS CURRENT_TIMESTAMP + INTERVAL 2 YEAR
ON COMPLETION PRESERVE
DO

   FOR EVERY PROC:
       CALL PROC();
       IF ERROR:
           INSERT INTO FailedEvents(ProcName, Message) SELECT `ProcName`, ExceptionMessage
       ELSE:
           CONTINUE EXECUTING REMANING PROCS

Can someone help me with this?

magento2.3 – Error in the update of the Magento CE version from 2.2.3 to 2.3.0 with the composer?

I tried using the command below but getting errors

Command 1:

composer requires magento / product-community-edition 2.3.0 –no-update

Command 2:

composer update

Departure:

 Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for magento/product-community-edition 2.3.0 -> satisfiable by magento/product-community-edition[2.3.0].
    - magento/product-community-edition 2.3.0 requires elasticsearch/elasticsearch ~2.0|~5.1 -> satisfiable by elasticsearch/elasticsearch[2.0.x-dev, v2.0.0, v2.0.0-beta1, v2.0.0-beta2, v2.0.0-beta3, v2.0.0-beta4, v2.0.0-beta5, v2.0.1, v2.0.2, v2.0.3, v2.1.0, v2.1.1, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.2.0, v2.2.1, v2.2.2, v2.2.3, v2.3.0, v2.3.1, v2.3.2, v2.4.0, v5.1.0, v5.1.1, v5.1.2, v5.1.3, v5.2.0, v5.3.0, v5.3.1, v5.3.2, v5.4.0, v5.5.0] but these conflict with your requirements or minimum-stability.

if anyone has an idea help me … !!!

How to debug vage error lxml.etree.SerialisationError: unknown error -2029930774 in python

I am using a code inherited from python2 that has to work with python3. So far so good, most things work as they should. However, I receive the most vague error from a library called lxml.

In my opinion, this is a library that joins a binary program written in c.

The problem comes from this code:

 with etree.xmlfile(self.temp_file, encoding='utf-8') as xf:
        with xf.element('{http://www.opengis.net/citygml/2.0}CityModel', nsmap=nsmap):
            with open(input_gml, mode='rb') as f:
                context = etree.iterparse(f)
                for action, elem in context:
                    if action == 'end' and elem.tag == '{http://www.opengis.net/citygml/2.0}cityObjectMember':
                        # Duplicate feature and subfeatures
                        self.duplicateFeature(xf, elem)

                        # Clean up the original element and the node of its previous sibling
                        # (https://www.ibm.com/developerworks/xml/library/x-hiperfparse/)
                        elem.clear()
                        while elem.getprevious() is not None:
                            del elem.getparent()(0)

                del context

        xf.flush()

Process this xml file. And you get the following error:

    Traceback (most recent call last):
  File "/usr/local/bin/stetl", line 4, in 
    __import__('pkg_resources').run_script('Stetl==2.0', 'stetl')
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)(0).run_script(script_name, ns)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1446, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/EGG-INFO/scripts/stetl", line 43, in 
    main()
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/EGG-INFO/scripts/stetl", line 36, in main
    etl.run()
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/stetl/etl.py", line 157, in run
    chain.run()
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/stetl/chain.py", line 172, in run
    packet = self.first_comp.process(packet)
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/stetl/component.py", line 213, in process
    packet = self.next.process(packet)
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/stetl/component.py", line 213, in process
    packet = self.next.process(packet)
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/stetl/component.py", line 213, in process
    packet = self.next.process(packet)
  File "/usr/local/lib/python3.6/site-packages/Stetl-2.0-py3.6.egg/stetl/component.py", line 199, in process
    packet = self.invoke(packet)
  File "/app/bgt/etl/stetlbgt/subfeaturehandler.py", line 144, in invoke
    del context
  File "src/lxml/serializer.pxi", line 925, in lxml.etree.xmlfile.__exit__
  File "src/lxml/serializer.pxi", line 1263, in lxml.etree._IncrementalFileWriter._close
  File "src/lxml/serializer.pxi", line 1269, in lxml.etree._IncrementalFileWriter._handle_error
  File "src/lxml/serializer.pxi", line 199, in lxml.etree._raiseSerialisationError
lxml.etree.SerialisationError: unknown error -2029930774

Not sure what's going on here. It seems that something is wrong with some strange coded character.

How to debug this?

Solving equations: is it an error in the formula or an inaccuracy in numerical integration calculations?

According to the code / calculations below, it seems that you only need higher values ​​to MaxRecursion. Then only slow convergence messages are given ("NIntegrate :: slwcon").

a = 7; m = 5; n = 1;
Print("nEquation: z^", m, " - ", a, "*z^", n, " - 1 = 0n");
Print("Ordinary solution:");
NSolve((z^m - a z^n - 1))
sol = z /. NSolve((z^m - a z^n - 1))

(* During evaluation of In(88):= 
Equation: z^5 - 7*z^1 - 1 = 0


During evaluation of In(88):= Ordinary solution: *)

(* {{z -> -1.58871}, {z -> -0.142866}, {z -> 
   0.0355442 - 1.62852 I}, {z -> 0.0355442 + 1.62852 I}, {z -> 
   1.66049}}

{-1.58871, -0.142866, 0.0355442 - 1.62852 I, 
 0.0355442 + 1.62852 I, 1.66049} *)

Print("Solution with definite integration:"); S = 
Table(Exp(2 j Pi I/m) + 
   1/(2 Pi I) (Exp((2 j + 1) Pi I/m)*
       NIntegrate(
        Log(1 + a t^n/(1 + t^m) Exp((2 j + 1) Pi I n/m)), {t, 0, 
         Infinity}, MaxRecursion -> 200) - 
      Exp((2 j - 1) Pi I/m)*
       NIntegrate(
        Log(1 + a t^n/(1 + t^m) Exp((2 j - 1) Pi I n/m)), {t, 0, 
         Infinity}, MaxRecursion -> 200)), {j, 0, m - 1});

(*
During evaluation of In(93):= Solution with definite integration:

During evaluation of In(93):= NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

During evaluation of In(93):= NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. *)

S 

(* {1.66049 + 0. I, 
     0.0355442 + 1.62852 I, -1.58871 + 7.8*10^-8 I, -0.142866 - 
     7.8*10^-8 I, 0.0355442 - 1.62852 I} *)

Here we see that you have all the values ​​in your "ordinary solution" (using a certain tolerance):

Complement(S, sol, 
 SameTest -> (Abs(#1 - #2)/Norm({#1, #2}, Infinity) < 10^-6 &))

(* {} *)

Error updating or installing Linux Mint 19 packages

I have Linux Mint 19 Cinamon, I have the following problem.
When I'm going to update the package list sudo apt-get update or install another package, I miss 3 errors:

W: Cannot read /etc/apt/apt.conf.d/ – DirectoryExists (2: The
  file or directory does not exist)

W: Cannot read /etc/apt/sources.list.d/ – DirectoryExists (2: The
  file or directory does not exist)

W: Cannot read /etc/apt/sources.list – RealFileExists (2: The
  file or directory does not exist)

Could you tell me the solution to this problem?
Thank you.

javascript – Error registering in a php, mysql, ajax form

I am trying to make a registration form with php, mysql and ajax.

The error is that the user does not register me in the database, I give all the parameters with the corresponding variables however it does not register anything in the database

I am using PDO, it happens that sending the submit via the button skips error and I do not understand why, thanks in advance = D

I also use google recaptcha, I have deleted the secret key for security reasons.
I would appreciate any suggestions to improve the security of the form!

PHP code:

`

require '../../config.php'; // datos de la base de datos, database data

function isNull($data){
    if (strlen(trim($data)) < 1) {
        return true;
    } else {
        return false;
    }
}

function verifyPassword($pass1, $pass2) {
    if (strcmp($pass1, $pass2) !== 0) {
        return false;
    } else {
        return true;
    }
}

function isEmail($email) {
    if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
        return true;
    } else {
        return false;
    }
}

function registerUser($username, $email, $password, $btc_wallet, $user_type){
    global $con;
    $stmt = $con->prepare("INSERT INTO usuarios (username, email, password, btc_wallet, user_type) VALUES(:username, :email, :password, :btc_wallet, :user_type)");
    $stmt->bindParam(':username', $username, PDO::PARAM_STR);
    $stmt->bindParam(':email', $email, PDO::PARAM_STR);
    $stmt->bindParam(':password', $password, PDO::PARAM_STR);
    $stmt->bindParam(':btc_wallet', $btc_wallet, PDO::PARAM_STR);
    $stmt->bindParam(':user_type', $user_type, PDO::PARAM_STR);

    if ($stmt->execute()) {
        return $con->insert_id;
    } else {
        return 0;
    }
}

if (!empty($_POST)) {
    $giveBack = ();
    $user_type = 2;
    $secretKey = "google_secret_key";
    introducir el código aquí
    $username = $_POST('username');
    $btc_wallet = $_POST('wallet');
    $email = strtolower($_POST('email'));
    $clave = $_POST('password');
    $con_password = $_POST('con_password');
    $captcha = $_POST('grecaptcha');

    $search_user = $con->prepare("SELECT * FROM usuarios WHERE username='$username' LIMIT 1");
    $search_user->bindParam(':username', $username, PDO::PARAM_STR);
    $search_user->execute();

    //if (!captcha) $giveBack() = "Por favor, verifica el captcha";
    if (isNull($username) || isNull($btc_wallet) || isNull($email) || isNull($clave) || isNull($con_password)) $giveBack() = "Por favor, completa todos los campos.";
    if (!isEmail($email)) $giveBack() = "Email invalido";
    if (!verifyPassword($clave, $con_password)) $giveBack() = "Las contraseñas no coinciden";
    if ($search_user->rowCount() == 1) {
        # Usuario ya existe, proceder a enviar un mensaje
        $giveBack('usernameError') = "Este usuario ya existe";
        $giveBack('isLogin') = false;
    }

    if (count($giveBack) == 0) {
        $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$captcha");
        $arr = json_decode($response, TRUE);

        if ($arr('success')) {
            # Creamos el hash para el password
            $password = password_hash($clave, PASSWORD_DEFAULT);

            $register = registerUser($username, $email, $password, $btc_wallet, $user_type);

            if ($register > 0) {
                # Recuperando el id
                $user_id = $con->lastInsertId();
                $_SESSION('user_id') = (int) $user_id;
                $giveBack('redirect') = '';
                $giveBack('isLogin') = true;
            } else {
                $giveBack() = 'Error al registrar';
            }
        } else {
            $giveBack('errorToCheckCaptcha') = 'Error al comprobar el captcha';
        }
    }
    json_encode($giveBack);
} else {
    exit("Fuera de aquí");
}

`

Javascript code:
`

const url = 'http://localhost/faucet_st/api/user/signup/process-signup.php';

var username = document.getElementById("username").value;
var wallet = document.getElementById("btc_wallet").value;
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
var con_password = document.getElementById("con_password").value;

var data = {
    username: username,
    wallet: wallet,
    email: wallet,
    password: wallet,
    con_password: con_password,
    grecaptcha: grecaptcha.getResponse()
}

$.ajax({
    type: 'POST',
    url: url,
    data: data,
    dataType: 'json',
})
.done((res) => {
    console.log(res);
})
.fail((e) => {
    console.log(e);
})
.always(() => {});
});

`

I would be grateful if you could help me with this problem, I have tried to solve it all day, but I did not find a solution, I will continue looking for the solution, but I appreciate any help from you.

visual studio – LINK: fatal error LNK1104: cannot open file & # 39; glfw3.lib & # 39;

I am annoying to use OpenGL. However, every time I use Visual Studio and press the local Windows debugger, the above error appears (LINK: fatal error LNK1104: cannot open the file & # 39; glfw3.lib & # 39;).

My file structure is this

DOCUMENTS
 - Visual Studio 2019
   - Projects
     - OpenGlProject
       - sln and everything else
 - External Libs
   - GLFW
     - include
       - glfw3.h
     - lib-vc2019
       - glfw3.lib
   - GLEW
     - include
       - GL
         - all glew.h files
     - lib
       - Release
         - Win32
           -glew32.lib

I am including the .h files with

$(SolutionDir)/../../../ExternalLibs/GLEW/include
$(SolutionDir)/../../../ExternalLibs/GLFW/include

Lib files are included with

$(SolutionDir)/../../../ExternalLibs GLFW/lib-vc2019
$(SolutionDir)/../../../ExternalLibs/GLEW/lib/Release/Win32

Linker input files look like this

opengl32.lib
glew32.lib
glew32s.lib
glfw3.lib

I thought I was doing everything right, what's the problem? I have searched everywhere and nothing useful has appeared. Thanks for the help in advance, cheers!

centos7 – gparted – Error in libparted, unable to inform the core of the change

This is in CentOS Linux version 7.6.1810 (Core) with gparted.

I am trying to reformat LaCie rugged external drives connected via USB 3.0.

I still receive this error message when I use gparted to format and add a partition:

    Libparted Error
    Partition(s) 1 on /dev/sdf have been written, but we have been
    unable to inform the kernel of the change, probably because it/
    they are in use. As a result, the old partition(s) will remain in 
    use. You should reboot now before making further changes.

By default, I noticed through the GUI that the disk is mounted automatically, but I have disassembled it from the command line before continuing. It does nothing different, I receive this error message.

I tried to restart and try this again, and the same.

How could I find out what is causing the generation of this error message? He seems to think that the resource is being used by another process, but I don't know what they could be.

Lightning Network: an ELIFECYCLE error is executed when trying to install Filebazaar

Trying to install filebazaar on Ubuntu 18.04 and getting an error in the canvas module … someone familiar with this problem? I've been in all the node-canvas github problems (like this one where I left a comment), but none of the solutions work for me so far.

Here is the command I am executing:

$ sudo npm install -g filebazaar

And here is the error output:

$ sudo npm install -g canvas@1.6.13

> canvas@1.6.13 install /usr/local/lib/node_modules/canvas
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/canvas/build'
gyp ERR! System Linux 4.15.0-55-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/canvas
gyp ERR! node -v v12.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.6.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/chris/.npm/_logs/2019-09-17T20_39_13_514Z-debug.log

Any help is appreciated 🙂