MySQL - php script - hack

When I sent it .... I guess I see an error ...
In the app there is "key" ... and in php "SQLKEY".
Maybe this is the mistake?
Senior1954

if($_POST['key']==$SQLKEY){                                                           //validates the SQL key
    $query=urldecode($_POST['query']);
    $conn = new mysqli($DB_ADDRESS,$DB_USER,$DB_PASS,$DB_NAME);    //connect

Hello.
I use the php script from

does not work...
There is exactly the If as you sent me...
Question:
There is something like:
$key=$_POST["key"];
$query=$_POST["query"];
?
I do not understand that....
I only need a simple script where there is a key and a query.
I create a query in the app and send it to the server...
So far, I have created a php command only on the server in php ... for example:
$input=mysqli_query($conn, "INSERT INTO tblCisAlkohol (ID, Name) VALUES (NULL,'$Name')");
that's probably why they hated me...
Senior1954

hack me

Probably given you this link before:

Well, if you exactly follow the setup instructions then you also will be able to use it... you are not the first person using that solution...

Just use your working setup from here

together with my script

Taifun

Do some simple tests:

basic.php:

<?php 
echo "secret\r\n"; 
?>

curl -X POST https://..../basic.php

better.php:

<?php 
$SQLKEY="secret";

if ($_POST['key']==$SQLKEY) {
echo "key and SQLKEY are a match\r\n";
} else {
echo "key is incorrect\r\n";
}
 
?>

curl -d "key=secret" https://.../better.php

(note the \r\n are used to ensure a line return in my terminal)

Test result: key is incorrect

Really ?

:~$ curl -d "key=secret" https://.../better.php
key and SQLKEY are a match

image

Show YOUR php file for this, and the command you sent. (or blocks used)

obrázok

obrázok

obrázok

obrázok

Can you make a "better.php" with the code provided and just test that ?

Unfortunately, the result is: key is incorrect
obrázok

obrázok

Show all your blocks for making the connection....

obrázok

obrázok

Why all those blocks ?

You only need the blocks I showed above...

Just create a new test project!

Hello.
The test project works....
key and SQLKEY are a match

Senior1954

OK, good. Does this tell you something about your main php script and blocks ?

I tried to send both associative arrays and indexed arrays to the server....but it doesn't appear on the server side in php.... As if there was some problem with POST arrays...

I would simplify what you are doing, get that working, then build on it, step by step, testing as you go.

My test (better.php), for example, is a possible starting point...