I want to make every user registered on my site have their own profile page, where all users will be able to access it and see the information, such as name, email, date of birth, etc. I know 2 things:
1st: How do I get the information in the MySQL database table to be displayed? I already got only the email, but as I am beginner I do not know exactly how to show with the rest of the information
2nd: That is my biggest doubt. How do I create a page for each user? I have already seen that it does not have to be exactly "physical" but virtual. But I do not know how.
connect.inc (link to database)
<?php
$dbservername = 'localhost';
$dbusername = 'root';
$dbpassword= '';
$dbdatabase = 'usuarios';
$connect = mysqli_connect ($dbservername, $dbusername, $dbpassword, $dbdatabase);
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
login.php
<?php
include "connect.inc";
session_start ();
if (isset ($_POST['login'])) {
$email = mysqli_real_escape_string ($connect, $_POST['email']);
$senha = mysqli_real_escape_string ($connect, $_POST ['senha']);
$sel_user = "select id from cadastro where email = '$email' AND senha = '$senha'";
$run_user = mysqli_query ($connect, $sel_user);
$row = mysqli_fetch_array($run_user,MYSQLI_ASSOC);
$active = $row ['active'];
$check_user = mysqli_num_rows($run_user);
if ($check_user == 1 ) {
$_SESSION ['login_user'] = $email;
header ("location: capa.php");
}
else {
echo "Email or password is not correct, try again’";
}
}
?>
session.php
<?php
include ("connect.inc");
session_start ();
$user_check = $_SESSION ['login_user'];
$ses_sql = mysqli_query($connect,"select email from cadastro where email = '$user_check' ");
$row = mysqli_fetch_array($ses_sql,MYSQLI_ASSOC);
$login_session = $row['email'];
if(!isset($_SESSION['login_user'])){
header("location:login.html");
}
?>