-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
102 lines (84 loc) · 3.56 KB
/
index.php
File metadata and controls
102 lines (84 loc) · 3.56 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
require_once 'boot.php';
$user = null;
init_db();
if (check_auth()) {
// Получим данные пользователя по сохранённому идентификатору
$stmt = pdo()->prepare("SELECT * FROM users WHERE id = :id");
$stmt->execute(['id' => $_SESSION['user_id']]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Enot.io QT</title>
<link rel="stylesheet" href="public/css/style.css">
<link href='https://css.gg/arrows-exchange-alt.css' rel='stylesheet'>
</head>
<body>
<div class="container">
<div class="row py-5">
<div class="col-lg-6">
<?php if ($user) { ?>
<h1>Добро пожаловать, <?=htmlspecialchars($user['username'])?>!</h1>
<div class="wrapper">
<header>Конвертер валют</header>
<form action="#">
<div class="amount">
<p>Ввведите сумму</p>
<input type="text" value="1">
</div>
<div class="drop-list">
<div class="from">
<p>Из</p>
<div class="select-box">
<img src="https://flagcdn.com/48x36/us.png" alt="flag">
<select> <!-- Options tag are inserted from JavaScript --> </select>
</div>
</div>
<div class="icon">
<i class="gg-arrows-exchange-alt"></i>
</div>
<div class="to">
<p>В</p>
<div class="select-box">
<img src="https://flagcdn.com/48x36/ru.png" alt="flag">
<select> <!-- Options tag are inserted from JavaScript --> </select>
</div>
</div>
</div>
<div class="exchange-rate">Загружаем курс валют...</div>
<button>Получить курс</button>
</form>
</div>
<form class="mt-5" method="post" action="controllers/logout.php">
<button type="submit" class="btn btn-primary">Выйти</button>
</form>
<?php } else { ?>
<h1 class="mb-5">Регистрация</h1>
<?php flash(); ?>
<form method="post" action="controllers/register.php">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="d-flex justify-content-between">
<button type="submit" class="btn btn-primary">Зарегистрироваться</button>
<a class="btn btn-outline-primary" href="views/login.php">Уже зарегистрированы? Войти</a>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
<script src="public/js/script.js"></script>
</body>
</html>