Form Verilerini İşleme
<form method="POST" action="process.php">
<label for="username">Kullanıcı Adı:</label>
<input type="text" id="username" name="username" required>
<label for="password">Şifre:</label>
<input type="password" id="password" name="password" required>
<button type="submit">Gönder</button>
</form>// Form verilerini kontrol etme
if (!isset($_POST['username']) || empty($_POST['username']) || !isset($_POST['password']) || empty($_POST['password'])) {
echo 'Lütfen kullanıcı adı ve şifrenizi girin.';
exit;
}
// Form verilerini işleme
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
// Veritabanı işlemleri
$connection = new mysqli('localhost', 'kullanici_adi', 'sifre', 'veritabani_adi');
if ($connection->connect_error) {
die('Veritabanına bağlanılamadı: ' . $connection->connect_error);
}
$username = $connection->real_escape_string($username);
$password = $connection->real_escape_string($password);
$query = "INSERT INTO users (username, password) VALUES ('$username', '$password')";
if ($connection->query($query) === true) {
echo 'Kullanıcı başarıyla oluşturuldu.';
} else {
echo 'Bir hata oluştu: 'Last updated