예제 #1
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php';
get_header();
?>
<div class="orderWrap">
    <div class="orderPay">

<?php 
//prn($_POST);
$inv_id = generateNumber();
$out_summ = $_POST['sum'] + $_POST['deliveryCost'];
if ($_POST['paymentType'] == 'robokassa') {
    /* Источник: http://n-wp.ru/8295 */
    $mrh_login = "******";
    $mrh_pass1 = "123edcxzaqws";
    $inv_desc = "Оплата с сайта Магазин экопродуктов Ирины Нельсон, E-mail: " . $_POST['order-mail'] . ", Номер заказа: " . $inv_id;
    $is_test = 0;
    $shp_item = 1;
    $in_curr = "";
    $culture = "ru";
    $encoding = "utf-8";
    $crc = md5("{$mrh_login}:{$out_summ}:{$inv_id}:{$mrh_pass1}:Shp_item={$shp_item}");
    ?>
    <span class="orderId">Номер заказа: <?php 
    echo $inv_id;
    ?>
</span>
    <form action='https://merchant.roboxchange.com/Index.aspx' method=POST>
        <input type=hidden name=MrchLogin value='<?php 
    echo $mrh_login;
예제 #2
0
function sendOrder()
{
    global $wpdb;
    if (isset($_COOKIE['cartCookie'])) {
        $cookie = $_COOKIE['cartCookie'];
        $cookie = stripslashes($cookie);
        //идшники, кол-во и цена
        $cookie = json_decode($cookie);
        //вытаскиваем товары
        $postIds = [];
        foreach ($cookie as $key => $product) {
            $postIds[] = $key;
        }
        $postIds = implode(',', $postIds);
        $posts = get_posts(array('post_type' => 'product', 'include' => $postIds));
        $admin_email = get_option('admin_email');
        //вытаскиваем данные о заказчике
        $date = time();
        $phone = $_POST['phone'];
        $total = $_POST['total'];
        $orderdata = '';
        if (isset($_POST['adv'])) {
            $address = $_POST['address'];
            $homenum = $_POST['homenum'];
            $porchnum = $_POST['porchnum'];
            $housing = $_POST['housing'];
            $aptnum = $_POST['porchnum'];
            $floor = $_POST['floor'];
            $comment = $_POST['comment'];
            $orderdata = 'Адрес: ' . $address . '; № дома: ' . $homenum . '; № подъезда: ' . $porchnum . '; Корпус: ' . $housing . '; № квартиры: ' . $aptnum . '; № этажа: ' . $floor . '; Коментарий: ' . $comment;
        }
        $orderId = generateNumber(5);
        $product = [];
        foreach ($posts as $key => $item) {
            $product[] = array('id' => $item->ID, 'name' => $item->post_title, 'count' => $cookie->{$item->ID}->count, 'price' => $cookie->{$item->ID}->price);
        }
        $wpdb->insert('orders', array('order_key' => $orderId, 'product' => json_encode($product), 'total' => $total, 'phone' => $phone, 'data' => $orderdata, 'order_dt' => $date));
        $str = 'Номер заказа: ' . $orderId . ' <br>';
        $str .= 'Телефон для связи: ' . $phone . ' <br>';
        $str .= 'Товары : ';
        $total = 0;
        foreach ($product as $item) {
            $total += $item['price'];
            $str .= "<br>Название: " . $item['name'];
            $str .= "<br>Количество: " . $item['count'];
            $str .= "<br>Цена: " . $item['price'] . "<br>";
        }
        if (!empty($orderdata)) {
            $str .= 'О доставке: ' . $orderdata . ' </br>';
        }
        $str .= 'Итого : ' . $total;
        mail($admin_email, "Заказ с сайта", $str, "Content-type: text/html; charset=UTF-8\r\n");
        // mail('*****@*****.**', "Заказ с сайта", $str, "Content-type: text/html; charset=UTF-8\r\n");
        echo $orderId;
        die;
    }
}
예제 #3
0
<?php

function generate($nb)
{
    $list = '';
    for ($i = 0; $i < $nb; $i++) {
        $list .= chr(rand(97, 122)) . chr(rand(97, 122)) . chr(rand(97, 122)) . chr(rand(97, 122)) . "\n";
    }
    return $list;
}
function generateNumber($nb)
{
    $lists = range(1, $nb);
    foreach ($lists as $list) {
        $randList[] = rand(1, 10000);
    }
    sort($randList);
    $res = '';
    foreach ($randList as $l) {
        $res .= $l . "\n";
    }
    return $res;
}
$list1 = new SplFileObject('./list1.txt', 'a+');
$list2 = new SplFileObject('./list2.txt', 'a+');
$list3 = new SplFileObject('./orderList.txt', 'a+');
$list1->fwrite(generate(1000));
$list2->fwrite(generate(1000));
$list3->fwrite(generateNumber(1000));
exec('chmod 777 *.txt');
예제 #4
0
function admin_add_order()
{
    global $wpdb;
    $order_num = generateNumber();
    if ($_POST['subscription-duration']) {
        $month = $_POST['subscription-duration'];
        $price = $_POST['subscription-price'];
        //$end_date = strtotime('+'.$month.' month', time());
        $user = $_POST['subscription-user_id'];
        if (!get_user_meta($user, 'subscription_duration')) {
            add_user_meta($user, 'subscription_duration', 0, true);
        }
        if (!get_user_meta($user, $order_num)) {
            add_user_meta($user, $order_num, 0, true);
        } else {
            update_user_meta($user, $order_num, 0);
        }
        $wpdb->insert('subscriptions', array('order_num' => $order_num, 'price' => $price, 'status' => 0, 'duration' => 0, 'user_id' => $user, 'type' => $month));
        // Handle request then generate response using echo or leaving PHP and using HTML
        header("HTTP/1.1 301 Moved Permanently");
        header("Location: " . get_bloginfo('url') . "/order/?sum=" . $price . "&uid=" . $user . "&dur=" . $month . "&n=" . $order_num);
        exit;
    } else {
        $current_user = wp_get_current_user();
        $product_id = $_POST['buybook--id'];
        $product_price = $_POST['buybook--sum'];
        $email = $_POST['buybook--mail'];
        if ($wpdb->insert('orders', array('order_num' => $order_num, 'book_id' => $product_id, 'price' => $product_price, 'email' => $email, 'status' => 0, 'user_id' => $current_user->ID))) {
            // Handle request then generate response using echo or leaving PHP and using HTML
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: " . get_bloginfo('url') . "/order/?sum=" . $product_price . "&n=" . $order_num);
            exit;
        }
    }
}
예제 #5
0
//Start newCred Function
if ($_GET['function'] == 'newCred') {
    // Server should keep session data for AT LEAST 12 hours
    ini_set('session.gc_maxlifetime', 43200);
    // Each client should remember their session id for EXACTLY 12 hours
    session_set_cookie_params(43200);
    // Session Length
    $timeout = 43200;
    // Start Session
    session_start();
    // Check if Session Already Exists
    if (!isset($_SESSION['session_identifier'])) {
        // If We Haven't Created our Special Session, Do So Now
        $_SESSION['session_identifier'] = "Shellicio.us Session";
        $_SESSION['session_user'] = generateRandomString();
        $_SESSION['session_pass'] = generateNumber('4');
        $_SESSION['session_ip'] = $_SERVER['REMOTE_ADDR'];
        $_SESSION['session_email'] = $_GET['email'];
        $_SESSION['session_browser'] = $_SERVER['HTTP_USER_AGENT'];
        $_SESSION['session_time_start'] = time();
        $_SESSION['session_time_stop'] = time() + $timeout;
    }
    // Check if Session is Expired, If so, Destroy
    if ($_SESSION['session_time_stop'] < time()) {
        session_destroy();
    }
    $timeleft = $_SESSION['session_time_stop'] - time();
    writeCredentials();
    //Grab the POST Values and make them Pretty
    $usernameCred = $_SESSION['session_user'];
    $usernamePass = $_SESSION['session_pass'];