-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
78 lines (76 loc) · 3.66 KB
/
dashboard.php
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
<?php
session_start();
if (!isset($_SESSION['logged']) || $_SESSION['logged'] == false || !isset($_SESSION['user']) || $_SESSION['user'] == '') {
$_SESSION['error'] == 'Musisz być zalogowany aby uzyskać dostęp do tej strony';
header('Location: login.php');
exit();
} else {
require_once './db_config.php';
$sql = "SELECT * FROM klienci WHERE `login` = ?";
$stmt = $mysql->prepare($sql);
$stmt->bind_param('s', $_SESSION['user']);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
}
?>
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
require_once './metatags.html';
?>
</head>
<body>
<?php
require_once './nav.php';
?>
<main>
<div class="container register-container" style="padding-top: 150px;">
<h1>Moje dane</h1>
<form action="./update-userData-script.php" method="post" class="form">
<div class="box left">
<label for="name">Imię:</label>
<input type="text" name="first-name" id="name" placeholder="Jan" required value="<?php echo $row['imie'] ?>">
<label for="last-name">Nazwisko:</label>
<input type="text" name="last-name" id="last-name" placeholder="Kowalski" required value="<?php echo $row['nazwisko'] ?>">
<label for="email">Adres email:</label>
<input type="email" name="email" id="email" placeholder="[email protected]" required value="<?php echo $row['mail'] ?>">
<label for="adress">Adres:</label>
<input type="text" name="adress" id="adress" placeholder="Warszawska 52" required value="<?php echo $row['adres'] ?>">
<label for="postal-code">Kod pocztowy:</label>
<input type="text" name="postal-code" id="postal-code" placeholder="98-400" required pattern="[0-9]{2}-[0-9]{3}" value="<?php echo $row['kod_pocztowy'] ?>">
<label for="city">Miejscowość:</label>
<input type="text" name="city" id="city" placeholder="Wieruszów" required value="<?php echo $row['miejscowosc'] ?>">
<label for="tel">Numer telefonu:</label>
<input type="text" name="tel" id="tel" placeholder="123456789" required value="<?php echo $row['nr_telefonu'] ?>">
</div>
<div class="box right">
<label for="login">Login:</label>
<input type="text" name="login" id="login" placeholder="janek" required value="<?php echo $row['login'] ?>" readonly>
<label for="password">Hasło:</label>
<input type="password" name="password" id="password" placeholder="**********" required>
<label for="reapet-password">Powtórz hasło:</label>
<input type="password" name="reapet-password" id="reapet-password" placeholder="**********" required>
<label for="regulamin">Akceptuję regulamin</label>
<input type="submit" value="Zapisz zmiany" class="btn">
</div>
</form>
<?php
if (isset($_SESSION['error'])) {
echo '<div class="error">';
echo '<p>'.$_SESSION['error'].'</p>';
unset($_SESSION['error']);
echo '</div>';
}
?>
</div>
</main>
<?php
require_once './footer.php';
?>
</body>
</html>