Login   Register  
PHP Classes
elePHPant
Icontem

File: page2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michael Rubinsky  >  IMSP Client Classes  >  page2.php  >  Download  
File: page2.php
Role: ???
Content type: text/plain
Description: Demonstration File
Class: IMSP Client Classes
Deprecated classes for dealing with IMSP servers.
Author: By
Last change:
Date: 12 years ago
Size: 1,364 bytes
 

Contents

Class file image Download
<?php
session_start();
if (!$_SESSION["loggedin"]) {
	session_destroy();
	header("Location: http://www.yourdomain.com/imspClient/login.html");
}
require("cIMSPABook.php");

//remember, for our example the addressbook name is the same as the username
$abookname = $_SESSION["username"];
?>

<html>
<head>
	<title>Untitled</title>
</head>
<body>
<TABLE Border=1>
<?php
	//Recreate a new IMSPAddressBook object
	$imsp = new IMSPAddressBook();
	
	//Login again with the user/pass stored in the session variables
	//Note: This is a simple example and contains no error handling for failure.
	$imsp->login($_SESSION["username"],$_SESSION["pass"]);
	
	/* Recieve an associative array of the requested entry.
	 * Note that the name of the entry is passes in the query string so we get to it
	 * with $_REQUEST["entry"] since it is recommended to keep register_globals = Off
	 */
	
	$name = $imsp->getAddressBookEntry($abookname,$_REQUEST["entry"]);
	
	//Logout of the IMSP server...NOT the PHP session.
	$imsp->logout();
	
	//Build the table.
	while(list($key,$value) = each($name)) {
		echo("<TR><TD>$key</TD><TD>$value</TD></TR>\n");
	}

	//Kill the PHP session since we are done. Note that this would normally be provided as a "logout" button 
	//in out final application.
	session_destroy();
?>
</TABLE>
</body>
</html>