<?php // 'Settings' page error_reporting(E_ALL); ini_set("display_errors", 1); require_once realpath(dirname(__FILE__)) . "/../lego/UserCakeLego.php"; require_once realpath(dirname(__FILE__)) . "/../lego/SettingsLego.php"; ?> <ul id="settings"> <?php getAndPrintSettings(getCurrentUserID()); ?> <!-- <li><h2 class="name button">Frederick <span>(Tomato)</span></h2> <ul class="sub"> <li>Alert Type<span class="value">Vibrate</span></li> <li>Alert Sensitivity<span class="value">Low</span></li> <li>Edit Progress<span class="value">2</span></li> <li>Change photo<span class="value">…</span></li> </ul> </li> <li><h2 class="name button">Frederick <span>(Tomato)</span></h2> <ul class="sub"> <li>Alert Type<span class="value">Vibrate</span></li> <li>Alert Sensitivity<span class="value">Low</span></li>
require_once realpath(dirname(__FILE__)) . "/lego/DatabaseLego.php"; require_once realpath(dirname(__FILE__)) . "/lego/UserCakeLego.php"; require_once realpath(dirname(__FILE__)) . "/lego/UploadLego.php"; require_once realpath(dirname(__FILE__)) . "/lego/PlantLego.php"; require_once realpath(dirname(__FILE__)) . "/lego/NotificationLego.php"; require_once realpath(dirname(__FILE__)) . "/lego/AlertLego.php"; ConnectDB(); switch ($_REQUEST['a']) { case 'newPlant': newPlant($_REQUEST['data']); break; case 'getUserStuff': $userStuff = array(); $userStuff['displayName'] = getCurrentDisplayName(); $userStuff['userName'] = getCurrentUserName(); $userStuff['userID'] = getCurrentUserID(); echo json_encode($userStuff); break; case 'silentUpload': upload($_FILES['plantPhoto']); break; case 'recentStats': getAveragePlantStats($_REQUEST['plantID']); break; case 'currentStats': getCurrentPlantStats($_REQUEST['plantID']); break; case 'getDefaultPhotos': getDefaultPhotos($_REQUEST['name']); break; case 'getDefaultPhotosString':
$alt2image = uploadPrdImage($_FILES['alt2file']['tmp_name'], $_FILES['alt2file']['name'], $_FILES['alt2file']['error']); if (strpos($mainimage, 'ERROR') !== false && $mode == "new") { $error .= "Form Error.. main image uploads failed." . $_FILES['mainfile']['error']; } if (strpos($mainimage, 'ERROR') === false) { $mi = $mainimage; } if (strpos($alt1image, 'ERROR') === false) { $ai1 = $alt1image; } if (strpos($alt2image, 'ERROR') === false) { $ai2 = $alt2image; } if ($error == "") { if ($mode == "new") { $curr_userID = getCurrentUserID(); $curr_userType = isAgent() ? 0 : 1; $curr_userEmail = getCurrentUserEmail(); $query = "INSERT INTO `products` (`name`, `price`, `bodypart`, `material`, `mainimg`, `alt1img`, `alt2img`, `status`, `shortdesc`, `detaildesc`, `addinfo`, `featured`, `addedUsertype`, `addedbyUserEmail`, `quantity`, `size`, `tags`, `style`) VALUES ( ?, ?, ?,?,?,?, ?,?, ?, ?, ?, ?, ?, ?, ?,?,?,?)"; $statement = $dbcon->prepare($query); //bind parameters for markers, where (s = string, i = integer, d = double, b = blob) $statement->bind_param('sdiisssisssiisisss', $pname, floatval($pprice), intval($pitem), intval($pcategory), $mi, $ai1, $ai2, intval($pstatus), $sdesc, $pdesc, $addinfo, intval($featured), $curr_userType, $curr_userEmail, intval($pquantity), $psize, $ptags, implode(",", $style_list)); if ($statement->execute()) { $mode = "edit"; $pid = $statement->insert_id; } else { die('Error : (' . $dbcon->errno . ') ' . $dbcon->error); } $statement->close(); } else { if ($mode == "edit") {