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