I have created a registration & login system, it is working properly. But, I only knew how to make a register & login system, I don't know how to make a link for every registered user
like :
example.com/marwan 
example.com/user/marwan 
Here is my Register PHP Code :
<?php
error_reporting(0);
session_start();
if( isset($_SESSION['user_id']) ){
 header("Location: /");
}
require 'includes/database.php';
$message = '';
if(!empty($_POST['email']) && !empty($_POST['password'])):
 
 // Enter the new user in the database
 $sql = "INSERT INTO users (full_name, email, password, phone, country) VALUES (:full_name, :email, :password, :phone, :country)";
 $stmt = $conn->prepare($sql);
 $stmt->bindParam(':full_name', $_POST['full_name']);
 $stmt->bindParam(':email', $_POST['email']);
 $stmt->bindParam(':password', password_hash($_POST['password'], PASSWORD_BCRYPT));
 $stmt->bindParam(':phone', $_POST['phone']);
 $stmt->bindParam(':country', $_POST['country']);
 if( $stmt->execute() ):
   header("Location: account-created.php");
 else:
  header("Location: failed.php");
 endif;
endif;
?>And my Login code is :
<?php
session_start();
if( isset($_SESSION['user_id']) ){
 header("Location: /tregolapp/home");
}
require 'includes/database.php';
if(!empty($_POST['email']) && !empty($_POST['password'])):
 
 $records = $conn->prepare('SELECT id,email,password FROM users WHERE email = :email');
 $records->bindParam(':email', $_POST['email']);
 $records->execute();
 $results = $records->fetch(PDO::FETCH_ASSOC);
 $message = '';
 if(count($results) > 0 && password_verify($_POST['password'], $results['password']) ){
  $_SESSION['user_id'] = $results['id'];
  header("Location: /tregolapp/index.php");
 } else {
  header("Location: /tregolapp/failed");
 }
endif;
?>Can someone help me please?
 
    