38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
session_start();
|
|
require 'config.php';
|
|
require 'db.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$userId = $_SESSION['user']['id'];
|
|
$betrag = floatval($_POST['betrag']);
|
|
|
|
// Auszahlung eintragen
|
|
$stmt = $dbhandle->prepare("INSERT INTO payouts (user_id, betrag) VALUES (?, ?)");
|
|
$stmt->bind_param("id", $userId, $betrag);
|
|
$stmt->execute();
|
|
$stmt->close();
|
|
|
|
// Benachrichtigung für Admins
|
|
$message = "hat eine Auszahlung in Höhe von {$betrag}€ beantragt.";
|
|
$notif = $dbhandle->prepare("INSERT INTO notifications (user_id, message, type) VALUES (?, ?, 'payout')");
|
|
$notif->bind_param("is", $userId, $message);
|
|
$notif->execute();
|
|
$notif->close();
|
|
|
|
echo "✅ Auszahlung beantragt!";
|
|
}
|
|
?>
|
|
<?php require "header.php"?>
|
|
<head>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<form method="post">
|
|
<label>Betrag (€):</label>
|
|
<input type="number" name="betrag" step="0.01" required>
|
|
<button type="submit">Auszahlung beantragen</button>
|
|
</form>
|
|
</body>
|
|
|