Mysql (MariaDB) with PDO: Difference between revisions
From wikiluntti
Line 20: | Line 20: | ||
Store the password into a secure place, thus above the the www directory. Php can access that. | Store the password into a secure place, thus above the the www directory. Php can access that. | ||
The file index.php includes the php file | |||
<syntaxhighlight lang="xml"> | |||
<?php | |||
include ('php/class.php'); | |||
$aa = $conn -> getData(); | |||
$bb = $conn -> getImages(); | |||
?> | |||
</syntaxhighlight> | |||
First, it connectsa nd then reads some data. No logging in in this example. | |||
== Log a user == | == Log a user == |
Revision as of 11:04, 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 >> public.com_passwords.txt
The folder www.public.com is connected to the internet, and passwords is not available from the internet. The password files contains the passwords and login credentials; this file is extremey simple. Only the password:
thisIsMySecretPassword
Establishing connection to the server
Store the password into a secure place, thus above the the www directory. Php can access that.
The file index.php includes the php file
<?php
include ('php/class.php');
$aa = $conn -> getData();
$bb = $conn -> getImages();
?>
First, it connectsa nd then reads some data. No logging in in this example.
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.