Download save_fingerprint.php from multibiz/finger: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/multibiz/finger/resolve/main/save_fingerprint.php
- Command line
-
hf download hf://spaces/multibiz/finger/save_fingerprint.php
-
curl -L -o save_fingerprint.php https://huggingface.co/spaces/multibiz/finger/resolve/main/save_fingerprint.php
1.41 kB
| ```php | |
| require_once 'db_connect.php'; | |
| if ($_SERVER['REQUEST_METHOD'] === 'POST') { | |
| $customerId = $_POST['customer_id'] ?? ''; | |
| $customerName = $_POST['customer_name'] ?? ''; | |
| $customerEmail = $_POST['customer_email'] ?? ''; | |
| $fingerprintData = $_POST['fingerprint_data'] ?? ''; | |
| if (empty($customerId) || empty($customerName) || empty($fingerprintData)) { | |
| die(json_encode(['error' => 'Missing required fields'])); | |
| } | |
| try { | |
| // Check if customer already exists | |
| $stmt = $pdo->prepare("SELECT customer_id FROM customers WHERE customer_id = ?"); | |
| $stmt->execute([$customerId]); | |
| if ($stmt->rowCount() > 0) { | |
| die(json_encode(['error' => 'Customer ID already exists'])); | |
| } | |
| // Insert new record | |
| $stmt = $pdo->prepare("INSERT INTO customers | |
| (customer_id, customer_name, customer_email, fingerprint_data) | |
| VALUES (?, ?, ?, ?)"); | |
| $stmt->execute([$customerId, $customerName, $customerEmail, $fingerprintData]); | |
| echo json_encode(['success' => true, 'message' => 'Fingerprint saved successfully']); | |
| } catch (PDOException $e) { | |
| die(json_encode(['error' => 'Database error: ' . $e->getMessage()])); | |
| } | |
| } else { | |
| die(json_encode(['error' => 'Invalid request method'])); | |
| } | |
| ``` | |
| 4. Here's the customer search script: |