-
Notifications
You must be signed in to change notification settings - Fork 24
/
sample.php
49 lines (42 loc) · 1010 Bytes
/
sample.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
<?php
require_once(__DIR__.'/users/users.php');
/**
* Get User object or null if user is not logged in
*/
$current_user = StartupAPI::getUser();
/**
* Get User object or redirect to login page if user is not logged in
*/
#$current_user = StartupAPI::requireLogin();
// You can work with users, but it's recommended to work with accounts instead
if (!is_null($current_user)) {
// if user is logged in, get user's accounts
$accounts = Account::getUserAccounts($current_user);
// get current account user works with
$current_account = Account::getCurrentAccount($current_user);
}
?>
<html>
<head>
<title>Sample page</title>
<?php StartupAPI::head() ?>
</head>
<body>
<?php StartupAPI::power_strip() ?>
<?php
if (!is_null($current_user)) {
?>
<h1>Welcome, <?php echo $current_user->getName() ?>!</h1>
<p>You successfully logged in.</p>
<?php
}
else
{
?>
<h1>Welcome!</h1>
<p><a href="<?php echo UserConfig::$USERSROOTURL ?>/login.php">Log in</a> to enjoy the magic.</p>
<?php
}
?>
</body>
</html>