if (!isOrdered()) { header('Location: ../index.php'); exit; } $orderInfo = getOrderInfo(); $amount = 0; $description = ""; $prices = getPriceById($orderInfo['price_id']); $keyData = array(); if (!$prices) { $errorMessage = "Processing error! License type not found"; $messageType = "error"; } else { try { if (isset($orderInfo["key"])) { $keyData = getKeyById($orderInfo["key"]); if (!$keyData) { throw new Exception("Key not exits", 1); } } } catch (Exception $e) { $errorMessage = $e->getMessage(); $messageType = "error"; } $amount = $prices['Price']; $description = $prices["MonthNumber"] . " Months"; $_SESSION['orderinfo']['price'] = $amount; $_SESSION['orderinfo']['daylimit'] = (int) $prices['MonthNumber'] * 30; // Figure out what funding instruments are available for this buyer if ($_SERVER['REQUEST_METHOD'] == 'POST') { try {
function updateKey($id, $dayLimit, $price, $payerid) { $conn = getConnection(); $query = sprintf("Update %s set CreateDate=now(), DateLimit =DATE_ADD(now(),INTERVAL %d DAY ),Price=%f,PayerId='%s' where id = %d", KEY_TABLE, $dayLimit, $price, $payerid, $id); $result = mysql_query($query, $conn); if (!$result) { $errMsg = "Error: " . mysql_error($conn); mysql_close($conn); throw new Exception("Error Processing Request:" . $errMsg, 1); } mysql_close($conn); $key = getKeyById($id); if ($key) { return $key["key_code"]; } return false; }