PageRenderTime 136ms CodeModel.GetById 60ms app.highlight 7ms RepoModel.GetById 64ms app.codeStats 0ms

/users/sample.php

http://showslow.googlecode.com/
PHP | 39 lines | 28 code | 6 blank | 5 comment | 2 complexity | 082692d586a7a5ae67050a7fecb31571 MD5 | raw file
 1<?php
 2require_once(dirname(__FILE__).'/users/users.php');
 3
 4// get user if logged in or require user to login
 5$user = User::get();
 6#$user = User::require_login();
 7
 8// You can work with users, but it's recommended to work with accounts instead
 9if (!is_null($user)) {
10	// if user is logged in, get user's accounts
11	$accounts = Account::getUserAccounts($user);
12
13	// get current account user works with
14	$current_account = Account::getCurrentAccount($user);
15}
16?>
17<html>
18<head><title>UserBase sample page</title></head>
19<body>
20<?php
21
22if (!is_null($user)) {
23?>
24<h1>Welcome, <?php echo $user->getName() ?>!</h1>
25
26<p>You successfully logged into UserBase.</p>
27<?php
28}
29else
30{
31?>
32<h1>Welcome!</h1>
33
34<p><a href="<?php echo UserConfig::$USERSROOTURL ?>/login.php">Log in</a> to enjoy the magic of UserBase.</p>
35<?php
36}
37?> 
38</body>
39</html>