diff --git a/DEPLOY.md b/DEPLOY.md new file mode 100644 index 0000000..446b577 --- /dev/null +++ b/DEPLOY.md @@ -0,0 +1,14 @@ +# Deployment Instructions + +1. **Upload Files**: Upload all files to your server (e.g., via BT Panel/宝塔). +2. **Database Setup**: + - Create a new MySQL/MariaDB database. + - Import `install.sql` into the new database. +3. **Configuration**: + - Edit `db/config.php` and update the `DB_NAME`, `DB_USER`, and `DB_PASS` with your new database credentials. +4. **Permissions**: Ensure the `uploads/` and `db/` directories are writable by the web server. + +## Features +- **Real-time Exchange Rates**: Fiat-to-USDT rates are fetched automatically. +- **Global Currencies**: Supports 30+ major global currencies with flags. +- **Admin Panel**: Accessible via `/admin`. Default login: `admin` / `admin`. diff --git a/assets/pasted-20260218-145853-27145d0f.png b/assets/pasted-20260218-145853-27145d0f.png new file mode 100644 index 0000000..7b97d1f Binary files /dev/null and b/assets/pasted-20260218-145853-27145d0f.png differ diff --git a/db/exchange_rates.json b/db/exchange_rates.json new file mode 100644 index 0000000..097b2e6 --- /dev/null +++ b/db/exchange_rates.json @@ -0,0 +1 @@ +{"USD":1,"AED":3.67,"AFN":63.59,"ALL":81.5,"AMD":377.17,"ANG":1.79,"AOA":919.5,"ARS":1452.25,"AUD":1.41,"AWG":1.79,"AZN":1.7,"BAM":1.65,"BBD":2,"BDT":122.33,"BGN":1.6,"BHD":0.376,"BIF":2969.83,"BMD":1,"BND":1.26,"BOB":6.94,"BRL":5.22,"BSD":1,"BTN":90.69,"BWP":13.48,"BYN":2.85,"BZD":2,"CAD":1.36,"CDF":2291.41,"CHF":0.77,"CLF":0.0218,"CLP":863.28,"CNH":6.9,"CNY":6.91,"COP":3672.12,"CRC":482.41,"CUP":24,"CVE":93.14,"CZK":20.5,"DJF":177.72,"DKK":6.31,"DOP":62.2,"DZD":129.91,"EGP":47.01,"ERN":15,"ETB":155.2,"EUR":0.845,"FJD":2.19,"FKP":0.738,"FOK":6.31,"GBP":0.738,"GEL":2.68,"GGP":0.738,"GHS":11.03,"GIP":0.738,"GMD":74.13,"GNF":8753.13,"GTQ":7.68,"GYD":209.29,"HKD":7.82,"HNL":26.5,"HRK":6.36,"HTG":130.99,"HUF":319.14,"IDR":16842.78,"ILS":3.1,"IMP":0.738,"INR":90.69,"IQD":1309.66,"IRR":1280515.41,"ISK":122.56,"JEP":0.738,"JMD":156.27,"JOD":0.709,"JPY":153.28,"KES":129.03,"KGS":87.44,"KHR":4015.28,"KID":1.41,"KMF":415.55,"KRW":1443.65,"KWD":0.306,"KYD":0.833,"KZT":490.62,"LAK":21622.5,"LBP":89500,"LKR":309.18,"LRD":186.33,"LSL":16.04,"LYD":6.3,"MAD":9.14,"MDL":16.98,"MGA":4361.67,"MKD":52.04,"MMK":2103.54,"MNT":3531.98,"MOP":8.05,"MRU":39.84,"MUR":45.91,"MVR":15.46,"MWK":1743.52,"MXN":17.17,"MYR":3.9,"MZN":63.79,"NAD":16.04,"NGN":1354.91,"NIO":36.86,"NOK":9.53,"NPR":145.11,"NZD":1.66,"OMR":0.384,"PAB":1,"PEN":3.35,"PGK":4.3,"PHP":57.89,"PKR":279.89,"PLN":3.56,"PYG":6529.25,"QAR":3.64,"RON":4.31,"RSD":99.11,"RUB":76.99,"RWF":1461.96,"SAR":3.75,"SBD":7.93,"SCR":14.48,"SDG":449.19,"SEK":8.98,"SGD":1.26,"SHP":0.738,"SLE":24.62,"SLL":24619.11,"SOS":570.39,"SRD":37.7,"SSP":4590.66,"STN":20.69,"SYP":112.45,"SZL":16.04,"THB":31.24,"TJS":9.39,"TMT":3.5,"TND":2.86,"TOP":2.36,"TRY":43.72,"TTD":6.8,"TVD":1.41,"TWD":31.38,"TZS":2581.08,"UAH":43.3,"UGX":3516.59,"UYU":38.86,"UZS":12158.3,"VES":396.37,"VND":25898.69,"VUV":118.27,"WST":2.67,"XAF":554.06,"XCD":2.7,"XCG":1.79,"XDR":0.726,"XOF":554.06,"XPF":100.8,"YER":238.68,"ZAR":16.04,"ZMW":18.49,"ZWG":25.59,"ZWL":25.59} \ No newline at end of file diff --git a/includes/exchange.php b/includes/exchange.php new file mode 100644 index 0000000..e61abc9 --- /dev/null +++ b/includes/exchange.php @@ -0,0 +1,94 @@ + 1, + 'EUR' => 0.92, + 'GBP' => 0.79, + 'CNY' => 7.23, + 'JPY' => 150.1, + 'HKD' => 7.82, + 'TWD' => 31.6, + 'KRW' => 1332.0 + ]; +} + +function get_rate($currency) { + $rates = get_exchange_rates(); + return $rates[$currency] ?? 1.0; +} + +function get_global_currencies() { + return [ + 'USD' => ['name' => __('usd_name'), 'flag' => '🇺🇸'], + 'EUR' => ['name' => __('eur_name'), 'flag' => '🇪🇺'], + 'GBP' => ['name' => __('gbp_name'), 'flag' => '🇬🇧'], + 'JPY' => ['name' => __('jpy_name'), 'flag' => '🇯🇵'], + 'CNY' => ['name' => __('cny_name'), 'flag' => '🇨🇳'], + 'HKD' => ['name' => __('hkd_name'), 'flag' => '🇭🇰'], + 'TWD' => ['name' => __('twd_name'), 'flag' => '🇹🇼'], + 'KRW' => ['name' => __('krw_name'), 'flag' => '🇰🇷'], + 'SGD' => ['name' => __('sgd_name'), 'flag' => '🇸🇬'], + 'MYR' => ['name' => __('myr_name'), 'flag' => '🇲🇾'], + 'THB' => ['name' => __('thb_name'), 'flag' => '🇹🇭'], + 'VND' => ['name' => __('vnd_name'), 'flag' => '🇻🇳'], + 'PHP' => ['name' => __('php_name'), 'flag' => '🇵🇭'], + 'IDR' => ['name' => __('idr_name'), 'flag' => '🇮🇩'], + 'AUD' => ['name' => __('aud_name'), 'flag' => '🇦🇺'], + 'CAD' => ['name' => __('cad_name'), 'flag' => '🇨🇦'], + 'CHF' => ['name' => __('chf_name'), 'flag' => '🇨🇭'], + 'BRL' => ['name' => __('brl_name'), 'flag' => '🇧🇷'], + 'RUB' => ['name' => __('rub_name'), 'flag' => '🇷🇺'], + 'INR' => ['name' => __('inr_name'), 'flag' => '🇮🇳'], + 'ZAR' => ['name' => __('zar_name'), 'flag' => '🇿🇦'], + 'TRY' => ['name' => __('try_name'), 'flag' => '🇹🇷'], + 'AED' => ['name' => __('aed_name'), 'flag' => '🇦🇪'], + 'SAR' => ['name' => __('sar_name'), 'flag' => '🇸🇦'], + 'MXN' => ['name' => __('mxn_name'), 'flag' => '🇲🇽'], + 'NZD' => ['name' => 'NZD', 'flag' => '🇳🇿'], + 'SEK' => ['name' => 'SEK', 'flag' => '🇸🇪'], + 'NOK' => ['name' => 'NOK', 'flag' => '🇳🇴'], + 'DKK' => ['name' => 'DKK', 'flag' => '🇩🇰'], + 'ILS' => ['name' => 'ILS', 'flag' => '🇮🇱'], + 'PLN' => ['name' => 'PLN', 'flag' => '🇵🇱'], + 'PKR' => ['name' => 'PKR', 'flag' => '🇵🇰'], + 'EGP' => ['name' => 'EGP', 'flag' => '🇪🇬'], + 'ARS' => ['name' => 'ARS', 'flag' => '🇦🇷'], + 'CLP' => ['name' => 'CLP', 'flag' => '🇨🇱'], + 'COP' => ['name' => 'COP', 'flag' => '🇨🇴'], + 'PEN' => ['name' => 'PEN', 'flag' => '🇵🇪'], + 'KWD' => ['name' => 'KWD', 'flag' => '🇰🇼'], + 'QAR' => ['name' => 'QAR', 'flag' => '🇶🇦'], + ]; +} diff --git a/includes/lang.php b/includes/lang.php index 1bbc83a..19c20f3 100644 --- a/includes/lang.php +++ b/includes/lang.php @@ -477,6 +477,20 @@ $translations = [ 'trade_pwd_updated' => '交易密码已更新', 'security_step1' => '为了您的资产安全,请务必绑定手机和邮箱,并开启谷歌验证。', 'security_step2' => '请妥善保管您的登录密码和交易密码,切勿泄露给他人。', + 'trade_password' => '交易密码', + 'aud_name' => '澳大利亚元', + 'cad_name' => '加拿大元', + 'chf_name' => '瑞士法郎', + 'brl_name' => '巴西雷亚尔', + 'rub_name' => '俄罗斯卢布', + 'inr_name' => '印度卢比', + 'zar_name' => '南非兰特', + 'try_name' => '土耳其里拉', + 'aed_name' => '阿联酋迪拉姆', + 'sar_name' => '沙特里亚尔', + 'mxn_name' => '墨西哥比索', + 'php_name' => '菲律宾比索', + 'idr_name' => '印尼盾', ], 'en' => [ 'home' => 'Home', @@ -954,6 +968,20 @@ $translations = [ 'trade_pwd_updated' => 'Trade password updated', 'security_step1' => 'For your asset security, please bind your phone and email, and enable Google Verification.', 'security_step2' => 'Please keep your login and trade passwords safe and never disclose them to others.', + 'trade_password' => 'Trade Password', + 'aud_name' => 'AUD', + 'cad_name' => 'CAD', + 'chf_name' => 'CHF', + 'brl_name' => 'BRL', + 'rub_name' => 'RUB', + 'inr_name' => 'INR', + 'zar_name' => 'ZAR', + 'try_name' => 'TRY', + 'aed_name' => 'AED', + 'sar_name' => 'SAR', + 'mxn_name' => 'MXN', + 'php_name' => 'PHP', + 'idr_name' => 'IDR', ], ]; diff --git a/install.sql b/install.sql new file mode 100644 index 0000000..ef66cdc --- /dev/null +++ b/install.sql @@ -0,0 +1,551 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: 127.0.0.1 Database: app_38451 +-- ------------------------------------------------------ +-- Server version 10.11.14-MariaDB-0+deb12u2 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `admins` +-- + +DROP TABLE IF EXISTS `admins`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `admins` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(50) NOT NULL, + `password_hash` varchar(255) NOT NULL, + `role` varchar(20) DEFAULT 'admin', + `created_at` timestamp NULL DEFAULT current_timestamp(), + `is_agent` tinyint(4) DEFAULT 0, + `permissions` text DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `admins` +-- + +LOCK TABLES `admins` WRITE; +/*!40000 ALTER TABLE `admins` DISABLE KEYS */; +INSERT INTO `admins` VALUES +(1,'admin','$2y$10$uJvcqHNb.naRWj.apBapi.C.fF2zaIbMhYEtVdGmmVUWZkQi9ESfe','admin','2026-02-18 03:07:35',0,NULL); +/*!40000 ALTER TABLE `admins` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `binary_orders` +-- + +DROP TABLE IF EXISTS `binary_orders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `binary_orders` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `symbol` varchar(20) NOT NULL, + `direction` varchar(10) DEFAULT NULL, + `amount` decimal(20,8) NOT NULL, + `duration` int(11) NOT NULL, + `profit_rate` decimal(5,2) NOT NULL, + `entry_price` decimal(20,8) NOT NULL, + `close_price` decimal(20,8) DEFAULT NULL, + `status` enum('pending','won','lost','cancelled') DEFAULT 'pending', + `control_status` tinyint(4) DEFAULT 0 COMMENT '0: normal, 1: force win, 2: force loss', + `created_at` timestamp NULL DEFAULT current_timestamp(), + `end_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `binary_orders` +-- + +LOCK TABLES `binary_orders` WRITE; +/*!40000 ALTER TABLE `binary_orders` DISABLE KEYS */; +INSERT INTO `binary_orders` VALUES +(1,2,'BTC','up',100.00000000,60,8.00,67652.01000000,68328.53010000,'won',1,'2026-02-18 06:00:25','2026-02-18 08:00:59'), +(2,2,'BTC','down',100.00000000,60,8.00,67788.80000000,67110.91200000,'won',1,'2026-02-18 06:16:43','2026-02-18 08:00:59'), +(3,2,'BTC','up',1000.00000000,60,8.00,67879.37000000,68558.16370000,'won',1,'2026-02-18 06:40:10','2026-02-18 08:00:59'), +(4,2,'BTC','up',500.00000000,60,8.00,67839.92000000,68518.31920000,'won',1,'2026-02-18 06:57:02','2026-02-18 08:00:59'), +(5,2,'BTC','up',100.00000000,60,8.00,67813.14000000,68491.27140000,'won',1,'2026-02-18 07:07:26','2026-02-18 08:00:59'), +(6,2,'BTC','down',100.00000000,60,8.00,67770.32000000,67092.61680000,'won',1,'2026-02-18 07:17:26','2026-02-18 08:00:59'), +(7,2,'BTC','down',100.00000000,60,8.00,67753.40000000,67075.86600000,'won',1,'2026-02-18 07:22:09','2026-02-18 08:00:59'), +(8,2,'BTC','up',100.00000000,60,8.00,67756.31000000,68433.87310000,'won',1,'2026-02-18 07:27:16','2026-02-18 08:01:00'), +(9,2,'BTC','down',100.00000000,60,8.00,67798.67000000,67120.68330000,'won',1,'2026-02-18 07:33:08','2026-02-18 08:01:00'), +(10,2,'BTC','down',100.00000000,60,8.00,68073.40000000,67392.66600000,'won',1,'2026-02-18 07:44:11','2026-02-18 08:01:00'), +(11,2,'BTC','up',100.00000000,60,8.00,68158.35000000,68839.93350000,'won',1,'2026-02-18 07:50:39','2026-02-18 08:01:00'), +(12,2,'BTC','up',100.00000000,60,8.00,68142.00000000,68823.42000000,'won',1,'2026-02-18 08:02:35','2026-02-18 08:03:35'), +(13,2,'BTC','down',100.00000000,60,8.00,68175.65000000,68169.15000000,'won',1,'2026-02-18 08:37:39','2026-02-18 08:38:40'); +/*!40000 ALTER TABLE `binary_orders` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `contract_orders` +-- + +DROP TABLE IF EXISTS `contract_orders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `contract_orders` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `symbol` varchar(20) NOT NULL, + `type` enum('limit','market') DEFAULT 'market', + `direction` varchar(10) DEFAULT NULL, + `leverage` int(11) DEFAULT 1, + `amount` decimal(20,8) NOT NULL, + `entry_price` decimal(20,8) DEFAULT NULL, + `close_price` decimal(20,8) DEFAULT NULL, + `status` enum('open','closed','cancelled') DEFAULT 'open', + `profit` decimal(20,8) DEFAULT 0.00000000, + `control_status` tinyint(4) DEFAULT 0 COMMENT '0: normal, 1: force win, 2: force loss', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `contract_orders` +-- + +LOCK TABLES `contract_orders` WRITE; +/*!40000 ALTER TABLE `contract_orders` DISABLE KEYS */; +/*!40000 ALTER TABLE `contract_orders` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `exchange_records` +-- + +DROP TABLE IF EXISTS `exchange_records`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `exchange_records` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `from_symbol` varchar(10) NOT NULL, + `to_symbol` varchar(10) NOT NULL, + `from_amount` decimal(20,8) NOT NULL, + `to_amount` decimal(20,8) NOT NULL, + `rate` decimal(20,8) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `exchange_records` +-- + +LOCK TABLES `exchange_records` WRITE; +/*!40000 ALTER TABLE `exchange_records` DISABLE KEYS */; +/*!40000 ALTER TABLE `exchange_records` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `finance_requests` +-- + +DROP TABLE IF EXISTS `finance_requests`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `finance_requests` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `type` enum('recharge','withdrawal') NOT NULL, + `amount` decimal(20,8) NOT NULL, + `symbol` varchar(10) DEFAULT 'USDT', + `status` enum('pending','approved','rejected') DEFAULT 'pending', + `payment_method` varchar(50) DEFAULT NULL, + `payment_details` text DEFAULT NULL, + `rejection_reason` text DEFAULT NULL, + `tx_hash` varchar(255) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `fiat_amount` decimal(20,2) DEFAULT NULL, + `fiat_currency` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `finance_requests` +-- + +LOCK TABLES `finance_requests` WRITE; +/*!40000 ALTER TABLE `finance_requests` DISABLE KEYS */; +INSERT INTO `finance_requests` VALUES +(1,2,'recharge',209.64000000,'USDT','approved','Fiat (MYR)',NULL,NULL,'','2026-02-18 04:45:54','2026-02-18 04:46:29',NULL,NULL), +(2,2,'recharge',10.00000000,'USDT','approved','Fiat (MYR)',NULL,NULL,'','2026-02-18 06:15:15','2026-02-18 06:16:15',NULL,NULL), +(3,2,'recharge',10.00000000,'USDT','approved','Fiat (MYR)',NULL,NULL,'','2026-02-18 06:33:05','2026-02-18 06:33:17',NULL,NULL), +(4,2,'recharge',10.00000000,'USDT','approved','Fiat (MYR: 50000)',NULL,NULL,'','2026-02-18 06:37:57','2026-02-18 06:38:22',NULL,NULL), +(5,2,'recharge',209.64000000,'USDT','approved','Fiat (MYR)',NULL,NULL,'','2026-02-18 06:54:02','2026-02-18 06:54:16',1000.00,'MYR'), +(6,2,'withdrawal',9249.28000000,'USDT','approved',NULL,'Fiat (MYR)',NULL,NULL,'2026-02-18 06:54:44','2026-02-18 06:54:58',44119.07,'MYR'), +(7,2,'recharge',10000.00000000,'USDT','approved','Fiat (USD)',NULL,NULL,'','2026-02-18 06:56:22','2026-02-18 06:56:45',10000.00,'USD'), +(8,2,'recharge',100.00000000,'USDT','approved','Fiat (USD)',NULL,NULL,'','2026-02-18 07:09:10','2026-02-18 07:10:11',100.00,'USD'), +(9,2,'withdrawal',1000.00000000,'USDT','approved',NULL,'Fiat (USD)',NULL,NULL,'2026-02-18 08:13:47','2026-02-18 08:14:10',1000.00,'USD'), +(10,2,'recharge',100.00000000,'USDT','approved','Fiat (USD)',NULL,NULL,'','2026-02-18 09:05:05','2026-02-18 09:05:52',100.00,'USD'), +(11,2,'withdrawal',100.00000000,'USDT','approved',NULL,'Fiat (USD)',NULL,NULL,'2026-02-18 09:06:13','2026-02-18 09:06:48',100.00,'USD'), +(12,2,'recharge',209.64000000,'USDT','approved','Fiat (MYR)',NULL,NULL,'','2026-02-18 09:26:51','2026-02-18 09:27:12',1000.00,'MYR'), +(13,2,'withdrawal',700.00000000,'USDT','approved',NULL,'Fiat (USD)',NULL,NULL,'2026-02-18 09:27:38','2026-02-18 09:27:52',700.00,'USD'), +(14,2,'recharge',746.27000000,'USDT','approved','Fiat (SGD)',NULL,NULL,'','2026-02-18 11:17:06','2026-02-18 11:18:57',1000.00,'SGD'), +(15,2,'withdrawal',1000.00000000,'USDT','approved',NULL,'Fiat (MYR)',NULL,NULL,'2026-02-18 11:18:24','2026-02-18 11:19:04',4770.00,'MYR'), +(16,2,'recharge',1000.00000000,'USDT','approved','TRC20',NULL,NULL,'','2026-02-18 11:21:13','2026-02-18 11:21:33',NULL,NULL), +(17,2,'recharge',746.26865672,'USDT','approved','Fiat (SGD)',NULL,NULL,'','2026-02-18 11:41:32','2026-02-18 11:41:46',1000.00,'SGD'); +/*!40000 ALTER TABLE `finance_requests` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `messages` +-- + +DROP TABLE IF EXISTS `messages`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `messages` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) DEFAULT NULL, + `admin_id` int(11) DEFAULT NULL, + `sender` enum('user','admin') DEFAULT NULL, + `message` text DEFAULT NULL, + `ip_address` varchar(45) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `messages` +-- + +LOCK TABLES `messages` WRITE; +/*!40000 ALTER TABLE `messages` DISABLE KEYS */; +INSERT INTO `messages` VALUES +(1,1,NULL,'user','1','::1','2026-02-16 03:27:13'), +(2,1,1,'admin','1','::1','2026-02-16 03:27:24'), +(3,1,NULL,'user','1','::1','2026-02-16 05:05:24'), +(4,1,1,'admin','你好','::1','2026-02-16 05:05:50'), +(5,1,NULL,'user','[Recharge Request]Fiat Amount: 1000 CNYEstimated USDT: 139.08 USDTPlease provide payment details.','::1','2026-02-16 06:43:24'), +(6,1,NULL,'user','1','::1','2026-02-18 03:03:47'), +(7,1,1,'admin','222','::1','2026-02-18 03:04:14'), +(8,2,NULL,'user','【充值】类型:法币充值金额:1000 MYR预计到账 USDT:209.64 USDT','::1','2026-02-18 03:21:37'), +(9,2,NULL,'user','【充值】类型:法币充值金额:1000 MYR预计到账 USDT:209.64 USDT','::1','2026-02-18 04:45:54'), +(10,2,2,'admin','11','::1','2026-02-18 09:00:56'), +(11,2,NULL,'user','你好手上','::1','2026-02-18 09:04:32'), +(12,2,1,'admin','你好','::1','2026-02-18 09:04:43'), +(13,2,NULL,'user','[RECHARGE REQUEST]------------------Type: Fiat RechargeAmount: 100 USDRate: 1 USDT = 1 USDEst. USDT: 100.00 USDTStatus: Pending Approval------------------Please confirm my deposit.','::1','2026-02-18 09:05:05'), +(14,2,NULL,'user','[WITHDRAWAL REQUEST]------------------Type: Fiat WithdrawalAmount: 100.00 USDTRate: 1 USDT = 1 USDTo Receive: 100.00 USD------------------Please process my fiat withdrawal.','::1','2026-02-18 09:06:13'), +(15,2,1,'admin','2222','::1','2026-02-18 09:21:27'), +(16,2,NULL,'user','2222','::1','2026-02-18 09:21:34'), +(17,2,NULL,'user','1','::1','2026-02-18 09:21:37'), +(18,2,1,'admin','123','::1','2026-02-18 09:25:25'), +(19,2,NULL,'user','321','::1','2026-02-18 09:25:32'), +(20,2,NULL,'user','recharge_msg_fiat','::1','2026-02-18 09:26:52'), +(21,2,NULL,'user','withdraw_msg_fiat','::1','2026-02-18 09:27:38'), +(22,2,NULL,'user','用户ID:05617613 申请充值金额:1000 SGD=1.34USDT','::1','2026-02-18 11:17:06'), +(23,2,1,'admin','1','::1','2026-02-18 11:17:41'), +(24,2,NULL,'user','用户ID:05617613 申请提现金额:1000.00 MYR=4.77USDT','::1','2026-02-18 11:18:24'), +(25,2,NULL,'user','用户ID:05617613 申请充值金额:1000 USDT (TRC20)','::1','2026-02-18 11:21:13'), +(26,2,NULL,'user','用户ID:05617613 申请充值金额:1000 SGD=746.2687USDT','::1','2026-02-18 11:41:32'), +(27,0,NULL,'user','你好手上','::1','2026-02-18 13:40:18'); +/*!40000 ALTER TABLE `messages` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `price_controls` +-- + +DROP TABLE IF EXISTS `price_controls`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `price_controls` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `symbol` varchar(20) NOT NULL, + `target_price` decimal(20,8) NOT NULL, + `execution_time` timestamp NOT NULL, + `duration` int(11) DEFAULT 60 COMMENT 'seconds', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `price_controls` +-- + +LOCK TABLES `price_controls` WRITE; +/*!40000 ALTER TABLE `price_controls` DISABLE KEYS */; +/*!40000 ALTER TABLE `price_controls` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spot_orders` +-- + +DROP TABLE IF EXISTS `spot_orders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `spot_orders` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `symbol` varchar(20) NOT NULL, + `side` enum('buy','sell') NOT NULL, + `price` decimal(20,8) DEFAULT NULL, + `amount` decimal(20,8) NOT NULL, + `filled` decimal(20,8) DEFAULT 0.00000000, + `status` enum('pending','filled','cancelled') DEFAULT 'pending', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spot_orders` +-- + +LOCK TABLES `spot_orders` WRITE; +/*!40000 ALTER TABLE `spot_orders` DISABLE KEYS */; +/*!40000 ALTER TABLE `spot_orders` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `staking_records` +-- + +DROP TABLE IF EXISTS `staking_records`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `staking_records` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `plan_name` varchar(100) NOT NULL, + `amount` decimal(20,8) NOT NULL, + `symbol` varchar(10) DEFAULT 'USDT', + `daily_profit` decimal(5,2) NOT NULL, + `period` int(11) NOT NULL COMMENT 'days', + `status` enum('running','ended') DEFAULT 'running', + `start_date` date NOT NULL, + `end_date` date NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `staking_records` +-- + +LOCK TABLES `staking_records` WRITE; +/*!40000 ALTER TABLE `staking_records` DISABLE KEYS */; +/*!40000 ALTER TABLE `staking_records` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `system_settings` +-- + +DROP TABLE IF EXISTS `system_settings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `system_settings` ( + `setting_key` varchar(50) NOT NULL, + `setting_value` text DEFAULT NULL, + PRIMARY KEY (`setting_key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `system_settings` +-- + +LOCK TABLES `system_settings` WRITE; +/*!40000 ALTER TABLE `system_settings` DISABLE KEYS */; +INSERT INTO `system_settings` VALUES +('android_download_url','/downloads/byro.apk'), +('apk_download_url','/downloads/byro.apk'), +('email_verification_enabled','0'), +('ios_download_url','/downloads/byro.apk'), +('mail_from_email',''), +('mail_from_name','Byro Exchange'), +('service_link',''), +('site_logo',''), +('site_name','Byro'), +('smtp_host',''), +('smtp_pass',''), +('smtp_port','587'), +('smtp_secure','tls'), +('smtp_user',''), +('usdt_bep20_address','0x742d35Cc6634C0532925a3b844Bc454e4438f44e'), +('usdt_erc20_address','0x742d35Cc6634C0532925a3b844Bc454e4438f44e'), +('usdt_protocol','TRC20'), +('usdt_recharge_address',''), +('usdt_trc20_address','TYv9V5J1P1eEwz7y3WqJg9M2yv7f7xXv3x'); +/*!40000 ALTER TABLE `system_settings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `transactions` +-- + +DROP TABLE IF EXISTS `transactions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `type` varchar(20) NOT NULL, + `amount` decimal(20,8) NOT NULL, + `symbol` varchar(10) NOT NULL, + `status` varchar(20) DEFAULT 'completed', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `transactions` +-- + +LOCK TABLES `transactions` WRITE; +/*!40000 ALTER TABLE `transactions` DISABLE KEYS */; +INSERT INTO `transactions` VALUES +(1,1,'deposit',5000.00000000,'USDT','completed','2026-02-15 15:40:31'), +(2,1,'deposit',1000.00000000,'USDT','completed','2026-02-15 15:45:53'), +(3,2,'recharge',209.64000000,'USDT','completed','2026-02-18 04:46:29'), +(4,2,'recharge',10.00000000,'USDT','completed','2026-02-18 06:16:15'), +(5,2,'recharge',10.00000000,'USDT','completed','2026-02-18 06:33:17'), +(6,2,'recharge',10.00000000,'USDT','completed','2026-02-18 06:38:22'), +(7,2,'recharge',209.64000000,'USDT','completed','2026-02-18 06:54:16'), +(8,2,'withdrawal',9249.28000000,'USDT','pending','2026-02-18 06:54:44'), +(9,2,'recharge',10000.00000000,'USDT','completed','2026-02-18 06:56:45'), +(10,2,'recharge',100.00000000,'USDT','completed','2026-02-18 07:10:11'), +(11,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:00:59'), +(12,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:00:59'), +(13,2,'binary_win',1080.00000000,'USDT','completed','2026-02-18 08:00:59'), +(14,2,'binary_win',540.00000000,'USDT','completed','2026-02-18 08:00:59'), +(15,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:00:59'), +(16,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:00:59'), +(17,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:01:00'), +(18,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:01:00'), +(19,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:01:00'), +(20,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:01:00'), +(21,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:01:00'), +(22,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:03:35'), +(23,2,'withdrawal',1000.00000000,'USDT','completed','2026-02-18 08:13:47'), +(24,2,'binary_win',108.00000000,'USDT','completed','2026-02-18 08:38:40'), +(25,2,'recharge',100.00000000,'USDT','completed','2026-02-18 09:05:52'), +(26,2,'withdrawal',100.00000000,'USDT','completed','2026-02-18 09:06:13'), +(27,2,'recharge',209.64000000,'USDT','completed','2026-02-18 09:27:12'), +(28,2,'withdrawal',700.00000000,'USDT','completed','2026-02-18 09:27:38'), +(29,2,'withdrawal',1000.00000000,'USDT','completed','2026-02-18 11:18:24'), +(30,2,'recharge',746.27000000,'USDT','completed','2026-02-18 11:18:57'), +(31,2,'recharge',1000.00000000,'USDT','completed','2026-02-18 11:21:33'), +(32,2,'recharge',746.26865672,'USDT','completed','2026-02-18 11:41:46'); +/*!40000 ALTER TABLE `transactions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_balances` +-- + +DROP TABLE IF EXISTS `user_balances`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `user_balances` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `symbol` varchar(10) NOT NULL, + `available` decimal(20,8) DEFAULT 0.00000000, + `frozen` decimal(20,8) DEFAULT 0.00000000, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`symbol`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_balances` +-- + +LOCK TABLES `user_balances` WRITE; +/*!40000 ALTER TABLE `user_balances` DISABLE KEYS */; +INSERT INTO `user_balances` VALUES +(1,1,'USDT',6000.00000000,0.00000000), +(6,2,'USDT',11510.17865672,0.00000000); +/*!40000 ALTER TABLE `user_balances` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(50) DEFAULT NULL, + `email` varchar(100) DEFAULT NULL, + `password_hash` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + `uid` varchar(20) DEFAULT NULL, + `credit_score` int(11) DEFAULT 80, + `real_name_status` int(11) DEFAULT 0, + `role` varchar(20) DEFAULT 'user', + `total_recharge` decimal(16,4) DEFAULT 0.0000, + `transaction_password` varchar(255) DEFAULT NULL, + `kyc_name` varchar(100) DEFAULT NULL, + `kyc_id_number` varchar(50) DEFAULT NULL, + `kyc_photo_front` varchar(255) DEFAULT NULL, + `kyc_photo_back` varchar(255) DEFAULT NULL, + `kyc_photo_handheld` varchar(255) DEFAULT NULL, + `kyc_status` int(11) DEFAULT 0 COMMENT '0: Unverified, 1: Pending, 2: Verified, 3: Rejected', + `registration_ip` varchar(45) DEFAULT NULL, + `status` enum('normal','frozen') DEFAULT 'normal', + `win_loss_control` tinyint(4) DEFAULT 0 COMMENT '0: normal, 1: win, 2: loss', + `remark` text DEFAULT NULL, + `kyc_rejection_reason` text DEFAULT NULL, + `agent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`), + UNIQUE KEY `email` (`email`), + UNIQUE KEY `uid` (`uid`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES +(2,'ahao8988998','ahao8988@gmail.com','$2y$10$tdT4vIgddq1kh2isoBRIPe4goiZ3X1cbf2l6vtButmyZx71xP527q','2026-02-18 02:56:51','05617613',80,0,'user',0.0000,NULL,'张世豪','123456789','uploads/kyc/2_front_1771391536.jpg','uploads/kyc/2_back_1771391536.jpg','uploads/kyc/2_handheld_1771391536.jpg',2,NULL,'normal',1,'',NULL,NULL); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2026-02-18 15:07:12 diff --git a/recharge.php b/recharge.php index 49d82a6..4ec25c1 100644 --- a/recharge.php +++ b/recharge.php @@ -1,11 +1,15 @@ query("SELECT setting_key, setting_value FROM system_settings"); $settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR); @@ -52,18 +56,13 @@ $bep20_addr = $settings['usdt_bep20_address'] ?? '0x742d35Cc6634C0532925a3b844Bc
diff --git a/withdraw.php b/withdraw.php index 910b8af..4d32c68 100644 --- a/withdraw.php +++ b/withdraw.php @@ -1,11 +1,14 @@ prepare("SELECT available FROM user_balances WHERE user_id = ? AND symbol = 'USDT'"); $stmt->execute([$user['id']]); $bal = $stmt->fetch(); @@ -110,14 +113,13 @@ $available = $bal['available'] ?? 0;