This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_profile.php
92 lines (85 loc) · 3.25 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
83
84
85
86
87
88
89
90
91
92
<?php
require_once(dirname(__FILE__) . "/includes/common/only_allow_login.php");
require_once(dirname(__FILE__) . "/includes/common/defaults.php");
$PAGE["title"] .= " : Edit Profile for" . $_SESSION["username"];
$PAGE["styles"][] = "card_form.css";
$PAGE['includeCSRF'] = true;
$PAGE["scripts"] = array_merge($PAGE["scripts"], array("edit_profile.js", "search.js", "ajax.js"));
require_once(dirname(__FILE__) . "/templates/common/header.php");
require_once(dirname(__FILE__) . "/includes/common/choose_navbar.php");
require_once(dirname(__FILE__) . "/classes/User.php");
?>
<?php
$user = new User;
$user = $user->load($_SESSION['userId']);
?>
<div class="container">
<div class="grid grid-long grid-small-margins shadow-1">
<form class="cardForm split" action="actions/user/edit_profile.php" id="editProfile" method="post">
<?php insertCsrfToken(); ?>
<div class="formHeader">
<h3 class="formTitle">Edit User Details</h3>
</div>
<div class="formBody">
<div class="errors"></div>
<div class="formField">
<span> User name: </span><input type="text" name="username" title="User name:" id="username" value="<?php echo $user->username; ?>" placeholder="Username" required>
</div>
<div class="formField">
<span> Email: </span><input type="email" name="email" id="email" value="<?php echo $user->email; ?>" placeholder="Email" required>
</div>
</div>
<footer class="formFooter">
<input type="submit" value="Submit">
</footer>
</form>
</div>
<div class="grid grid-long grid-small-margins shadow-1">
<form class="cardForm split" id="changePassword" action="actions/user/edit_profile.php" method="post">
<?php insertCsrfToken(); ?>
<div class="formHeader">
<h3 class="formTitle">Change Password</h3>
</div>
<div class="formBody">
<div class="errors"></div>
<div class="formField">
<span>Password: </span><input type="password" name="pwd1" placeholder="Password" required>
</div>
<div class="formField">
<span>Rewrite Password: </span><input type="password" name="pwd2" placeholder="Repeat your password please!" required>
</div>
</div>
<footer class="formFooter">
<input type="submit" value="Submit">
</footer>
</form>
</div>
<hr/>
<?php
$filename = "public/images/profile/" . $_SESSION["userId"] . ".jpg";
if (file_exists($filename)) :?>
<div class="editProfileBackgroundParent">
<img alt="profile picture" class="editProfileBackground" src="<?= $filename ?>"/>
</div>
<?php endif ?>
<div class="grid grid-long grid-small-margins shadow-1">
<form class="cardForm split" id="changePicture" action="actions/user/edit_profile.php" method="post" enctype="multipart/form-data">
<?php insertCsrfToken(); ?>
<div class="formHeader">
<h3 class="formTitle">Edit Profile Picture</h3>
</div>
<div class="formBody">
<div class="errors"></div>
<div class="formField">
<span>New Picture: </span><input type="file" name="profile" required>
</div>
</div>
<footer class="formFooter">
<input type="submit" value="Submit">
</footer>
</form>
</div>
<hr/>
<a class="strong center largeFont" id="deleteUserAccount" ><i class="material-icons">delete</i> Delete Account</a>
</div>
<?php require_once(dirname(__FILE__) . "/templates/common/footer.php"); ?>