-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathindex.php
More file actions
44 lines (37 loc) · 1.01 KB
/
index.php
File metadata and controls
44 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
session_start();
require 'database.php';
if (isset($_SESSION['user_id'])) {
$records = $conn->prepare('SELECT id, email, password FROM users WHERE id = :id');
$records->bindParam(':id', $_SESSION['user_id']);
$records->execute();
$results = $records->fetch(PDO::FETCH_ASSOC);
$user = null;
if (count($results) > 0) {
$user = $results;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome to you WebApp</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php require 'partials/header.php' ?>
<?php if(!empty($user)): ?>
<br> Welcome. <?= $user['email']; ?>
<br>You are Successfully Logged In
<a href="logout.php">
Logout
</a>
<?php else: ?>
<h1>Please Login or SignUp</h1>
<a href="login.php">Login</a> or
<a href="signup.php">SignUp</a>
<?php endif; ?>
</body>
</html>