-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.php
executable file
·89 lines (81 loc) · 2.5 KB
/
manage.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
<?php
require_once 'Component.php';
require_once 'AuthenticatedPage.php';
require_once 'CommonHeader.php';
require_once 'FriendReqs.php';
require_once 'UserActions.php';
require_once 'Authenticator.php';
require_once 'FrameworkRoot.php';
require_once 'ManageAccount.php';
require_once 'AccountForm.php';
require_once 'fbl_common.php';
class UpdateStatus extends Component {
function renderHTML() {
echo '<div class="update-status">';
if ($this->attr['success']) {
echo '<p>Your profile has been updated</p>';
} else {
echo "<p>Your profile couldn't be updated</p>";
}
echo '</div>';
}
}
class ManageAccountPage extends AuthenticatedPage {
private $udata;
function pageMain() {
$this->doAuth();
$this->udata = $this->queryUserData();
$this->renderHTML();
}
function queryUserData() {
db_connect($conn);
$stmt = oci_parse($conn,
'SELECT screen_name, status, location, visibility
FROM Member WHERE email_address = :email');
$email = $_SESSION['email'];
oci_bind_by_name($stmt, "email", $email);
oci_execute($stmt);
$results = oci_fetch_array($stmt, OCI_NUM | OCI_RETURN_LOBS);
if (!$results) {
echo "Fatal database error retrieving your profile!";
exit;
}
oci_close($conn);
return [
'inline' => 1,
'scr' => $results[0],
'stat' => $results[1],
'loc' => $results[2],
'vis' => $results[3],
'omit' => [
'email' => 1,
'pw' => 1,
'fname' => 1,
'dob' => 1,
'gender' => 1,
],
'verb' => 'Update my profile',
'action' => 'update_profile.php'
];
}
function renderHTML() {
if (isset($_GET['success'])) {
$notice = new UpdateStatus([], ['success' => $_GET['success']]);
} else {
$notice = new Component();
}
$this->children = [
new CommonHeader([], ["title" => "Manage account"]),
new FrameworkRoot([
'accMgmt' => new UserActions(),
'mgAcc' => new ManageAccount([$notice, new AccountForm([],
$this->udata)]),
'friendReqs' => new FriendReqs(),
])
];
parent::renderHTML();
}
}
$page = new ManageAccountPage();
$page->pageMain();
?>