| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- // 确保没有其他 PHP 逻辑会导致页面重定向
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>欠款查询系统</title>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
- <link rel="stylesheet" type="text/css" href="css/styles.css">
- </head>
- <body>
- <div class="container">
- <h1>欠款查询系统</h1>
- <form id="searchForm">
- <input type="text" id="debtorName" name="debtorName" placeholder="请输入姓名" class="search-bar" required>
- <button type="button" onclick="searchDebt()" class="button">查询</button>
- <!-- 新增记录按钮 -->
- <button type="button" id="addRecordBtn" class="button">新增记录</button>
- </form>
- <div id="result" class="result"></div>
- </div>
- <script>
- function searchDebt() {
- const debtorName = document.getElementById('debtorName').value;
- fetch(`search.php?debtorName=${encodeURIComponent(debtorName)}`)
- .then(response => response.text())
- .then(data => document.getElementById('result').innerHTML = data)
- .catch(error => console.error('查询出错:', error));
- }
- document.getElementById('addRecordBtn').addEventListener('click', function() {
- const password = prompt('请输入密码:');
- if (password === 'uKPAYkIZ2cFlKPN[') { // 使用数据库管理密码
- window.location.href = 'add_record.php';
- } else {
- alert('密码错误');
- }
- });
- </script>
- </body>
- </html>
|