function CreateSession($paramSet) { try { global $previousSession; $userInfo = new MgUserInformation(); $userInfo->SetMgUsernamePassword("Administrator", "admin"); $userInfo->SetLocale("en"); $site2 = new MgSite(); $site2->Open($userInfo); $sess = $site2->CreateSession(); $previousSession = $sess; $site2->Close(); return new Result($sess, "text/plain"); } catch (MgException $e) { return new Result(get_class($e), "text/plain"); } catch (SqliteException $s) { return new Result($s->GetExceptionMessage(), "text/plain"); } }
// License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <?php include 'utilityfunctions.php'; // Initialize a PHP session and register a variable to hold the // Server session id, then initialize the Web Extensions, // and connect to the Server, and create a session. MgInitializeWebTier($configFilePath); $site = new MgSite(); $site->Open(new MgUserInformation('Anonymous', '')); $sessionId = $site->CreateSession(); $webLayout = "Library://Samples/Sheboygan/Layouts/SheboyganPhp.WebLayout"; ?> <html> <head> <title>Viewer Sample Application</title> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <frameset rows="50,*" frameborder="NO" border="0" framespacing="0"> <frame src="title.html?AppName=AJAX" name="TitleFrame" scrolling="NO" noresize> <frame src="../mapviewerphp/ajaxviewer.php?SESSION=<?php echo $sessionId; ?>
// Success - switch to ServerManagement page. header('Location: servermanagement.php?' . strip_tags(SID)); exit; } else { $siteInfo = GetSiteServerSelection($serverSelectionID); if ($siteInfo != NULL) { // Close the existing site connection if ($site != NULL) { $site->Close(); } // Determine the selected site $site = new MgSite(); // Create a connection to the selected site $site->Open($userInfo, $siteInfo); // Create a session $adminSession = $site->CreateSession(); $userInfo->SetMgSessionId($adminSession); // Save the session variables. All requests will now be directed to // our selected server since it hosts the current session. SaveSessionVars(); header('Location: servermanagement.php?' . strip_tags(SID)); exit; } } } } catch (MgConnectionFailedException $e) { $errorMsg = $errConnectionFailed; } catch (MgException $e) { $errorMsg = $errAuthenticationFailed; } catch (Exception $e) { $errorMsg = $e->getMessage();