r/PHPhelp • • Dec 15 '22

mysqli_connect security

I am wondering if this function is vulnerable to timing attacks and whether or not I need to add additional code for added security or does mysqli_connect work in a way that would prevent a timing attack? I assume it does but was wondering if someone can verify if this is a safe way to authenticate someones credentials?

$connection = mysqli_connect($servername, $username, $password, $database_name);

if (mysqli_connect_errno()) {

echo "Failed to connect" . mysqli_connect_error(); }

else {

echo "connected";

mysqli_close($connection); }

?>

2 Upvotes

2 comments sorted by

View all comments

1

u/CyberJack77 Dec 16 '22

Can you describe what you consider a "timing attack" and why you think (or suspect) connecting to a database might be vulnerable?