Exemple #1
0
<title>Demo of SDO APIs</title>
<body>

<?php 
/**
 * Load the contact from either database or XML
 */
$contact = null;
switch ($_GET['type']) {
    /**
     * Retrieve a contact from the database
     */
    case 'database':
        echo '<b>Retrieving from database</b><br/><br/>';
        require_once '../contacts/contacts_data.inc.php';
        $root = retrieve_contact('shifty');
        $contact = $root->contact[0];
        break;
        /**
         * Load the contact from XML
         */
    /**
     * Load the contact from XML
     */
    case 'XML':
        echo '<b>Retrieving from XML</b><br/><br/>';
        $xmldas = SDO_DAS_XML::create('contacts.xsd');
        $doc = $xmldas->loadFile('contacts.xml');
        $contact = $doc->getRootDataObject();
        break;
    default:
Exemple #2
0
<head>
    <title>MyContacts Edit</title>
</head>
<body BGCOLOR="#EFEFEF">

<?php 
require './contacts_config.inc.php';
require './contacts_data.inc.php';
if (!ctype_alnum($_POST['shortname'])) {
    echo '<p><b>Invalid shortname provided.</b></p>';
    echo '<form action="http://' . APP_ROOT . '/welcome.php" method="POST">';
    echo '<input type="submit" name="Return" value="Return"/>';
    echo '</form>';
    return;
}
$root = retrieve_contact($_POST['shortname']);
$contact = $root->contact[0];
if (!$contact) {
    echo '<p><b>Unknown shortname provided.</b></p>';
    echo '<form action="http://' . APP_ROOT . '/welcome.php" method="POST">';
    echo '<input type="submit" name="Return" value="Return"/>';
    echo '</form>';
    return;
}
$address = $contact->address[0];
echo '<form action="http://' . APP_ROOT . '/confirm.php" method="POST">';
/*
* ensure each browser tab has its own sdo serialized in the session data
* The time is sufficiently granular to use for this example, but not for 
* real code!
*/