example_html.php

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

Generated on Wed Mar 14 14:55:56 2007 for phpCAS by  doxygen 1.5.0