• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • Examples
  • File List
  • File Members

docs/examples/example_html.php

Go to the documentation of this file.
00001 <?php
00002 
00003 //
00004 // phpCAS simple client with HTML output customization
00005 //
00006 
00007 // import phpCAS lib
00008 include_once('CAS.php');
00009 
00010 // initialize phpCAS
00011 phpCAS::client(CAS_VERSION_2_0,'sso-cas.univ-rennes1.fr',443,'');
00012 
00013 // no SSL validation for the CAS server
00014 phpCAS::setNoCasServerValidation();
00015 
00016 // customize HTML output
00017 phpCAS::setHTMLHeader('
00018 <html>
00019   <head>
00020     <title>__TITLE__</title>
00021   </head>
00022   <body>
00023   <h1>__TITLE__</h1>
00024 ');
00025 phpCAS::setHTMLFooter('
00026     <hr>
00027     <address>
00028       phpCAS __PHPCAS_VERSION__, 
00029       CAS __CAS_VERSION__ (__SERVER_BASE_URL__)
00030     </address>
00031   </body>
00032 </html>
00033 ');
00034 
00035 
00036 // force CAS authentication
00037 phpCAS::forceAuthentication();
00038 
00039 // at this step, the user has been authenticated by the CAS server
00040 // and the user's login name can be read with phpCAS::getUser().
00041 
00042 // for this test, simply print that the authentication was successfull
00043 ?>
00044 <html>
00045   <head>
00046     <title>phpCAS simple client with HTML output customization</title>
00047   </head>
00048   <body>
00049     <h1>Successfull Authentication!</h1>
00050     <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
00051     <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
00052   </body>
00053 </html>

Generated on Sat Mar 26 2011 12:11:03 for phpCAS by  doxygen 1.7.1