LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file testarea.php

Documentation is available at testarea.php

  1. <?php
  2. /**
  3.  * Test for the LiveUser class
  4.  * ===============================
  5.  *
  6.  * This example sets up an authorization system using the LiveUser
  7.  * class. You don't have to use this to use the LiveUser class(es), but
  8.  * this way you don't need to take care of the login-process, storing
  9.  * the user object in a session and more...
  10.  *
  11.  * This example is intended to be used with the DB_Medium Perm driver.
  12.  *
  13.  * @version $Id: testarea.php 175041 2004-12-18 21:59:05Z lsmith $
  14.  ***/
  15.  
  16. // Include configuration.
  17. require_once 'conf.php';
  18.  
  19. if (!$LU{
  20.     die('An unknown error occurred');
  21. }
  22.  
  23. ?>
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  25. <html>
  26. <head>
  27.     <title>Example Testarea</title>
  28.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  29.     <style type="text/css">
  30.     <!--
  31.     table {
  32.         background-color: #CCCCCC;
  33.         border-color: 1px solid #000;
  34.     }
  35.     body {
  36.         font-family: Verdana, Arial, Helvetica, sans-serif;
  37.         font-size: 12px;
  38.         color: #000000;
  39.         background-color: #FFFFFF
  40.     }
  41.  
  42.     .center {
  43.         text-align: center;
  44.     }
  45.     .center table {
  46.         margin: auto;
  47.     }
  48.     -->
  49.     </style>
  50. </head>
  51.  
  52. <body>
  53.     <h1>Testarea</h1>
  54.     <p>&nbsp;</p>
  55. <?php
  56. if (!$LU->isLoggedIn()) {
  57.     $target 'testarea.php';
  58.     include_once 'loginscreen.php';
  59.     exit();
  60. else {
  61.     if (!$LU->checkRight(READ_TESTS&& !$LU->checkRight(WRITE_TESTS)) {
  62. ?>
  63.         <p>Sorry, but you don't have any rights in this section</p>
  64. <?php
  65.     else {
  66.         if ($LU->checkRight(READ_TESTS)) {
  67. ?>
  68.            <p>Wow, you've the right to <b>read</b> the latest posting in this list!<br>
  69.            OK, let's search the database for the last entry ...</p>
  70.            <p>User: <b><?php echo $LU->getProperty('handle')?></b><br>LastLogin: <b><?php echo strftime('%Y-%m-%d %H:%M'$LU->getProperty('lastLogin'))?></b><br>
  71.            <pre>Hi!<br>I'm just testing whether this really cool LiveUser program works :-)<br>
  72.            Hmm, think it runs perfect!</pre>
  73. <?php
  74.         }
  75.     }
  76. }
  77. ?>
  78.     <p>&nbsp;</p>
  79.     <p>
  80. <?php
  81.   // let's see if the user is allowed to post something
  82.   if ($LU->checkRight(WRITE_TESTS)) {
  83.      $disabled =  ''# end the textarea tag
  84.      $text 'Type something.';
  85.   else {
  86.      $disabled 'disabled="disabled"'# disable the textarea tag
  87.      $text 'No, you don\'t have the right to post something in this list.';
  88.   }
  89.  
  90. ?>
  91.         <textarea name="textfield" cols="80" rows="10" <?php echo $disabled ?>>
  92.             <?php echo $text?>
  93.         </textarea>
  94.     </p>
  95.     <p>&nbsp;</p>
  96.     <p class="center"><a href="testarea.php?logout=1">Logout</a></p>
  97. </body>
  98. </html>

Documentation generated on Mon, 11 Mar 2019 15:39:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.