Editing: /home/goacom/public_html/scratch_extract/add.php
<?php /* * DATABASE CONFIGURATION */ $host = 'localhost'; $db = 'tishanw1_melbets'; $user = 'tishanw1_melbets'; $pass = 'tishanw1_melbets'; $charset = 'utf8mb4'; // Simulating a logged-in user ID $current_user_id = 1; // Database Connection $mysqli = new mysqli($host, $user, $pass, $db); if ($mysqli->connect_error) { die("Connection failed: " . $mysqli->connect_error); } // --- PROCESS SUBMISSION --- if ($_SERVER['REQUEST_METHOD'] === 'POST') { $group = $_POST['wallet_group'] ?? 'Cash'; $name = $_POST['account_name'] ?? ''; $number = $_POST['account_number'] ?? ''; if (!empty($name) && !empty($number)) { // FIXED: Changed 'account_holder' to 'account_name' to match your SQL table $stmt = $mysqli->prepare("INSERT INTO user_withdrawal_methods (user_id, method_name, account_name, account_number, created_at) VALUES (?, ?, ?, ?, NOW())"); $stmt->bind_param("isss", $current_user_id, $group, $name, $number); if ($stmt->execute()) { // Redirect back to withdrawal page on success header("Location: lifting.php"); exit(); } else { $error = "Error adding wallet. Please try again."; } } else { $error = "Please fill in all fields."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="description" content="MELBETE - Add Wallet" /> <title>MELBETE - Add Wallet</title> <link rel="stylesheet" href="index.css" /> <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap" rel="stylesheet" /> <style> body { margin: 0; padding: 0; font-family: 'Outfit', sans-serif; background-color: #f5f5f5; } .active-cash { background: rgba(255, 48, 57, 0.06) !important; border: 1px solid #ff3039 !important; color: black; } .active-dev { background: #efefef !important; border: 1px solid #0003 !important; color: black; } .inactive { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; } </style> </head> <body> <!-- Main Container --> <div class="fixed inset-0 z-50"> <div class="flex flex-col text-gray-800 p-4 max-w-md mx-auto relative h-full" style="background-color: rgb(245, 245, 249);"> <!-- Close Button --> <a href="lifting.php" class="absolute top-4 right-4 z-10 p-1"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18 6L6 18M6 6L18 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg> </a> <div class="pt-10"></div> <h2 class="text-gray-600 text-base mb-4">Select e-wallet group</h2> <div class="mb-6 flex w-[120px]"> <div class="w-full border-[#ff3039] rounded-lg p-1 flex items-center justify-center" style="border-width: 1px; background: rgba(255, 48, 57, 0.06);"> <img alt="" src="/ewallet.webp" style="height: 42px;"> </div> </div> <div class="p-2 rounded-lg bg-white" style="border: 1px solid rgba(0, 0, 0, 0.2);"> <div class="mb-6"> <h3 class="text-gray-600 text-base mb-3">Types of e-wallets</h3> <div class="flex justify-evenly gap-3"> <button type="button" onclick="selectWallet('cash', this)" id="btn-cash" class="px-4 py-3 flex-1 rounded-lg text-medium transition-colors active-cash"> Cash </button> <button type="button" onclick="selectWallet('dev', this)" id="btn-dev" class="px-4 py-3 flex-1 rounded-lg text-medium transition-colors inactive"> Development </button> </div> </div> <form action="add.php" method="POST" id="walletForm"> <input type="hidden" name="wallet_group" id="wallet_group" value="Cash"> <div class="mb-4"> <div class="relative"> <div class="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" class="icon" fill="#a5a5a5"><path d="M93.55 161.73c4.05-0.97 8.24-1.15 12.39-1.23 269.69 0 539.38 0.01 809.06 0 8.19-0.14 16.71 0.26 24.15 4.06 14.22 6.53 23.61 21.8 23.34 37.4 0.04 205.67-0.01 411.33 0.02 616.99 0.13 7.23-0.77 14.65-4.05 21.18-5.87 12.62-18.66 21.74-32.54 23.01-6.97 0.65-13.98 0.26-20.96 0.36H112c-7.23-0.01-14.68 0.25-21.6-2.15-12.31-3.94-22.36-14.16-26.18-26.5-1.59-4.77-1.91-9.83-1.97-14.82v-610.1c-0.03-7.43-0.23-15.11 2.44-22.18 4.42-12.81 15.67-22.93 28.86-26.02m5.57 27.36c-5.08 1.52-8.9 6.56-8.87 11.88 0 207.36-0.01 414.72 0.01 622.07 0 5.08 3.45 9.88 8.19 11.64 3.05 1.18 6.38 0.76 9.57 0.83 271.35-0.03 542.71 0.02 814.06-0.03 6.62 0.05 12.53-5.9 12.43-12.51-0.02-207.33-0.02-414.65 0-621.98 0.08-6.65-5.91-12.63-12.58-12.48-271.33-0.03-542.66 0.01-813.99-0.01-2.94 0.04-5.97-0.29-8.82 0.59z"></path><path d="M278.55 308.63c13.61-9.15 30.02-14.29 46.46-13.92 18.67-0.04 37.05 7.09 51.46 18.84 19.84 16.02 32.36 40.24 35.42 65.43 4.81 35.33-10.91 72.16-38.43 94.48-4.94 3.92-10.61 6.93-14.99 11.55 1.66 2.11 4.16 3.17 6.69 3.82 31.85 6.8 61.46 24.75 81.29 50.71 12.32 16.12 20.74 35.32 23.53 55.46 1.57 9.85 0.87 19.84 1.01 29.76-92.74-0.01-185.49-0.01-278.23 0 0.06-9.96-0.41-19.97 1.09-29.85 2.93-21.85 12.41-42.66 26.53-59.55 17.2-20.83 41.08-35.54 66.71-43.63 2.35-0.93 5.52-0.86 7.24-2.71-0.35-4.27-4.75-6.37-8.03-8.24-19.24-10.01-34.33-27.24-42.58-47.23-10.62-25.58-10.9-55.37-0.4-81.03 7.12-17.64 19.35-33.33 35.23-43.89m28.7 16.65c-14.75 4.89-26.84 16.15-34.28 29.62-10.86 19.64-12.49 44.07-4.55 65.03 5.55 15.09 16.3 28.45 30.57 36.08 7.31 3.92 14.25 9.12 18.53 16.38 5.36 8.62 5.93 19.89 1.81 29.13-2.71 5.92-7.81 10.53-13.63 13.3-4.73 2.33-10.01 3.11-14.88 5.06-18.52 6.51-35.68 17.48-48.37 32.56-10.75 12.54-18.1 28-20.76 44.32 73.45-0.01 146.91-0.02 220.36 0.01a87.508 87.508 0 0 0-6.45-21.36c-13.75-30.85-43.98-52.72-76.73-59.35-7.88-1.93-15.42-5.94-20.75-12.15-7.96-8.86-9.44-22.94-3.32-33.19 5.06-8.54 13.93-13.55 21.67-19.3 12.77-10.34 21.7-25.07 25.98-40.85 4.11-15.19 2.81-31.59-2.71-46.26-5.91-15.52-17.29-29.34-32.46-36.52-12.35-5.98-27.03-6.95-40.03-2.51zM547.21 375.75c0.24-9.36-0.06-18.71 0.16-28.06 51.54 0.26 103.09 0.03 154.63 0.11 42.45-0.04 84.89 0.09 127.34-0.07-0.07 9.31-0.11 18.62 0.02 27.93-94.05 0.03-188.1-0.14-282.15 0.09zM547.25 554.6c0.1-9.34 0.04-18.67 0.03-28.01 55.25 0.16 110.51 0.02 165.76 0.07 38.79-0.08 77.59 0.15 116.39-0.11-0.26 9.32-0.18 18.67-0.04 28-94.05-0.05-188.1-0.14-282.14 0.05zM185.94 697.81c214.47-0.04 428.93 0.09 643.39-0.06-0.05 9.3-0.1 18.61 0.03 27.92-214.47-0.03-428.94 0-643.42-0.01 0.01-9.29 0.01-18.57 0-27.85z"></path></svg> </div> <input name="account_name" placeholder="* Full name of the recipient" class="text-[18px] bg-[#efefef] w-full pl-12 pr-4 py-3 border border-gray-300 rounded-lg focus:border-gray-600" type="text" value="" required> </div> </div> <div class="mb-4 rounded-lg"> <p class="text-[#ff0000] text-md font-bold">The name you provide must exactly match the name registered with your financial provider, otherwise the transaction may fail. Once the name is submitted, it cannot be changed.</p> </div> <div class="mb-4"> <div class="relative"> <div class="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" class="icon" fill="#a5a5a5"><path d="M851.538113 216.943984 172.460864 216.943984c-25.529443 0-46.300512 22.687722-46.300512 50.581002l0 488.949005c0 27.903513 20.772093 50.581002 46.300512 50.581002L851.538113 807.054993c25.533536 0 46.300512-22.678512 46.300512-50.581002L897.838625 267.524986C897.839649 239.631706 877.071649 216.943984 851.538113 216.943984zM866.971617 756.473991c0 9.296737-6.91755 16.868179-15.433504 16.868179L172.460864 773.34217c-8.515954 0-15.433504-7.571443-15.433504-16.868179L157.027359 503.573073l709.944258 0L866.971617 756.473991zM866.971617 368.688014 157.027359 368.688014l0-101.163027c0-9.30083 6.91755-16.85897 15.433504-16.85897L851.538113 250.666016c8.515954 0 15.433504 7.55814 15.433504 16.85897L866.971617 368.688014zM758.937089 621.599164 542.867008 621.599164l0 33.712823 216.07008 0L758.937089 621.599164z"></path></svg> </div> <input name="account_number" placeholder="* Please enter account number" class="text-[18px] bg-[#efefef] w-full pl-12 pr-4 py-3 border border-gray-300 rounded-lg focus:border-gray-600" type="number" value="" required> </div> </div> <button type="submit" class="w-full py-3 rounded-lg text-lg font-medium transition-colors bg-[#f06827] text-white"> Submit </button> </form> <?php if(isset($error)): ?> <p class="text-red-500 text-center mt-4"><?php echo $error; ?></p> <?php endif; ?> </div> </div> </div> <script> function selectWallet(type, btn) { const groupInput = document.getElementById('wallet_group'); groupInput.value = (type === 'cash') ? 'Cash' : 'Development'; const btnCash = document.getElementById('btn-cash'); const btnDev = document.getElementById('btn-dev'); if (type === 'cash') { btnCash.className = "px-4 py-3 flex-1 rounded-lg text-medium transition-colors active-cash"; btnDev.className = "px-4 py-3 flex-1 rounded-lg text-medium transition-colors inactive"; } else { btnCash.className = "px-4 py-3 flex-1 rounded-lg text-medium transition-colors inactive"; btnDev.className = "px-4 py-3 flex-1 rounded-lg text-medium transition-colors active-dev"; } } </script> </body> </html>
💾 Save