function captcha() { // Validate CAPTCHA verification code; if any F3::input('captcha', function ($value) { if (!F3::exists('message') && F3::exists('SESSION.captcha')) { $captcha = F3::get('SESSION.captcha'); if (empty($value)) { F3::set('message', 'Verification code required'); } elseif (strlen($value) > strlen($captcha)) { F3::set('message', 'Verification code is too long'); } elseif (strtolower($value) != $captcha) { F3::set('message', 'Invalid verification code'); } } }); }
function userpassword() { // Validate userpassword F3::input('userpassword', function ($value) { if (!F3::exists('message')) { if (empty($value)) { F3::set('message', 'Parola should not be blank'); } elseif (strlen($value) > 127) { F3::set('message', 'Parola is too long'); } elseif (strlen($value) < 3) { F3::set('message', 'Parola is too short'); } } // Do post-processing of userpassword here F3::set('REQUEST.userpassword', ucfirst($value)); }); }
function soyad() { // Validate blog soyad F3::input('soyad', function ($value) { if (!F3::exists('message')) { if (empty($value)) { F3::set('message', 'Soyad should not be blank'); } elseif (strlen($value) > 127) { F3::set('message', 'Soyad is too long'); } elseif (strlen($value) < 3) { F3::set('message', 'Soyad is too short'); } } // Do post-processing of soyad here F3::set('REQUEST.soyad', ucfirst($value)); }); }
/** Auto-detect default locale; Override parent class @return boolean @param $_lang string @public **/ public static function setDefault($_lang = NULL) { if (!$_lang) { $_header = $_SERVER['HTTP_ACCEPT_LANGUAGE']; if (F3::exists('LANGUAGE')) { // Framework variable defined $_lang = F3::get('LANGUAGE'); } elseif (isset($_header)) { // Found in HTTP header $_lang = self::acceptFromHttp($_header); } else { // Use default_locale $_lang = self::getDefault(); } } // Set default language $_ok = parent::setDefault($_lang); if ($_ok) { F3::set('LANGUAGE', $_lang); self::$dict = array(); } return $_ok; }
$ne = "Tc No"; if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'esit' => array(11, "{$ne} 11 haneli olmalıdır"), 'tamsayi' => array(true, "{$ne} sadece rakam içermeli"), 'ozel' => array(function ($value) { return !is_tc($value); }, "Geçerli bir {$ne} değil")))) { F3::set('error', $hata); return; } }); F3::input($alan = 'kizliksoyad', function ($value) use($alan) { $ne = "Kızlık Soyadı"; if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz")))) { F3::set('error', $hata); return; } }); if (!F3::exists('error')) { $tc = F3::get('REQUEST.tc'); $kizliksoyad = F3::get('REQUEST.kizliksoyad'); $kul = new Axon('kul'); $kul->load("tc={$tc}"); if (!$kul->dry() && streq_turkish($kul->kizliksoyad, $kizliksoyad)) { // tc no'yu oturuma gömelim ve oradan alalım F3::set('SESSION.sorgutc', $tc); F3::set('SESSION.sorgukizliksoyad', $kizliksoyad); return F3::call(':sorguok'); } F3::set('error', "Girdiğiniz bilgilere uygun bir kayıt bulunamadı. Lütfen verdiğiniz bilgileri kontrol edin."); } // hata var, dön başa ve tekrar sorgu al. // error alanı dolu ve layout.htm'de görüntülenecek F3::call(':sorgual');
<?php // Reset previous error message, if any F3::clear('message'); // Form field validation F3::call(':common'); if (!F3::exists('message')) { // No input errors; add record to database $blog = new Axon('kul'); $blog->copyFrom('REQUEST'); $blog->save(); // Return to home page; new blog entry should now be there F3::reroute('/'); /*$payload = json_encode(array(F3::get('REQUEST.title'), F3::get('REQUEST.entry'))); F3::reroute('http://192.168.140.86/receiver.php?payload=' . $payload );*/ } // Display the blog form again F3::call(':createkul');
function keyword() { $this->input('keyword', function ($value) { if (!F3::exists('message')) { if (empty($value)) { F3::set('message', 'You did not enter a search term'); } } //No processing required but saved back for completeness $_GET['keyword'] = $value; return $value; }); }
case 'tamsayi': $hata = $kosul && !ctype_digit($verilen); break; case 'ozel': $hata = $kosul && $kosul($verilen); break; } if ($hata) { return array_shift($bilgi); } } } // temiz bir sayfa açalım! F3::clear('error'); // captcha'sız maça çıkmayız, sağlam gidelim if (!F3::exists('SESSION.captcha')) { F3::set('error', 'Oturum Güvenlik Kodu eksik'); return; } // captcha tamam mı? F3::input($alan = 'captcha', function ($value) use($alan) { $ne = "Güvenlik Kodu"; $captcha = F3::get('SESSION.captcha'); if ($hata = denetle(strtolower($value), array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'enaz' => array(strlen($captcha), "{$ne} çok kısa"), 'degeri' => array(strtolower($captcha), "Yanlış {$ne}")))) { F3::set('error', $hata); return; } }); // ad ve soyad şart foreach (array('ad', 'soyad') as $alan) { F3::input($alan, function ($value) use($alan) {