Example #1
0
<?php

include 'prefix.php';
?>
	
<xrecipe>
<?php 
include_once 'CAS-1.3.2/CAS.php';
include 'xmlGen.php';
session_start();
checkAndSetUserSession();
//här sköts in- och utloggnings proceduren
$xml = new xmlGen(siteToDisplay(), getFoodValues(), $_SESSION['user']);
$returnstring = $xml->getGeneratedXML();
print utf8_encode($returnstring);
//Loggar in och ut användare, när inloggad så sparas värdet i session-kakan 'user' annars sätts värdet null till kakan.
function checkAndSetUserSession()
{
    // store session data
    if (!isset($_SESSION['user'])) {
        $_SESSION['user'] = null;
    }
    if (isset($_REQUEST['login']) or isset($_REQUEST['logout'])) {
        // initialize phpCAS
        phpCAS::client(CAS_VERSION_2_0, 'login.kth.se', 443, '');
        //phpCAS::proxy(CAS_VERSION_2_0,'login.kth.se',443,'');
        phpCAS::setNoCasServerValidation();
        // If you want the redirect back from the login server to enter your application by some
        // specfic URL rather than just back to the current request URI, call setFixedCallbackURL.
        //phpCAS::setFixedCallbackURL('http://xml.csc.kth.se/~wiiala/DM2517/project/php/index.php');
        // force CAS authentication
Example #2
0
<?php

include 'prefix.php';
?>
	
<xrecipe>
<?php 
include_once 'CAS-1.3.2/CAS.php';
include 'xmlGen.php';
session_start();
checkAndSetUserSession();
//här sköts in- och utloggnings proceduren
$xml = new xmlGen(siteToDisplay(), getFoodValues(), $_SESSION['user'], changeCategorySubscriptionCheck());
//$xml->setCategoryChanges(changeCategorySubscriptionCheck());
$returnstring = $xml->getGeneratedXML();
print utf8_encode($returnstring);
//Loggar in och ut användare, när inloggad så sparas värdet i session-kakan 'user' annars sätts värdet null till kakan.
function checkAndSetUserSession()
{
    // store session data
    if (!isset($_SESSION['user'])) {
        $_SESSION['user'] = null;
    }
    if (isset($_REQUEST['login']) or isset($_REQUEST['logout'])) {
        // initialize phpCAS
        phpCAS::client(CAS_VERSION_2_0, 'login.kth.se', 443, '');
        //phpCAS::proxy(CAS_VERSION_2_0,'login.kth.se',443,'');
        phpCAS::setNoCasServerValidation();
        // If you want the redirect back from the login server to enter your application by some
        // specfic URL rather than just back to the current request URI, call setFixedCallbackURL.
        //phpCAS::setFixedCallbackURL('http://xml.csc.kth.se/~wiiala/DM2517/project/php/index.php');