OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
quiz
/
backup
/
process
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
check_user_exists.php
840 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
logged_out.php
132 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
loginCheck.php
1.17 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
sendOTP.php
2.51 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
showChildDetails.php
1.11 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
storeChildDetails.php
1.83 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
submitParentForm.php
2.03 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
verifyOtp.php
459 bytes
05/19/2025 10:07:16 AM
rw-r--r--
Editing: storeChildDetails.php
Close
<?php // session_start(); include '../assets/php/validate.logged.php'; require('../assets/php/db_config.php'); // Check if the user is logged in // if (!isset($_SESSION['userId'])) { // echo json_encode(['success' => false, 'message' => 'User not logged in']); // exit; // } // $userId = $_SESSION['userId']; // Fetch the number of children already registered $query = "SELECT COUNT(*) AS child_count FROM child_details WHERE user_id = ?"; $stmt = $conn->prepare($query); $stmt->bind_param("i", $userId); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $currentChildCount = $row['child_count']; // Allow only up to 3 children if ($currentChildCount >= 3) { echo json_encode(['success' => false, 'message' => 'You can only register up to 3 children']); exit; } // Process form data $children = $_POST['childName']; $classes = $_POST['childClass']; $relations = $_POST['relation']; $schools = $_POST['schoolName']; $cities = $_POST['city']; if (count($children) + $currentChildCount > 3) { echo json_encode(['success' => false, 'message' => 'You can only register up to 3 children']); exit; } // Insert children into the database $query = "INSERT INTO child_details (user_id, child_name, child_class, relation, school_name, city) VALUES (?, ?, ?, ?, ?, ?)"; $stmt = $conn->prepare($query); for ($i = 0; $i < count($children); $i++) { $childName = $children[$i]; $childClass = $classes[$i]; $relation = $relations[$i]; $schoolName = $schools[$i]; $city = $cities[$i]; $stmt->bind_param("isssss", $userId, $childName, $childClass, $relation, $schoolName, $city); $stmt->execute(); } $stmt->close(); $conn->close(); echo json_encode(['success' => true, 'message' => 'Child details saved successfully']); ?>