Go to the documentation of this file.00001 <?php
00002
00003
00004
00005 include_once('config.php');
00006
00007 include_once($phpcas_path.'/CAS.php');
00008
00009
00010 phpCAS::setDebug();
00011
00012
00013 phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
00014
00015
00016
00017
00018
00019
00020
00021
00022 phpCAS::setNoCasServerValidation();
00023
00024
00025 phpCAS::forceAuthentication();
00026
00027 if ($_SERVER['REQUEST_METHOD'] != 'POST') {
00028 header('HTTP/1.1 400 Bad Request');
00029 print "<h1>I only respond to POST requests. This is a ".$_SERVER['REQUEST_METHOD']." request.</h1>";
00030 exit;
00031 }
00032 if (empty($_POST['favorite_color'])) {
00033 header('HTTP/1.1 400 Bad Request');
00034 print '<h1>You must post a <strong>favorite_color</strong>.</h1>';
00035 exit;
00036 }
00037
00038 print '<h1>I am a service that responds to POST requests.</h1>';
00039
00040
00041
00042 include 'script_info.php';
00043
00044
00045 echo '<p>The user\'s login is <b>'.phpCAS::getUser().'</b>.</p>';
00046
00047 print '<h1>Your favorite color is '.htmlentities($_POST['favorite_color']).'</h1>';
00048
00049
00050 if (!isset($_SESSION['n']))
00051 $_SESSION['n'] = 0;
00052 echo '<p>request #'.(++$_SESSION['n']).'</p>';
00053