예제 #1
0
파일: index.php 프로젝트: LEXXiY/devschool
<?php

/**
 * Board system like avito.ru
 *
 * @package Example-application
 */
require './settings.php';
if (!empty($_POST)) {
    $id = isset($_POST['id']) ? $_POST['id'] : '';
    $currads = selectAll();
    if (isset($_GET['action']) && $_GET['action'] == 'update' && isset($currads[$id])) {
        $data = prepareData($_POST);
        updateInDb($id, $data);
    } else {
        $data = prepareData($_POST);
        insertToDb($data);
    }
} elseif (isset($_GET['del'])) {
    deleteFromDb((int) $_GET['del']);
} elseif (isset($_GET['edit']) && !isset($_GET['action'])) {
    $data = selectById($_GET['edit']);
    $formParam = prepareData($data);
}
if (!isset($formParam)) {
    $formParam = prepareData();
}
$cities = get_cities();
$categories = get_categories();
$ads = selectAll();
$smarty->assign("cities", $cities);
예제 #2
0
    $PC->setPw($paypal_pw);
    $PC->setSignature($paypal_signature);
    $PC->setCurrency($paypal_currencycode);
    $PC->setAmount($paypal_amount);
    $parameter = array();
    $curl = curl_init();
    curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://api-3t.sandbox.paypal.com/nvp/?' . $PC->getRequestString(), CURLOPT_USERAGENT => 'Codular Sample cURL Request'));
    foreach (explode('&', curl_exec($curl)) as $chunk) {
        $param = explode("=", $chunk);
        if ($param) {
            $parameter = array_merge($parameter, array(urldecode($param[0]) => urldecode($param[1])));
        }
    }
    curl_close($curl);
    if ($parameter["ACK"] == "Success") {
        if (updateInDb("order_id", $order_id, "success", 1, "#__product_orders")) {
            echo "<h3>Vielen Dank für Ihre Bestellung!</h3>";
            $document = JFactory::getDocument();
            $document->addScriptDeclaration('
				jQuery(document).ready(function(){
					var toast = "Auftrag erfolgreich ausgeführt.";
					Android.showToast(toast);
				});	
			');
        } else {
            echo "Fehler beim Abschließen Ihrer Bestellung! (Update failed)";
        }
    } else {
        echo "Fehler beim Abschließen Ihrer Bestellung!";
    }
    // // // // // // // // // // // // // // // // // // // //