Its weird, the below code used to work nicely. After running the same code, it runs but doesn't make any entry into the database. Username, password , database name , etc are all correct and PDO extension is present and enabled in php(as I checked in phpinfo).Even checked privileges in phpmyadmin, root on localhost got ALL PRIVILEGES.Code always returns false with no warning , notice or error. What possibly can be the reason??
Code for registration of new user:
$randomSalt = base64_encode(mcrypt_create_iv(PBKDF2_SALT_BYTE_SIZE, MCRYPT_DEV_URANDOM));
$saltedPass = base64_encode($this->pbkdf2(PBKDF2_HASH_ALGORITHM,
$password,
$randomSalt,
PBKDF2_ITERATIONS,
PBKDF2_HASH_BYTE_SIZE,
true
));
$id = $this->NewGuid();
$sql = $this->dbh->prepare("INSERT INTO `{$this->dbtable}` (`id`, `username`, `password`, `password_salt`, `created`) VALUES(:id, :username, :password, :passwordSalt, NOW())");
/* Bind the default values */
$sql->bindValue(":id", $id);
$sql->bindValue(":username", $mail);
$sql->bindValue(":password", $saltedPass);
$sql->bindValue(":passwordSalt", $randomSalt);
//$sql->bindValue(":created", UNIX_TIMESTAMP(now()));
if($sql->execute())
{
$_SESSION['logSyscuruser'] = $id;
setcookie("logSyslogin", hash("sha256", $this->secureKey.$id.$this->secureKey), time()+3600*99*500, "/");
return true;
}
else
{
return false;
}