Mysql (MariaDB) with PDO: Difference between revisions

From wikiluntti
Line 3: Line 3:
Some of my database stuff is shown.
Some of my database stuff is shown.


 
File structure is as follow:
<pre>
> www.public.com
>> index.php
>> php_folder
>>> class.php
> passwords
</pre>
The folder  www.public.com is connected to the internet, and passwords is not available from the internet.


== Establishing connection to the server ==
== Establishing connection to the server ==

Revision as of 11:00, 12 September 2023

Introduction

Some of my database stuff is shown.

File structure is as follow:

> www.public.com
>> index.php
>> php_folder 
>>> class.php
> passwords

The folder www.public.com is connected to the internet, and passwords is not available from the internet.

Establishing connection to the server

Store the password into a secure place, thus above the the www directory. Php can access that.

Log a user

SSL connection. Hash and salt. Php password hashing functions and mainly password_hash with password_verify.

Check the database if the username is exists. If it is, fetch the password hash and compare that against the user inputted hash.