-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.php
75 lines (66 loc) · 2.67 KB
/
account.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
<?php
session_start();
require("inc/config.php");
require("inc/user.class.php");
if($_SESSION['logged_in'] != true) {
header('location: login.php');
}
$r[0] = "danger";
$user = new User;
$user->getInfo($db, $_SESSION['username']);
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Chatbox</title>
<!-- Bootstrap core CSS -->
<link href="<?=$baseurl?>css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="<?=$baseurl?>css/cover.css" rel="stylesheet">
</head>
<body>
<div class="container d-flex h-100 p-3 mx-auto flex-column">
<main class="masthead mb-auto">
<div class="inner">
<div class="row outer-container">
<div class="col-md-4"></div>
<div class="col-md-4">
<?php if($_GET['update'] == "true") {
$r = $user->updateUser($db, $user->name, $_POST['email'], $_POST['password'], $_POST['newpassword'], $_POST['vnewpassword']);
$user->getInfo($db, $user->name);
?>
<div class="alert alert-<?=$r[0]?>"><?=$r[1]?></div>
<? } ?>
<form class="form-signin" action="account.php?update=true" method="POST">
<h1 class="h3 mb-3 font-weight-normal">My Account</h1>
<h6>Username</h6>
<label for="inputName" class="sr-only">Username</label>
<input type="text" id="inputName" class="form-control" placeholder="Username" disabled value="<?=$user->name?>">
<br />
<h6>Email</h6>
<label for="inputPassword" class="sr-only">Password</label>
<input type="email" name="email" id="inputEmail" class="form-control" value="<?=$user->email?>">
<br />
<h6>Password</h6>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Old Password">
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="newpassword" id="inputNewPassword" class="form-control" placeholder="New Password">
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="vnewpassword" id="inputVNewPassword" class="form-control" placeholder="Verify Password">
<br />
<button class="btn btn-lg btn-primary btn-block" type="submit">Update</button>
</form>
</div>
<div class="col-md-4"></div>
</div>
</div>
</main>
<? require("style/footer.php"); ?>
</div>
</body>
</html>