-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit-profile.php
82 lines (77 loc) · 2.96 KB
/
edit-profile.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
79
80
81
82
<?php
if(!isset($_SESSION))
{
session_start();
}
include("./classes/edit-profile.class.php");
?>
<!DOCTYPE html>
<html lang="en">
<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">
<title>Rejestracja</title>
</head>
<body>
<?php
if(!isset($_SESSION['imie'], $_SESSION['nazwisko'], $_SESSION['pseudonim'], $_SESSION['data_dolaczenia'], $_SESSION['id']))
{
header("location: log-in.php");
}
?>
<form action="" method="post">
<h1>Edycja profilu</h1>
Imię: <input type='text' name='imie'><br>
Nazwisko: <input type='text' name='nazwisko'><br>
Psuedonim: <input type='text' name='pseudonim'><br>
Hasło: <input type='password' name='haslo'><br>
Powtórz hasło: <input type='password' name='powtorz_haslo'><br>
<input type='submit' value='Zapisz'>
<hr><a style="color: blue" href="index.php">Powrót</a>
<?php
if(isset($_POST['imie'], $_POST['nazwisko'], $_POST['pseudonim'], $_POST['haslo'], $_POST['powtorz_haslo']))
{
if(!empty($_POST['imie']) && !empty($_POST['nazwisko']) && !empty($_POST['pseudonim']) && !empty($_POST['haslo']) && !empty($_POST['powtorz_haslo']))
{
$edit = new EditProfile($_POST['imie'], $_POST['nazwisko'], $_POST['pseudonim'], $_POST['haslo'], $_POST['powtorz_haslo']);
$checkNickname = $edit->checkNickname();
$checkPassword = $edit->checkPassword();
if(!$checkNickname)
{
$_SESSION['error2'] = "Ten pseudonim jest już zajęty!";
}
if($checkNickname && $checkPassword)
{
$edit->changeValues();
}
}
else
{
$_SESSION['error1'] = "Wypełnij wszystkie pola tekstowe!";
}
}
if(isset($_SESSION['error']))
{
echo "<p style='color: red'>" . $_SESSION['error'] . "</p>";
unset($_SESSION['error']);
}
if(isset($_SESSION['error1']))
{
echo "<p style='color: red'>" . $_SESSION['error1'] . "</p>";
unset($_SESSION['error1']);
}
if(isset($_SESSION['error2']))
{
echo "<p style='color: red'>" . $_SESSION['error2'] . "</p>";
unset($_SESSION['error2']);
}
if(isset($_SESSION['error3']))
{
echo "<p style='color: red'>" . $_SESSION['error3'] . "</p>";
unset($_SESSION['error3']);
}
?>
</form>
</body>
</html>