<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VESİKA BUL</title>
</head>
<body>
<h1>VESİKA BUL</h1>
<form action="vesikalik.php" method="GET">
<label for="ara">Okul Numarası veya Ad Soyad:</label>
<input type="text" id="ara" name="ara" required>
<button type="submit">Ara</button>
</form>
<?php
if (isset($_GET['ara'])) {
$search = trim($_GET['ara']);
$baseDir = __DIR__ . '/fotolar';
$found = false;
foreach (scandir($baseDir) as $classFolder) {
if ($classFolder === '.' || $classFolder === '..') continue;
$classPath = $baseDir . '/' . $classFolder;
foreach (scandir($classPath) as $file) {
if ($file === '.' || $file === '..') continue;
if (stripos($file, $search) !== false) {
$imagePath = 'fotolar/' . $classFolder . '/' . $file;
echo "<h2>Sonuç:</h2>";
echo "<p><strong>$file</strong></p>";
echo "<img src='$imagePath' alt='Vesika' style='max-width:300px;'>";
$found = true;
break 2;
}
}
}
if (!$found) {
echo "<p style='color:red;'>Aradığınız kriterlere uygun vesika bulunamadı.</p>";
}
}
?>
</body>
</html>