<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
$session = Yaf_Session::getInstance();
$session->start();
// reading with array syntax calls offsetGet()
$userId = $session["user_id"];
if ($userId === null) {
return $this->redirect("/account/login");
}
echo "logged in as user #", $userId;
}
}
?>