* 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 < 8 || $argc > 9) { exit("Usage: " . $argv[0] . " CITY STATE DATE PRICE CATEGORY \"TITLE\" \"DESCRIPTION\" [IMAGEURL]\n"); } // Get item info $city = $argv[1]; $state = $argv[2]; $date = $argv[3]; $price = $argv[4]; $category = $argv[5]; $title = $argv[6]; $description = $argv[7]; $imageURL = null; if ($argc > 8) { $imageURL = $argv[8]; } // Create access objects $s3 = new AmazonS3(); $sdb = new AmazonSDB(); if (addCloudListItem($sdb, $s3, $city, $state, $date, $price, $category, $title, $description, $imageURL)) { print "Added item {$title} in {$city}, {$state}\n"; } else { print "Could not add item!\n"; }
if (isset($_POST['formsubmit'])) { // Get submitted values $stateCity = $_POST['statecity']; $price = $_POST['price']; $category = $_POST['category']; $title = $_POST['title']; $description = $_POST['description']; // Use today's date $date = date('Y-m-d'); // Split StateCity $state = substr($stateCity, 0, 2); $city = substr($stateCity, 3); // Process image if supplied if (isset($_FILES['image']) && is_uploaded_file($_FILES['image']['tmp_name'])) { $imagePath = $_FILES['image']['tmp_name']; } else { $imagePath = null; } // Insert item $success = addCloudListItem($sdb, $s3, $city, $state, $date, $price, $category, $title, $description, $imagePath); // Output thank you message include 'include/addthanks.html.php'; exit(0); } else { // Get cities and categories $cities = getCities($sdb); $categories = getCategories($sdb); // Output form include 'include/addform.html.php'; exit(0); }