예제 #1
0
    <body>
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container"><!-- Collapsable nav bar -->
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <a href="index.php"class="brand">Instabook</a>
                    
      <?  
          session_start();
          //var_dump($_SESSION);
      ?>
                     <?
  require_once './sdk.class.php';
  //session_start();
$domain = 'books-aalr';
$sdb = new AmazonSDB();
$author = $_SESSION['email'];
$result=$sdb->get_attributes($domain, $author,array('author','object'));

//var_dump($result->body);
  ?>
      <div class="nav-collapse">
   
        <ul class="nav pull-right">
            <li>
                <?if(isset($_SESSION['auth'])){?>
                <p class="welcome">Welcome<strong> <?echo $_SESSION['uname'];?></strong></p>
                <?}
                else{
                ?>
                <a href="signup.html">Sign Up</a>
예제 #2
0
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'tarzan.class.php';
require_once 'book.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query for each file
$res1 = $sdb->select("select * from " . CL_ITEM_DOMAIN);
if ($res1->isOK()) {
    foreach ($res1->body->SelectResult->Item as $item) {
        $itemName = $item->Name;
        // Get list of attributes
        $attrs = array_keys(getItemAttributes($item));
        // Delete the attributes
        $res2 = $sdb->delete_attributes(CL_ITEM_DOMAIN, $itemName, $attrs);
        if ($res2->isOK()) {
            print "Deleted item {$itemName}\n";
        } else {
            $error = $res2->body->Errors->Error->Message;
            print "Could not delete item: {$error}\n";
        }
예제 #3
0
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'sdk.class.php';
require_once 'include/book.inc.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
foreach (array(BOOK_FILE_DOMAIN, BOOK_FEED_DOMAIN, BOOK_FEED_ITEM_DOMAIN) as $domain) {
    $res = $sdb->domain_metadata($domain);
    // Check result
    if ($res->isOK()) {
        $metadata = $res->body->DomainMetadataResult;
        $itemCount = (int) $metadata->ItemCount;
        $attributeNameCount = (int) $metadata->AttributeNameCount;
        $attributeValueCount = (int) $metadata->AttributeValueCount;
        $itemNamesSize = (int) $metadata->ItemNamesSizeBytes;
        $attributeNamesSize = (int) $metadata->AttributeNamesSizeBytes;
        $attributeValuesSize = (int) $metadata->AttributeValuesSizeBytes;
        printf($domain . ":\n" . "\tItem Count:      " . number_format($itemCount) . "\n" . "\tAttrs:           " . number_format($attributeNameCount) . "\n" . "\tValues:          " . number_format($attributeValueCount) . "\n" . "\tName Size:       " . number_format($itemNamesSize) . "\n" . "\tAttr Name Size:  " . number_format($attributeNamesSize) . "\n" . "\tAttr Value Size: " . number_format($attributeValuesSize) . "\n" . "\n");
    }
}
exit(0);
예제 #4
0
<?php

require_once './sdk.class.php';
error_reporting(-1);
ini_set('display_errors', true);
header("Content-type: text/html; charset=utf-8");
$sdb = new AmazonSDB();
$domain = 'authors';
//$authors_domain = $sdb->create_domain($domain);
/*$add_authors = $sdb->batch_put_attributes($domain, array(
		'*****@*****.**' => array(
				'name' => 'Behrouz A Forouzan',
				'password' => '1a1dc91c907325c69271ddf0c944bc72', //MD5 of 'pass'
				'type' => '1',
			),
		'*****@*****.**' => array(
				'name' => 'Dennis M. Ritchie',
				'password' => '1a1dc91c907325c69271ddf0c944bc72', //MD5 of 'pass'
				'type' => '1',
		),
		));*/
$sdb->delete_attributes($domain, "author_2", array(array('Name' => 'name'), array('Name' => 'password')));
$query = "SELECT name,password FROM `{$domain}`";
$results = $sdb->select($query);
$authors = $results->body->Item();
foreach ($authors as $author) {
    echo $author->Attribute[0]->Value;
    echo "</br>";
}
예제 #5
0
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Insert an entry for every PHP file in the current directory
$dir = opendir(".");
while (($file = readdir($dir)) !== false) {
    if (preg_match("/^[a-zA-Z0-9_-]*\\.php\$/", $file)) {
        $data = file_get_contents($file);
        $hash = md5($data);
        $size = filesize($file);
        $attrs = array('Name' => $file, 'Hash' => $hash, 'Size' => sprintf("%08s", $size));
        $res = $sdb->put_attributes(BOOK_FILE_DOMAIN, $file, $attrs, true);
        if ($res->isOK()) {
            print "Inserted item {$file}\n";
        } else {
            $error = $res->body->Errors->Error->Message;
            print "Could not insert item: {$error}\n";
        }
예제 #6
0
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Set the query
$query = "select * from " . BOOK_AWS_USAGE_DOMAIN;
if ($argc > 1) {
    $query .= " where ";
    for ($i = 1; $i < $argc; $i++) {
        $query .= ' ' . $argv[$i] . ' ';
    }
}
print "Final query: {$query}\n";
// Create the SimpleDB access object
$sdb = new AmazonSDB();
$recordCount = 0;
$totalUsage = 0;
// Query the SimpleDB domain
$next = null;
do {
    $attrs = $next == null ? null : array('NextToken' => $next);
    $res = $sdb->select($query, $attrs);
    $next = (string) $res->body->SelectResult->NextToken;
    // Check result
    if (!$res->isOK()) {
        exit("Select operation failed\n");
    }
    // Display results
    foreach ($res->body->SelectResult->Item as $item) {
        $recordCount++;
	TO RUN:
	* Run this file on your web server by loading it in your browser. It will generate HTML output.
*/
/*%******************************************************************************************%*/
// SETUP
// Enable full-blown error reporting. http://twitter.com/rasmus/status/7448448829
error_reporting(-1);
// Set HTML headers
header("Content-type: text/html; charset=utf-8");
// Include the SDK
require_once '../sdk.class.php';
/*%******************************************************************************************%*/
// ADD DATA TO SIMPLEDB
// Instantiate the AmazonSDB class
$sdb = new AmazonSDB();
// Store the name of the domain
$domain = 'php-sdk-getting-started';
// Create the domain
$new_domain = $sdb->create_domain($domain);
// Was the domain created successfully?
if ($new_domain->isOK()) {
    // Add a batch of item-key-values to your domain
    $add_attributes = $sdb->batch_put_attributes($domain, array('Item_01' => array('Category' => 'Clothes', 'Subcategory' => 'Sweater', 'Name' => 'Cathair Sweater', 'Color' => 'Siamese', 'Size' => array('Small', 'Medium', 'Large')), 'Item_02' => array('Category' => 'Clothes', 'Subcategory' => 'Pants', 'Name' => 'Designer Jeans', 'Color' => 'Paisley Acid Wash', 'Size' => array('30x32', '32x32', '32x34')), 'Item_03' => array('Category' => 'Clothes', 'Subcategory' => 'Pants', 'Name' => 'Sweatpants', 'Color' => array('Blue', 'Yellow', 'Pink'), 'Size' => 'Large', 'Year' => array('2006', '2007')), 'Item_04' => array('Category' => 'Car Parts', 'Subcategory' => 'Engine', 'Name' => 'Turbos', 'Make' => 'Audi', 'Model' => 'S4', 'Year' => array('2000', '2001', '2002')), 'Item_05' => array('Category' => 'Car Parts', 'Subcategory' => 'Emissions', 'Name' => 'O2 Sensor', 'Make' => 'Audi', 'Model' => 'S4', 'Year' => array('2000', '2001', '2002'))));
    // Were the attributes added successfully?
    if ($add_attributes->isOK()) {
        // Add an additional size to Item_01
        $append_attributes = $sdb->put_attributes($domain, 'Item_01', array('Size' => 'Extra Large'));
        // Were the new attributes appended successfully?
        if ($append_attributes->isOK()) {
            // Use a SELECT expression to query the data.
예제 #8
0
 *	List SimpleDB domains.
 *
 * Copyright 2009-2010 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'sdk.class.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// List the SimpleDB domains
$res = $sdb->list_domains();
// Check result
if (!$res->isOK()) {
    exit("List domain operation failed\n");
}
foreach ($res->body->ListDomainsResult->DomainName as $domainName) {
    print $domainName . "\n";
}
exit(0);
예제 #9
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
define('AWS_ACCOUNT_ID', '457964863276');
$sdb = new AmazonSDB();
# $sdb->set_region($sdb::REGION_EU_W1);
$sdb->delete_domain('accounts');
예제 #10
0
<?php

require_once './sdk.class.php';
error_reporting(-1);
ini_set('display_errors', true);
header("Content-type: text/html; charset=utf-8");
$sdb = new AmazonSDB();
$domain = 'authors';
$email = $_POST["email"];
$pass = $_POST["pass"];
$response = $sdb->get_attributes($domain, $email, array('name', 'password', 'type'));
if ($response->body->GetAttributesResult->Attribute) {
    $uname = $response->body->GetAttributesResult->Attribute[0]->Value;
    $utype = $response->body->GetAttributesResult->Attribute[1]->Value;
    var_dump($utype);
    if (md5($pass) == $response->body->GetAttributesResult->Attribute[2]->Value) {
        session_destroy();
        session_start();
        $_SESSION['auth'] = 1;
        $_SESSION['uname'] = (string) $uname;
        $_SESSION['utype'] = (string) $utype;
        $_SESSION['email'] = $email;
        if ((string) $utype == "2") {
            header("Location:index.php");
        }
        if ((string) $utype == "1") {
            header("Location:author.php");
        } else {
            header("Location:admin.php");
        }
    } else {
예제 #11
0
<?php

require_once './sdk.class.php';
$s3 = new AmazonS3();
$bucket = 'book-bucket-' . strtolower($s3->key);
$response1 = $s3->create_object($bucket, $_FILES['uploadedfile']['name'], array('fileUpload' => $_FILES['uploadedfile']['tmp_name'], 'acl' => AmazonS3::ACL_PUBLIC, 'meta' => array('title' => $_POST['title'])));
session_start();
$author = $_SESSION['email'];
$book = $_POST['title'];
$key = $author . '/' . $book;
$domain = 'books-aalr';
$sdb = new AmazonSDB();
$response2 = $sdb->put_attributes($domain, $key, array('author' => $author, 'title' => $book));
//var_dump($_FILES);
//var_dump($response);
//var_dump($response->body)
if ($response1->isOK() && $response2->isOK()) {
    session_start();
    $_SESSION['upmsg'] = "Upload successful";
    header('Location:author.php');
} else {
    session_start();
    $_SESSION['upemsg'] = "Upload failed";
    header('Location:author.php');
}
예제 #12
0
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Check arguments
if ($argc < 3) {
    exit("Usage: " . $argv[0] . " \"message\" VOLUMEID...\n");
}
// Get message
$message = $argv[1];
// Create access objects
$sdb = new AmazonSDB();
$ec2 = new AmazonEC2();
// Process each volume
for ($i = 2; $i < $argc; $i++) {
    $volId = $argv[$i];
    // Create snapshot
    $res1 = $ec2->create_snapshot($volId, "{$volId}: {$message}");
    if ($res1->isOK()) {
        $snapId = $res1->body->snapshotId;
        $startTime = $res1->body->startTime;
        $key = $volId . '_' . $startTime;
        $attrs = array('VolId' => $volId, 'Message' => $message, 'StartTime' => $startTime);
        $res2 = $sdb->put_attributes(BOOK_SNAP_LOG_DOMAIN, $key, $attrs, true);
    }
}
exit(0);
예제 #13
0
 public function testReturnsSDBResponse()
 {
     $this->assertEquals('ORM\\SDB\\SDBResponse', get_class($this->object->list_domains()));
 }
예제 #14
0
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/cloudfunctions.inc.php';
// Check arguments
if ($argc < 3) {
    exit("Usage: " . $argv[0] . " CITY STATE\n");
}
// Get city and state
$city = $argv[1];
$state = $argv[2];
// Form key
$key = $state . '_' . $city;
// Form attributes
$attrs = array('City' => $city, 'State' => $state);
// Create access object
$sdb = new AmazonSDB();
// Insert item
$res = $sdb->put_attributes(CL_CITY_DOMAIN, $key, $attrs, true);
if ($res->isOK()) {
    print "Added city {$city} in {$state}\n";
} else {
    $error = $res->body->Errors->Error->Message;
    print "Could not add city: {$error}\n";
}
예제 #15
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
define('AWS_ACCOUNT_ID', '457964863276');
$sdb = new AmazonSDB();
# $sdb->set_region($sdb::REGION_EU_W1);
$accounts = $sdb->create_domain('accounts');
$accounts->isOK() or die('could not create domain accounts');
$response = $sdb->get_attributes('accounts', '*****@*****.**');
pr($response->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
define('AWS_ACCOUNT_ID', '457964863276');
# for testing the conditional put
$timeout = isset($_GET['timeout']) ? (int) $_GET['timeout'] : 0;
$sdb = new AmazonSDB();
# $sdb->set_region($sdb::REGION_EU_W1);
$accounts = $sdb->create_domain('accounts');
$accounts->isOK() or die('could not create domain accounts');
# we have to be a bit persistent; even though it
# is unlikely someone else might have incremented
# during our operation
do {
    $response = $sdb->get_attributes('accounts', '*****@*****.**', 'PDFs');
    $PDFs = (int) $response->body->Value(0);
    # convenience measure for testing
    sleep($timeout);
    $account = array('PDFs' => sprintf('%05d', $PDFs + 1));
    $response = $sdb->put_attributes('accounts', '*****@*****.**', $account, true, array('Expected.Name' => 'PDFs', 'Expected.Value' => sprintf('%05d', $PDFs)));
} while ($response->isOK() === FALSE);
# to read the value we have to force a consistent read
$response = $sdb->get_attributes('accounts', '*****@*****.**', 'PDFs', array('ConsistentRead' => 'true'));
pr((int) $response->body->Value(0));
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
예제 #17
0
<?php

require_once './sdk.class.php';
error_reporting(-1);
ini_set('display_errors', true);
header("Content-type: text/html; charset=utf-8");
$sdb = new AmazonSDB();
$domain = 'authors';
$uname = $_POST["name"];
$email = $_POST["email"];
$pass = $_POST["pass"];
$type = $_POST["type"] == "Reader" ? "2" : "1";
//reader->2 author->1
if ($uname && $email && $pass) {
    $response = $sdb->get_attributes($domain, $email);
    if ($response->body->GetAttributesResult->Attribute) {
        echo "already registered";
    } else {
        $response = $sdb->put_attributes($domain, $email, array('name' => $uname, 'password' => md5($pass), 'type' => $type));
        if ($response->isOK()) {
            session_start();
            $_SESSION['ucmsg'] = "User created.";
        } else {
            session_start();
            $_SESSION['uemsg'] = "User creation failed.";
        }
        header('Location:admin.php');
    }
}
예제 #18
0
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query for each file
$res1 = $sdb->select("select Name from " . BOOK_FILE_DOMAIN);
if ($res1->isOK()) {
    foreach ($res1->body->SelectResult->Item as $item) {
        $itemName = $item->Name;
        $file = $item->Attribute[0]->Value;
        $modTime = filemtime($file);
        if ($modTime !== false) {
            $attrs = array('ModTime' => sprintf("%010s", $modTime));
            $attrs2 = array('Flavors' => array('Vanilla', 'Chocolate'));
            $res2 = $sdb->put_attributes(BOOK_FILE_DOMAIN, $itemName, $attrs, false);
            $res2 = $sdb->put_attributes(BOOK_FILE_DOMAIN, $itemName, $attrs2, false);
            if ($res2->isOK()) {
                print "Updated item {$itemName}\n";
            } else {
예제 #19
0
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */

error_reporting(E_ALL);

require_once('AWSSDKforPHP/sdk.class.php');
require_once('include/book.inc.php');

// Create the SimpleDB access object
$sdb = new AmazonSDB();

// Set list of attributes to delete
$attrs = array('ModTime', 'Flavor');

// Query for each item
$next = null;
do
{
  $attrs = ($next == null) ? null : array('NextToken' => $next);
  $res1 = $sdb->select("select * from " . BOOK_AWS_USAGE_DOMAIN, $attrs);
  $next  = (string) $res1->body->SelectResult->NextToken;

  if ($res1->isOK())
  {
    foreach ($res1->body->SelectResult->Item as $item)
<?php

// Set the response class on a new AmazonSDB object
$sdb = new \AmazonSDB();
$sdb->set_response_class('\\ORM\\SDB\\SDBResponse');
// ---------------------
// Using get_attributes() (retrieves one item's attributes)
$attributes = $sdb->get_attributes('myDomain', 'item1');
// You can still use CFResponse features
if (!$attributes->isOK()) {
    die("Oh no! There's a problem");
}
// $attributes is now accessible as an array of key->value pairs associated with item1
echo "My item {$attributes['id']} has the name {$attributes['name']}";
// -------------
// Using select() (retrieves any number of items)
$items = $sdb->select('SELECT * FROM myDomain');
// Count will work
echo "Returned ", count($items), " items.";
foreach ($items as $itemName => $itemAttributes) {
    echo "Item: {$itemName}\n";
    // Print out all the attributes of this item
    print_r($itemAttributes);
}
예제 #21
0
 public function __destruct()
 {
     $this->sdb->delete_domain('sources');
 }
예제 #22
0
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query for each file
$res1 = $sdb->select("select * from " . BOOK_FILE_DOMAIN);
if ($res1->isOK()) {
    foreach ($res1->body->SelectResult->Item as $item) {
        $itemName = (string) $item->Name;
        // Delete the attributes
        $res2 = $sdb->delete_attributes(BOOK_FILE_DOMAIN, $itemName);
        if ($res2->isOK()) {
            print "Deleted item {$itemName}\n";
        } else {
            $error = $res2->body->Errors->Error->Message;
            print "Could not delete item: {$error}\n";
        }
    }
} else {
예제 #23
0
 *	Create needed BOOK_AWS_USAGE_DOMAIN SimpleDB domain.
 *
 * Copyright 2009-2010 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'cloudfusion.class.php';
require_once 'include/book.inc.php';
$domain = BOOK_SNAP_LOG_DOMAIN;
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Create the SimpleDB domain
$res = $sdb->create_domain($domain);
// Check result
if (!$res->isOK()) {
    exit("Create domain operation failed for domain {$domain}\n");
}
print "Domain {$domain} created.\n";
exit(0);
예제 #24
0
             </tr>
         </thead>
         <tbody>
             <?foreach($results->body->Item() as $result) {?>
             <tr>
                 <td><?echo($result->Attribute[0]->Value."&nbsp;");?></td>
                 <td><?echo($result->Attribute[1]->Value=="1"?"Author":"Reader");?></td>
                 <td><? echo $result->Name?></td>
             </tr>
             <?}?>
         </tbody>
     </table>
 </div>
 <?
 $domain = 'books-aalr';
 $sdb = new AmazonSDB();
 $query = "SELECT * FROM `{$domain}`";
 $results = $sdb->select($query);
                         ?>
 <div class="tab-pane" id="booksTable">
     <table class="table table-bordered">
         <thead>
             <tr>
             <th><strong>Name</strong></th>
             <th><strong>Author</strong></th>
             <th><strong>Publisher</strong></th>
             <th><strong>ISBN</strong></th>
             <th><strong>Published Year</strong></th>
             <th><strong>Edition</strong></th>
             </tr>
         </thead>
예제 #25
0
 *
 * Modified by Jeffrey S. Haemer <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'AWSSDKforPHP/sdk.class.php';
require_once 'include/book.inc.php';
// Set the query
$query = "select * from " . BOOK_FILE_DOMAIN;
if ($argc > 1) {
    $query .= " where ";
    for ($i = 1; $i < $argc; $i++) {
        $query .= ' ' . $argv[$i] . ' ';
    }
}
print "Final query: {$query}\n";
// Create the SimpleDB access object
$sdb = new AmazonSDB();
// Query the SimpleDB domain
$res = $sdb->select($query);
// Check result
if (!$res->isOK()) {
    exit("Select operation failed\n");
}
// Display results
foreach ($res->body->SelectResult->Item as $item) {
    foreach ($item->Attribute as $attribute) {
        print $attribute->Name . ": " . $attribute->Value . ", ";
    }
    print "\n";
}
exit(0);
예제 #26
0
<?php

require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';
define('AWS_KEY', 'AKIAIGKECZXA7AEIJLMQ');
define('AWS_SECRET_KEY', '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');
define('AWS_ACCOUNT_ID', '457964863276');
# construct the message (use zero padding to handle
# simpledb's lexicographic ordering)
$account = array('fair' => 'yes', 'PDFs' => sprintf('%05d', '0'));
$sdb = new AmazonSDB();
# $sdb->set_region($sdb::REGION_EU_W1);
$accounts = $sdb->create_domain('accounts');
$accounts->isOK() or die('could not create domain accounts');
$response = $sdb->put_attributes('accounts', '*****@*****.**', $account, true);
pr($response->body);
function pr($var)
{
    print '<pre>';
    print_r($var);
    print '</pre>';
}
예제 #27
0
 public function testListDomains()
 {
     $domains = $this->object->list_domains();
     $this->assertGreaterThan(1, count($domains));
     $this->assertContains('cars', $domains);
 }