When I try to execute my SQLite3 statement in PHP, I get the following:
Warning: SQLite3::exec(): unrecognized token: "38360f81b43f97437a01ce7294ce41f9" in /path/to/register.php on line of error
So I go to look at the execution:
$user = $_POST['username'];
$pass = $_POST['password'];
$encrypted_pass = md5($pass);
class DB extends SQLite3{
function __construct(){
$this->open('/path/to/db/userpass.db')
}
}
$db = new DB();
$stmt = 'INSERT INTO userpass VALUES(' . $user . ', ' . $encrypted_pass . ');';
if($db->exec($stmt)){ //line of error
header('Location: http://192.168.1.147/registered.html');
} else {
die(1);
}
As you can see, $pass
is hashed and stored as $encrypted_pass
, which is used to be inserted into my table.
Missing semicolon on this line
$this->open('/path/to/db/userpass.db');
And also remove semicolon from here
$stmt = 'INSERT INTO userpass VALUES(' . '$user' . ', ' . '$encrypted_pass' . ')';
It's wrong
$stmt = 'INSERT INTO userpass VALUES(' . $user . ', ' . $encrypted_pass . ');';
and this is ok!
$stmt = "INSERT INTO userpass VALUES(' . $user . ', ' . $encrypted_pass . ');";
or
$stmt = 'INSERT INTO userpass VALUES(" . $user . ", " . $encrypted_pass . ");';