Файловый менеджер - Редактировать - /home/gqdcvggs/go.imators.com/shop.zip
Назад
PK ;/�[cOۋ@ @ composer.jsonnu �Iw�� { "require": { "stripe/stripe-php": "^16.5" } } PK ;/�[yW�� � db.phpnu �Iw�� <?php $host = 'localhost:3306'; $dbname = 'gqdcvggs_out'; $username = 'gqdcvggs'; $password = 'imaors_management.346980*#@-onlyforcpanel;forchange'; try { $db = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); exit; }PK ;/�[�X��� � create-checkout-session.phpnu �Iw�� <?php require_once 'db.php'; require 'vendor/autoload.php'; \Stripe\Stripe::setApiKey('your_secret_key'); $data = json_decode(file_get_contents('php://input'), true); $cart = $data ?? []; $line_items = []; $total = 0; foreach($cart as $product_id => $quantity) { $stmt = $db->prepare("SELECT * FROM products WHERE id = ?"); $stmt->execute([$product_id]); $product = $stmt->fetch(); if($product) { $line_items[] = [ 'price_data' => [ 'currency' => 'usd', 'product_data' => [ 'name' => $product['title'], ], 'unit_amount' => $product['price'] * 100, ], 'quantity' => $quantity, ]; $total += $product['price'] * $quantity; } } $checkout_session = \Stripe\Checkout\Session::create([ 'payment_method_types' => ['card'], 'line_items' => $line_items, 'mode' => 'payment', 'success_url' => 'https://your-domain.com/success.php', 'cancel_url' => 'https://your-domain.com/cancel.php', ]); $stmt = $db->prepare("INSERT INTO orders (total_amount, status, stripe_session_id) VALUES (?, ?, ?)"); $stmt->execute([$total, 'pending', $checkout_session->id]); $order_id = $db->lastInsertId(); foreach($cart as $product_id => $quantity) { $stmt = $db->prepare("SELECT price FROM products WHERE id = ?"); $stmt->execute([$product_id]); $product = $stmt->fetch(); if($product) { $stmt = $db->prepare("INSERT INTO order_items (order_id, product_id, quantity, price) VALUES (?, ?, ?, ?)"); $stmt->execute([$order_id, $product_id, $quantity, $product['price']]); } } echo json_encode(['id' => $checkout_session->id]);PK ;/�[���L L composer.locknu �Iw�� { "_readme": [ "This file locks the dependencies of your project to a known state", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "e24c0d2a12368998f4095c0c24fa3903", "packages": [ { "name": "stripe/stripe-php", "version": "v16.5.1", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", "reference": "05c7c3a8a15b1bc396f09d17c88539c0db3d3255" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/stripe/stripe-php/zipball/05c7c3a8a15b1bc396f09d17c88539c0db3d3255", "reference": "05c7c3a8a15b1bc396f09d17c88539c0db3d3255", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", "php": ">=5.6.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "3.5.0", "phpstan/phpstan": "^1.2", "phpunit/phpunit": "^5.7 || ^9.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0-dev" } }, "autoload": { "psr-4": { "Stripe\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Stripe and contributors", "homepage": "https://github.com/stripe/stripe-php/contributors" } ], "description": "Stripe PHP Library", "homepage": "https://stripe.com/", "keywords": [ "api", "payment processing", "stripe" ], "support": { "issues": "https://github.com/stripe/stripe-php/issues", "source": "https://github.com/stripe/stripe-php/tree/v16.5.1" }, "time": "2025-02-07T21:24:29+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], "platform-dev": [], "plugin-api-version": "2.6.0" } PK ;/�['YZf[ [ index.phpnu �Iw�� <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Out - Food Ordering</title> <script src="https://cdn.tailwindcss.com"></script> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap" rel="stylesheet"> <script src="https://js.stripe.com/v3/"></script> <style> body { font-family: 'Poppins', sans-serif; } </style> </head> <body class="bg-white text-black"> <div class="banner w-full h-96 bg-fixed bg-cover bg-center" style="background-image: url('banner.jpg')"></div> <div class="container mx-auto px-4 py-8 max-w-4xl"> <div class="grid md:grid-cols-2 gap-6" id="products"> <?php require_once 'db.php'; $stmt = $db->query("SELECT * FROM products"); while($product = $stmt->fetch()) { echo ' <div class="flex flex-col md:flex-row gap-4 bg-white p-4 rounded-lg shadow"> <div class="w-full md:w-48 h-48 bg-gray-100 rounded-lg"> <img src="'.$product['image_url'].'" class="w-full h-full object-cover rounded-lg"> </div> <div class="flex-1"> <h2 class="text-xl font-semibold">'.$product['title'].'</h2> <p class="mt-2 text-gray-600">'.$product['description'].'</p> <div class="mt-4 flex items-center gap-4"> <input type="number" min="1" value="1" class="quantity-input w-20 p-2 border rounded" data-id="'.$product['id'].'"> <button onclick="addToCart('.$product['id'].')" class="px-4 py-2 bg-black text-white rounded hover:bg-gray-800">Add</button> </div> </div> </div>'; } ?> </div> </div> <button id="cartButton" class="fixed bottom-8 left-1/2 transform -translate-x-1/2 bg-black text-white px-6 py-3 rounded-full hover:bg-gray-800 transition-all duration-300"> Cart (0) </button> <div id="successNotification" class="fixed bottom-8 left-1/2 transform -translate-x-1/2 bg-green-500 text-white px-6 py-3 rounded-lg opacity-0 transition-all duration-300"> Added successfully </div> <div id="cartModal" class="fixed inset-0 bg-black bg-opacity-50 hidden"> <div class="fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg w-11/12 max-w-2xl"> <h2 class="text-2xl mb-4">Your Cart</h2> <div id="cartItems" class="mb-4"></div> <div class="flex justify-between items-center"> <div class="text-xl">Total: $<span id="cartTotal">0</span></div> <button onclick="checkout()" class="px-6 py-3 bg-black text-white rounded hover:bg-gray-800">Checkout</button> </div> <button onclick="closeCart()" class="absolute top-4 right-4 text-2xl">×</button> </div> </div> <script> let cart = {}; const stripe = Stripe('your_publishable_key'); function addToCart(productId) { const quantity = parseInt(document.querySelector(`.quantity-input[data-id="${productId}"]`).value); cart[productId] = (cart[productId] || 0) + quantity; updateCartButton(); showSuccessNotification(); } function updateCartButton() { const total = Object.values(cart).reduce((a, b) => a + b, 0); document.getElementById('cartButton').textContent = `Cart (${total})`; } function showSuccessNotification() { const notification = document.getElementById('successNotification'); notification.classList.remove('opacity-0'); notification.classList.add('opacity-100'); setTimeout(() => { notification.classList.remove('opacity-100'); notification.classList.add('opacity-0'); }, 2000); } document.getElementById('cartButton').addEventListener('click', () => { document.getElementById('cartModal').classList.remove('hidden'); updateCartModal(); }); function closeCart() { document.getElementById('cartModal').classList.add('hidden'); } function updateCartModal() { fetch('get-cart-items.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(cart) }) .then(response => response.json()) .then(data => { document.getElementById('cartItems').innerHTML = data.items; document.getElementById('cartTotal').textContent = data.total; }); } function checkout() { fetch('create-checkout-session.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(cart) }) .then(response => response.json()) .then(session => { stripe.redirectToCheckout({ sessionId: session.id }); }); } </script> </body> </html>PK ;/�[�c�u u get-cart-items.phpnu �Iw�� <?php require_once 'db.php'; $data = json_decode(file_get_contents('php://input'), true); $cart = $data ?? []; $items_html = ''; $total = 0; foreach($cart as $product_id => $quantity) { $stmt = $db->prepare("SELECT * FROM products WHERE id = ?"); $stmt->execute([$product_id]); $product = $stmt->fetch(); if($product) { $subtotal = $product['price'] * $quantity; $total += $subtotal; $items_html .= " <div class='flex justify-between items-center mb-4 pb-4 border-b'> <div> <h3 class='font-semibold'>{$product['title']}</h3> <p class='text-gray-600'>Quantity: {$quantity}</p> </div> <div>\${$subtotal}</div> </div>"; } } echo json_encode([ 'items' => $items_html, 'total' => number_format($total, 2) ]);PK ;/�[�!�` vendor/autoload.phpnu �Iw�� <?php // autoload.php @generated by Composer if (PHP_VERSION_ID < 50600) { if (!headers_sent()) { header('HTTP/1.1 500 Internal Server Error'); } $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; if (!ini_get('display_errors')) { if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { fwrite(STDERR, $err); } elseif (!headers_sent()) { echo $err; } } trigger_error( $err, E_USER_ERROR ); } require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit40aa654f2e66c20881ae0572fe987a10::getLoader(); PK ;/�[o6�/ ( vendor/stripe/stripe-php/OPENAPI_VERSIONnu �Iw�� v1455PK ;/�[R��N N &