<?php
session_start();
if (!isset($_SESSION['query_count'])) {
$_SESSION['query_count'] = 0;
}
if (isset($_POST['query'])) {
$_SESSION['query_count']++;
$_SESSION['last_query'] = $_POST['query'];
}
$query_count = $_SESSION['query_count'];
$last_query = isset($_SESSION['last_query']) ? $_SESSION['last_query'] : '';
?>
<!DOCTYPE html>
<html>
<head>
<title>Ana Sayfa - Flowzzy</title>
</head>
<body>
<h1>Hoş geldiniz!</h1>
<p>Atılan Sorgu Sayısı: <?php echo $query_count; ?></p>
<p>Son Sorgu: <?php echo $last_query; ?></p>
<form method="POST" action="/">
<input type="text" name="query" placeholder="Bir sorgu girin">
<button type="submit">Gönder</button>
</form>
</body>
</html>
Editle kullan