3.0
This commit is contained in:
parent
938f4bfd2d
commit
3db54a0124
186
create_ad.php
Normal file
186
create_ad.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
// create_ad.php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Hardcoded user ID for demonstration purposes
|
||||
// In a real application, you would get this from the session
|
||||
$user_id = 1;
|
||||
|
||||
$message = '';
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// --- Form Data ---
|
||||
$ad_type = $_POST['ad_type'] ?? '';
|
||||
$currency = $_POST['currency'] ?? 'TON';
|
||||
$payment_currency = $_POST['payment_currency'] ?? 'RUB';
|
||||
$fixed_price = $_POST['fixed_price'] ?? null;
|
||||
$available_amount = $_POST['available_amount'] ?? null;
|
||||
$min_amount = $_POST['min_amount'] ?? null;
|
||||
$max_amount = $_POST['max_amount'] ?? null;
|
||||
$bank_name = $_POST['bank_name'] ?? '';
|
||||
$comment = $_POST['comment'] ?? '';
|
||||
|
||||
// --- Basic Validation ---
|
||||
if (empty($ad_type) || empty($fixed_price) || empty($available_amount) || empty($min_amount) || empty($max_amount) || empty($bank_name)) {
|
||||
$error = "Please fill in all required fields.";
|
||||
} elseif (!is_numeric($fixed_price) || !is_numeric($available_amount) || !is_numeric($min_amount) || !is_numeric($max_amount)) {
|
||||
$error = "Price and amount fields must be numbers.";
|
||||
} elseif ($min_amount > $max_amount) {
|
||||
$error = "Minimum amount cannot be greater than maximum amount.";
|
||||
} elseif ($max_amount > $available_amount) {
|
||||
$error = "Maximum amount cannot be greater than the total available amount.";
|
||||
} else {
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare(
|
||||
"INSERT INTO ads (user_id, ad_type, currency, payment_currency, price_type, fixed_price, available_amount, min_amount, max_amount, bank_name, comment, status)
|
||||
VALUES (:user_id, :ad_type, :currency, :payment_currency, 'FIXED', :fixed_price, :available_amount, :min_amount, :max_amount, :bank_name, :comment, 'ACTIVE')"
|
||||
);
|
||||
|
||||
$stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':ad_type', $ad_type, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':currency', $currency, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':payment_currency', $payment_currency, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':fixed_price', $fixed_price);
|
||||
$stmt->bindParam(':available_amount', $available_amount);
|
||||
$stmt->bindParam(':min_amount', $min_amount);
|
||||
$stmt->bindParam(':max_amount', $max_amount);
|
||||
$stmt->bindParam(':bank_name', $bank_name, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':comment', $comment, PDO::PARAM_STR);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$message = "Ad created successfully!";
|
||||
} else {
|
||||
$error = "Failed to create ad. Please try again.";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
// In a real app, you'd log this error, not show it to the user
|
||||
$error = "Database error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Create New Ad</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Platform</a>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item"><a class="nav-link" href="index.php"><i class="bi bi-house-door"></i> Dashboard</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Create a New Advertisement</h3>
|
||||
<p class="card-subtitle text-muted">Fill out the form below to post your ad.</p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if ($message): ?>
|
||||
<div class="alert alert-success"><?php echo htmlspecialchars($message); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form action="create_ad.php" method="POST">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">I want to:</label>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="ad_type" id="sellRadio" value="SELL" required>
|
||||
<label class="form-check-label" for="sellRadio">Sell Crypto</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="ad_type" id="buyRadio" value="BUY" required>
|
||||
<label class="form-check-label" for="buyRadio">Buy Crypto</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="currency" class="form-label">Crypto Currency</label>
|
||||
<select class="form-select" id="currency" name="currency">
|
||||
<option value="TON" selected>TON</option>
|
||||
<option value="BTC">BTC</option>
|
||||
<option value="USDT">USDT</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="payment_currency" class="form-label">Fiat Currency</label>
|
||||
<select class="form-select" id="payment_currency" name="payment_currency">
|
||||
<option value="RUB" selected>RUB</option>
|
||||
<option value="USD">USD</option>
|
||||
<option value="EUR">EUR</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="fixed_price" class="form-label">Price per Crypto Unit (in Fiat)</label>
|
||||
<input type="number" step="0.01" class="form-control" id="fixed_price" name="fixed_price" placeholder="e.g., 6000.00" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="available_amount" class="form-label">Total Amount of Crypto to Trade</label>
|
||||
<input type="number" step="0.00000001" class="form-control" id="available_amount" name="available_amount" placeholder="e.g., 100.0" required>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="min_amount" class="form-label">Minimum Transaction Limit</label>
|
||||
<input type="number" step="0.00000001" class="form-control" id="min_amount" name="min_amount" placeholder="e.g., 10.0" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="max_amount" class="form-label">Maximum Transaction Limit</label>
|
||||
<input type="number" step="0.00000001" class="form-control" id="max_amount" name="max_amount" placeholder="e.g., 50.0" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="bank_name" class="form-label">Payment Method / Bank Name</label>
|
||||
<input type="text" class="form-control" id="bank_name" name="bank_name" placeholder="e.g., Sberbank, Tinkoff, etc." required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="comment" class="form-label">Terms & Conditions / Comments</label>
|
||||
<textarea class="form-control" id="comment" name="comment" rows="3" placeholder="e.g., Only transfer from verified accounts."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary btn-lg">Create Ad</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="text-center mt-5 mb-3">
|
||||
<p class="text-muted">© <?php echo date("Y"); ?> P2P Platform</p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
54
disputes_user.php
Normal file
54
disputes_user.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$user = [
|
||||
'is_logged_in' => true,
|
||||
'nickname' => 'TestUser',
|
||||
];
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Споры</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Платформа</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="profile.php"><i class="bi bi-person-circle"></i> <?= htmlspecialchars($user['nickname']) ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Выйти</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container mt-4">
|
||||
<h1 class="mb-4">Активные споры</h1>
|
||||
<div class="alert alert-info">Эта страница находится в разработке. Здесь будут отображаться ваши активные споры.</div>
|
||||
<a href="index.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Назад на главную</a>
|
||||
</main>
|
||||
|
||||
<footer class="container text-center text-muted mt-5 py-3 border-top">
|
||||
<p>© P2P Platform <?= date('Y') ?></p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
163
index.php
163
index.php
@ -1,68 +1,127 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
// Mock user data - in a real app, this would come from a session after login
|
||||
$user = [
|
||||
'is_logged_in' => true,
|
||||
'nickname' => 'TestUser',
|
||||
'rating' => 4.9,
|
||||
'telegram_id' => '123456789'
|
||||
];
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<title>Панель пользователя</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.hero {
|
||||
background: linear-gradient(45deg, #007bff, #6c757d);
|
||||
color: white;
|
||||
padding: 6rem 2rem;
|
||||
text-align: center;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
<main class="container mt-5">
|
||||
<div class="hero">
|
||||
<h1 class="display-4">P2P Crypto Exchange Bot</h1>
|
||||
<p class="lead">This is the web interface for your Telegram-based P2P exchange.</p>
|
||||
<hr class="my-4">
|
||||
<p>The initial admin dashboard is ready for review.</p>
|
||||
<a class="btn btn-light btn-lg" href="admin.php" role="button">View Admin Dashboard</a>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Платформа</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<?php if ($user['is_logged_in']): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="profile.php">
|
||||
<i class="bi bi-person-circle"></i> <?= htmlspecialchars($user['nickname']) ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Выйти</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="login.php"><i class="bi bi-box-arrow-in-right"></i> Войти</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<footer class="text-center text-muted mt-4">
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
</footer>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="p-5 mb-4 bg-light rounded-3">
|
||||
<div class="container-fluid py-5">
|
||||
<h1 class="display-5 fw-bold">Добро пожаловать, <?= htmlspecialchars($user['nickname']) ?>!</h1>
|
||||
<p class="col-md-8 fs-4">Ваша панель для управления P2P-сделками. Отсюда вы можете управлять объявлениями, кошельком и настройками.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row text-center">
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<i class="bi bi-wallet2 fs-1 text-primary"></i>
|
||||
<h5 class="card-title mt-3">Кошелек</h5>
|
||||
<p class="card-text">Просмотр баланса и истории транзакций.</p>
|
||||
<a href="wallet.php" class="btn btn-primary">Перейти к кошельку</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<i class="bi bi-card-list fs-1 text-success"></i>
|
||||
<h5 class="card-title mt-3">Объявления</h5>
|
||||
<p class="card-text">Просмотр и управление текущими объявлениями.</p>
|
||||
<a href="user_ads.php" class="btn btn-success">Смотреть объявления</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<i class="bi bi-plus-circle-dotted fs-1 text-info"></i>
|
||||
<h5 class="card-title mt-3">Создать объявление</h5>
|
||||
<p class="card-text">Создайте новое объявление о покупке или продаже.</p>
|
||||
<a href="create_ad.php" class="btn btn-info">Создать</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<h4>Системные действия</h4>
|
||||
<hr>
|
||||
<div class="list-group">
|
||||
<a href="my_deals.php" class="list-group-item list-group-item-action">
|
||||
<i class="bi bi-arrow-left-right me-2"></i> Мои сделки
|
||||
</a>
|
||||
<a href="disputes_user.php" class="list-group-item list-group-item-action">
|
||||
<i class="bi bi-shield-exclamation me-2"></i> Активные споры
|
||||
</a>
|
||||
<a href="user_settings.php" class="list-group-item list-group-item-action">
|
||||
<i class="bi bi-gear me-2"></i> Настройки профиля
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
<footer class="container text-center text-muted mt-5 py-3 border-top">
|
||||
<p>© P2P Platform <?= date('Y') ?></p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
146
initiate_deal.php
Normal file
146
initiate_deal.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
// initiate_deal.php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Hardcoded user ID for demonstration
|
||||
$current_user_id = 2; // Assuming a different user is buying
|
||||
|
||||
$ad = null;
|
||||
$error = '';
|
||||
$message = '';
|
||||
|
||||
if (!isset($_GET['ad_id']) || !is_numeric($_GET['ad_id'])) {
|
||||
header("Location: user_ads.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$ad_id = (int)$_GET['ad_id'];
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT a.*, u.nickname AS seller_nickname, u.rating AS seller_rating
|
||||
FROM ads a
|
||||
JOIN users u ON a.user_id = u.id
|
||||
WHERE a.id = :ad_id AND a.status = 'ACTIVE'"
|
||||
);
|
||||
$stmt->bindParam(':ad_id', $ad_id, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$ad = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$ad) {
|
||||
$error = "Ad not found or is no longer active.";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$error = "Database error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
// Handle form submission
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $ad) {
|
||||
$amount_crypto = $_POST['amount_crypto'] ?? 0;
|
||||
$amount_fiat = 0;
|
||||
|
||||
// Basic validation
|
||||
if (!is_numeric($amount_crypto) || $amount_crypto <= 0) {
|
||||
$error = "Please enter a valid amount.";
|
||||
} else {
|
||||
$amount_fiat = $amount_crypto * $ad['fixed_price'];
|
||||
if ($amount_fiat < $ad['min_amount'] || $amount_fiat > $ad['max_amount']) {
|
||||
$error = "The amount is not within the ad's limits.";
|
||||
} elseif ($amount_crypto > $ad['available_amount']) {
|
||||
$error = "The requested amount exceeds the available amount in the ad.";
|
||||
} else {
|
||||
// All good, create the order
|
||||
try {
|
||||
$buyer_id = $current_user_id;
|
||||
$seller_id = $ad['user_id'];
|
||||
$status = 'AWAITING_PAYMENT'; // Or PENDING_CONFIRMATION depending on flow
|
||||
|
||||
$pdo->beginTransaction();
|
||||
|
||||
// Create the order
|
||||
$order_stmt = $pdo->prepare(
|
||||
"INSERT INTO orders (ad_id, buyer_id, seller_id, amount_crypto, amount_fiat, status)
|
||||
VALUES (:ad_id, :buyer_id, :seller_id, :amount_crypto, :amount_fiat, :status)"
|
||||
);
|
||||
$order_stmt->execute([
|
||||
':ad_id' => $ad_id,
|
||||
':buyer_id' => $buyer_id,
|
||||
':seller_id' => $seller_id,
|
||||
':amount_crypto' => $amount_crypto,
|
||||
':amount_fiat' => $amount_fiat,
|
||||
':status' => $status
|
||||
]);
|
||||
|
||||
// Reduce available amount in the ad
|
||||
$ad_update_stmt = $pdo->prepare("UPDATE ads SET available_amount = available_amount - :amount_crypto WHERE id = :ad_id");
|
||||
$ad_update_stmt->execute([':amount_crypto' => $amount_crypto, ':ad_id' => $ad_id]);
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
// Redirect to deals page
|
||||
header("Location: my_deals.php");
|
||||
exit;
|
||||
|
||||
} catch (PDOException $e) {
|
||||
$pdo->rollBack();
|
||||
$error = "Failed to create the deal. Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Initiate Deal</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Platform</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2">
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||
<a href="user_ads.php" class="btn btn-secondary">Back to Ads</a>
|
||||
<?php elseif ($ad): ?>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3><?php echo $ad['ad_type'] === 'SELL' ? 'Buy' : 'Sell'; ?> <?php echo htmlspecialchars($ad['currency']); ?> from <?php echo htmlspecialchars($ad['seller_nickname']); ?></h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- Ad Details -->
|
||||
<p><strong>Price:</strong> <?php echo number_format($ad['fixed_price'], 2); ?> <?php echo htmlspecialchars($ad['payment_currency']); ?> per <?php echo htmlspecialchars($ad['currency']); ?></p>
|
||||
<p><strong>Limits:</strong> <?php echo number_format($ad['min_amount'], 2); ?> - <?php echo number_format($ad['max_amount'], 2); ?> <?php echo htmlspecialchars($ad['payment_currency']); ?></p>
|
||||
<p><strong>Available:</strong> <?php echo rtrim(rtrim(number_format($ad['available_amount'], 8), '0'), '.'); ?> <?php echo htmlspecialchars($ad['currency']); ?></p>
|
||||
<p><strong>Payment Method:</strong> <?php echo htmlspecialchars($ad['bank_name']); ?></p>
|
||||
<hr>
|
||||
|
||||
<!-- Deal Form -->
|
||||
<form method="POST" action="initiate_deal.php?ad_id=<?php echo $ad_id; ?>">
|
||||
<div class="mb-3">
|
||||
<label for="amount_crypto" class="form-label">How much <?php echo htmlspecialchars($ad['currency']); ?> do you want to <?php echo $ad['ad_type'] === 'SELL' ? 'buy' : 'sell'; ?>?</label>
|
||||
<input type="number" step="0.00000001" class="form-control" id="amount_crypto" name="amount_crypto" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Start Deal</button>
|
||||
<a href="user_ads.php" class="btn btn-secondary">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
9
login.php
Normal file
9
login.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// In a real app, you would have login logic here.
|
||||
// For now, we just redirect to the main page.
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
9
logout.php
Normal file
9
logout.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// In a real app, you would have logout logic here.
|
||||
// For now, we just redirect to the main page.
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
140
my_deals.php
Normal file
140
my_deals.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
// my_deals.php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Hardcoded user ID for demonstration.
|
||||
// In a real app, you'd get this from $_SESSION['user_id']
|
||||
$current_user_id = 2; // Let's assume this is the user who is browsing their deals
|
||||
|
||||
$orders = [];
|
||||
$error = '';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
// Fetch orders where the current user is either the buyer or the seller
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT
|
||||
o.id, o.ad_id, o.amount_crypto, o.amount_fiat, o.status, o.created_at,
|
||||
b.nickname AS buyer_nickname,
|
||||
s.nickname AS seller_nickname,
|
||||
a.currency, a.payment_currency
|
||||
FROM orders o
|
||||
JOIN users b ON o.buyer_id = b.id
|
||||
JOIN users s ON o.seller_id = s.id
|
||||
JOIN ads a ON o.ad_id = a.id
|
||||
WHERE o.buyer_id = :user_id OR o.seller_id = :user_id
|
||||
ORDER BY o.created_at DESC"
|
||||
);
|
||||
$stmt->bindParam(':user_id', $current_user_id, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
$error = "Database error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
// Helper to display status with a nice badge
|
||||
function getStatusBadge($status) {
|
||||
$map = [
|
||||
'AWAITING_PAYMENT' => 'bg-warning text-dark',
|
||||
'AWAITING_SELLER_CONFIRMATION' => 'bg-info text-dark',
|
||||
'COMPLETED' => 'bg-success',
|
||||
'CANCELED' => 'bg-secondary',
|
||||
'DISPUTED' => 'bg-danger',
|
||||
'PENDING_CONFIRMATION' => 'bg-light text-dark',
|
||||
];
|
||||
$class = $map[$status] ?? 'bg-light text-dark';
|
||||
$status_text = str_replace('_', ' ', $status);
|
||||
return "<span class=\"badge {$class}\">" . htmlspecialchars($status_text) . "</span>";
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>My Deals</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Platform</a>
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item"><a class="nav-link" href="index.php">Dashboard</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="user_ads.php">Browse Ads</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-5">
|
||||
<h1 class="mb-4">My Deals</h1>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($orders)): ?>
|
||||
<div class="alert alert-info">You have no deals yet. <a href="user_ads.php">Find an ad</a> to start one.</div>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Role</th>
|
||||
<th>Deal With</th>
|
||||
<th>Amount</th>
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order):
|
||||
// Determine user's role in the deal
|
||||
$is_buyer = ($order['buyer_id'] == $current_user_id);
|
||||
$partner_nickname = $is_buyer ? $order['seller_nickname'] : $order['buyer_nickname'];
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($is_buyer):
|
||||
// User is buying
|
||||
?>
|
||||
<span class="badge bg-primary">BUYING</span>
|
||||
<?php else:
|
||||
// User is selling
|
||||
?>
|
||||
<span class="badge bg-warning text-dark">SELLING</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo htmlspecialchars($partner_nickname);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?php echo rtrim(rtrim(number_format($order['amount_crypto'], 8), '0'), '.'); ?> <?php echo htmlspecialchars($order['currency']); ?></strong>
|
||||
<br>
|
||||
<small class="text-muted"><?php echo number_format($order['amount_fiat'], 2); ?> <?php echo htmlspecialchars($order['payment_currency']); ?></small>
|
||||
</td>
|
||||
<td><?php echo getStatusBadge($order['status']); ?></td>
|
||||
<td><?php echo date("Y-m-d H:i", strtotime($order['created_at'])); ?></td>
|
||||
<td>
|
||||
<a href="#" class="btn btn-sm btn-outline-primary">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<footer class="text-center mt-5 mb-3">
|
||||
<p class="text-muted">© <?php echo date("Y"); ?> P2P Platform</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
54
profile.php
Normal file
54
profile.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$user = [
|
||||
'is_logged_in' => true,
|
||||
'nickname' => 'TestUser',
|
||||
];
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Профиль</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Платформа</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="profile.php"><i class="bi bi-person-circle"></i> <?= htmlspecialchars($user['nickname']) ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Выйти</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container mt-4">
|
||||
<h1 class="mb-4">Профиль</h1>
|
||||
<div class="alert alert-info">Эта страница находится в разработке. Здесь будет информация о вашем профиле.</div>
|
||||
<a href="index.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Назад на главную</a>
|
||||
</main>
|
||||
|
||||
<footer class="container text-center text-muted mt-5 py-3 border-top">
|
||||
<p>© P2P Platform <?= date('Y') ?></p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
126
user_ads.php
Normal file
126
user_ads.php
Normal file
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
// user_ads.php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
// Hardcoded user ID for demonstration
|
||||
$current_user_id = 1;
|
||||
|
||||
$ads = [];
|
||||
$error = '';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
// Fetch active ads, joining with users table to get seller's nickname and rating
|
||||
$stmt = $pdo->query(
|
||||
"SELECT
|
||||
a.id, a.ad_type, a.currency, a.payment_currency, a.fixed_price,
|
||||
a.available_amount, a.min_amount, a.max_amount, a.bank_name,
|
||||
u.nickname AS seller_nickname, u.rating AS seller_rating
|
||||
FROM ads a
|
||||
JOIN users u ON a.user_id = u.id
|
||||
WHERE a.status = 'ACTIVE' AND a.user_id != {$current_user_id}
|
||||
ORDER BY a.created_at DESC"
|
||||
);
|
||||
$ads = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
$error = "Database error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Browse Ads</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Platform</a>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item"><a class="nav-link" href="index.php"><i class="bi bi-house-door"></i> Dashboard</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="create_ad.php"><i class="bi bi-plus-circle"></i> Create Ad</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1>Browse Ads</h1>
|
||||
<div>
|
||||
<!-- Filter/Search form can go here in the future -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($ads)): ?>
|
||||
<div class="alert alert-info text-center">
|
||||
<p class="h4">No active ads found.</p>
|
||||
<p>Be the first to <a href="create_ad.php">create one</a>!</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="row row-cols-1 g-4">
|
||||
<?php foreach ($ads as $ad): ?>
|
||||
<div class="col">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<h5 class="card-title mb-1">
|
||||
<i class="bi bi-person-circle"></i> <?php echo htmlspecialchars($ad['seller_nickname']); ?>
|
||||
<span class="badge bg-success"><i class="bi bi-star-fill"></i> <?php echo number_format($ad['seller_rating'], 1); ?></span>
|
||||
</h5>
|
||||
<p class="card-text text-muted small">Seller</p>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<a href="initiate_deal.php?ad_id=<?php echo $ad['id']; ?>" class="btn btn-<?php echo $ad['ad_type'] === 'SELL' ? 'primary' : 'warning'; ?>">
|
||||
<?php echo $ad['ad_type'] === 'SELL' ? 'Buy' : 'Sell'; ?> <?php echo htmlspecialchars($ad['currency']); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-3">
|
||||
<span class="text-muted d-block">Price</span>
|
||||
<strong><?php echo number_format($ad['fixed_price'], 2); ?> <?php echo htmlspecialchars($ad['payment_currency']); ?></strong>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<span class="text-muted d-block">Available</span>
|
||||
<strong><?php echo rtrim(rtrim(number_format($ad['available_amount'], 8), '0'), '.'); ?> <?php echo htmlspecialchars($ad['currency']); ?></strong>
|
||||
</div>
|
||||
<div class="col-6 col-md-3 mt-3 mt-md-0">
|
||||
<span class="text-muted d-block">Limits</span>
|
||||
<strong><?php echo rtrim(rtrim(number_format($ad['min_amount'], 2), '0'), '.'); ?> - <?php echo rtrim(rtrim(number_format($ad['max_amount'], 2), '0'), '.'); ?> <?php echo htmlspecialchars($ad['payment_currency']); ?></strong>
|
||||
</div>
|
||||
<div class="col-6 col-md-3 mt-3 mt-md-0">
|
||||
<span class="text-muted d-block">Payment</span>
|
||||
<strong><?php echo htmlspecialchars($ad['bank_name']); ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<footer class="text-center mt-5 mb-3">
|
||||
<p class="text-muted">© <?php echo date("Y"); ?> P2P Platform</p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
54
user_settings.php
Normal file
54
user_settings.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$user = [
|
||||
'is_logged_in' => true,
|
||||
'nickname' => 'TestUser',
|
||||
];
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Настройки</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Платформа</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="profile.php"><i class="bi bi-person-circle"></i> <?= htmlspecialchars($user['nickname']) ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Выйти</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container mt-4">
|
||||
<h1 class="mb-4">Настройки</h1>
|
||||
<div class="alert alert-info">Эта страница находится в разработке. Здесь будут настройки вашего профиля.</div>
|
||||
<a href="index.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Назад на главную</a>
|
||||
</main>
|
||||
|
||||
<footer class="container text-center text-muted mt-5 py-3 border-top">
|
||||
<p>© P2P Platform <?= date('Y') ?></p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
54
wallet.php
Normal file
54
wallet.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
ini_set('display_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$user = [
|
||||
'is_logged_in' => true,
|
||||
'nickname' => 'TestUser',
|
||||
];
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Кошелек</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">P2P Платформа</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="profile.php"><i class="bi bi-person-circle"></i> <?= htmlspecialchars($user['nickname']) ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php"><i class="bi bi-box-arrow-right"></i> Выйти</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container mt-4">
|
||||
<h1 class="mb-4">Кошелек</h1>
|
||||
<div class="alert alert-info">Эта страница находится в разработке. Здесь будет отображаться ваш баланс и история транзакций.</div>
|
||||
<a href="index.php" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Назад на главную</a>
|
||||
</main>
|
||||
|
||||
<footer class="container text-center text-muted mt-5 py-3 border-top">
|
||||
<p>© P2P Platform <?= date('Y') ?></p>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user