nullcoder Merhaba.
Hiç böyle entrikalara girmeden CloudFlare kullan bence. Ddos Saldırılarına kesin çözüm verebilen bir sistem yok. Sadece güvenlik katmanını çoğaltabilirsin. Bunu da şuan en iyi yapan CloudFlare (Şahsi fikrim)
Captcha göstermek istiyorsan eğer @Halil Han BADEM hocamın dediği mantıklı. Siteye girişleri kontrol edip IP ve tarayıcı bilgilerini veri tabanına kayıt edersin. Siteye tekrar giriş yapmak istediğinde veri tabanındaki bilgilerle eşleştirebilirsin. Tekrar tekrar captchaya maruz kalınmaması için. Her seferinde catcha görsün istiyorsan hiç girişleri kontrol etmene gerek yok.
Şöylede olabilir. (biraz uzun yol) index.php de olmasını istiyorsan bunun için index.php den önce kontrol sayfası oluşturup tüm işlemleri orada gerçekleştirip sonra index.php ye yönlendireceksin. Bunu da SESSION tanımlaması ile yaparsın.
Recaptcha kullanmak istersen eğer (bu en iyisidir) : bu sayfayı biraz incele
https://developers.google.com/recaptcha/old/docs/php
<html>
<body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
<!-- your HTML content -->
<form method="post" action="verify.php">
<?php
require_once('recaptchalib.php');
$publickey = "your_public_key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<input type="submit" />
</form>
<!-- more of your HTML content -->
</body>
</html>
Sunucu tarafı kontrolünde ise
<?php
require_once('recaptchalib.php');
$privatekey = "your_private_key";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
echo '<div id="sayfamBuradaa"></div>';
echo '<script>$(document).ready(function() { $("#sayfamBuradaa").load("sayfamBuradaa.php"); });</script>';
// Böylede yaparak sayfa içeriğini gösterirsin.
}
?>