Example 5: Anonymous Login

Normally, when a user opens a flexible web layout in a web browser they will be prompted for a username and password. (You will not see this if you use the View In Browser button in Infrastructure Studio.)

To enable anonymous login, the examples include the file WebServerExtensionsInstallDir\www\fusion\FlexViewer.php:

<?php
  $fusionMGpath = './layers/MapGuide/php/';
  include $fusionMGpath . 'Common.php';
  $locale = GetDefaultLocale();
  $appdef = "";
  $template = "";
  $session = $siteConnection->GetSite()->CreateSession();
  GetRequestParameters();
  $viewerSrc = 'templates/mapguide/' . $template 
    . '/index.html';
  $viewerSrc = $viewerSrc . '?APPLICATIONDEFINITION=' 
    . $appdef;
  $viewerSrc = $viewerSrc . '&SESSION=' . $session;
  header( 'Location: ' . $viewerSrc ) ;
  function GetParameters($params)
  {
    global $appdef, $template;
    $appdef = $params['APPLICATIONDEFINITION'];
    $template = $params['TEMPLATE'];
  }
  function GetRequestParameters()
  {
    if($_SERVER['REQUEST_METHOD'] == "POST")
      GetParameters($_POST);
    else
      GetParameters($_GET);
  }
    	
?>

You can now log in anonymously (without supplying a username and password) through the URL:

http://
server
:
port
/mapserver2012/fusion/FlexViewer.php ?APPLICATIONDEFINITION=Library%3a%2f%2fSamples%2f FlexibleWebLayouts%2fExamples.ApplicationDefinition &TEMPLATE=examples
Note:

Since an anonymous user does not have rights to modify the repository, you will not be able to update the parcel owner in Example 4 if you log in this way.