-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask_complete.php
More file actions
31 lines (27 loc) · 817 Bytes
/
Copy pathtask_complete.php
File metadata and controls
31 lines (27 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// task_complete.php
include 'db.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$escrowId = $_POST['escrow_id'];
$posterConfirmation = $_POST['poster_confirmation'];
if ($posterConfirmation === "yes") {
// Release payment to the provider
$stmt = $conn->prepare("
UPDATE users AS u
JOIN escrow AS e ON u.id = e.service_provider_id
SET u.wallet_balance = u.wallet_balance + e.amount, e.status = 'Completed'
WHERE e.id = ?
");
$stmt->bind_param("i", $escrowId);
if ($stmt->execute()) {
echo "Payment released successfully.";
} else {
echo "Error: " . $stmt->error;
}
} else {
echo "Task not confirmed.";
}
$stmt->close();
$conn->close();
}
?>