当前位置: 首页>>代码示例>>PHP>>正文


PHP F3::input方法代码示例

本文整理汇总了PHP中F3::input方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::input方法的具体用法?PHP F3::input怎么用?PHP F3::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在F3的用法示例。


在下文中一共展示了F3::input方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: captcha

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');
            }
        }
    });
}
开发者ID:seyyah,项目名称:f3kayOLD,代码行数:16,代码来源:auth.php

示例2: soyad

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));
    });
}
开发者ID:seyyah,项目名称:f3kayOLD,代码行数:17,代码来源:common.php

示例3: function

    }
});
// tc numara geçerli olmalı
F3::input($alan = 'tc', function ($value) use($alan) {
    $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.");
开发者ID:seyyah,项目名称:uzkay,代码行数:31,代码来源:sorguyap.php

示例4: userpassword

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));
    });
}
开发者ID:seyyah,项目名称:f3ldap,代码行数:17,代码来源:common.php

示例5: validator

 function validator()
 {
     $this->set('title', 'User Input');
     $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text'));
     $this->route('POST /form', function () {
         F3::input('field1', 'nonexistent');
     });
     $this->set('QUIET', TRUE);
     $this->mock('POST /form');
     $this->run();
     $this->expect(!is_null($this->get('ERROR')) && $this->get('ERROR.code') === 500, 'HTTP 500 expected - form field handler is invalid', 'No HTTP 500 triggered');
     $this->set('QUIET', FALSE);
     $this->clear('ERROR');
     $this->route('POST /form', function () {
         F3::input('field', function ($value) {
             F3::expect($value == 'alert(\'hello\');', 'HTML tags removed (attempt to insert Javascript)', 'HTML tags were not removed: ' . $value);
         });
     });
     $this->mock('POST /form', array('field' => '<script>alert(\'hello\');</script>'));
     $this->run();
     $this->clear('ROUTES');
     $this->expect($_POST['field'] == 'alert(\'hello\');' && $_POST['field'] == 'alert(\'hello\');', 'Framework sanitizes underlying $_POST and $_POST variables', 'Framework didn\'t sanitize $_POST/$_POST: ' . $_POST['field']);
     $this->set('POST', array('field' => '<p><b>hello</b> world</p>'));
     $this->input('field', function ($value) {
         F3::expect($value == '<p>hello world</p>', 'HTML tags allowed but not converted to HTML entities' . '<br/>Note: application is responsible for ' . 'HTML decoding', 'HTML tags not converted/blocked by framework: ' . $value);
     }, 'p');
     $this->set('POST', array('field' => 'Adam & Eve'));
     $this->input('field', function ($value) {
         F3::expect($value == 'Adam & Eve', 'Ampersand preserved', 'Ampersand converted to HTML entity!');
     });
     $this->set('POST', array('field' => '&copy;'));
     $this->input('field', function ($value) {
         F3::expect($value == '&copy;', 'No duplicate encoding of HTML entity: ' . $value, 'Double-encoding of HTML entity: ' . $value);
     });
     $this->set('POST', array('field' => 'hello "world"'));
     $this->input('field', function ($value) {
         F3::expect($value == 'hello "world"', 'Double-quotes preserved: ' . $value, 'Double-quotes not handled properly: ' . $value);
     });
     $this->expect(Data::validEmail('!def!xyz%abc@example.com'), 'Valid e-mail address: !def!xyz%abc@example.com', 'Framework flagged !def!xyz%abc@example.com invalid!');
     $this->expect(Data::validEmail('"Abc@def"@example.com'), 'Valid e-mail address: "Abc@def"@example.com', 'Framework flagged "Abc@def"@example.com invalid!');
     $this->expect(!Data::validEmail('"Abc@def"@example.com', TRUE), 'Invalid e-mail address: "Abc@def"@example.com (MX record verified)', 'Framework flagged "Abc@def"@example.com valid!');
     $this->expect(!Data::validEmail('Abc@def@example.com'), 'Invalid e-mail address: Abc@def@example.com', 'Framework flagged Abc@def@example.com valid!');
     $this->expect(Data::validEmail('a@b.com'), 'Valid e-mail address: a@b.com (MX record not verified)', 'Framework flagged a@b.com invalid!');
     $this->expect(!Data::validEmail('a@b.com', TRUE), 'Invalid e-mail address: a@b.com (MX record verified)', 'Framework flagged a@b.com valid!');
     $this->expect(Data::validURL('http://www.google.com'), 'Valid URL: http://www.google.com', 'Framework flagged http://www.google.com invalid!');
     $this->expect(Data::validURL('http://www.yahoo.com/'), 'Valid URL: http://www.yahoo.com/', 'Framework flagged http://www.yahoo.com/ invalid!');
     $this->expect(Data::validURL('http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient'), 'Valid URL: ' . 'http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient', 'Framework flagged ' . 'http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient ' . 'invalid!');
     $this->expect(Data::validURL('http://www.yahoo.com?http%3A%2F%2Fwww.yahoo.com'), 'Valid URL: http://www.yahoo.com?http%3A%2F%2Fwww.yahoo.com', 'Framework flagged ' . 'http://www.yahoo.com?http%3A%2F%2Fwww.yahoo.com invalid!');
     echo $this->render('basic/results.htm');
 }
开发者ID:nian2go,项目名称:fatfree,代码行数:50,代码来源:main.php

示例6: foreach

    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) {
        $ne = ucfirst($alan);
        if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'enaz' => array(2, "{$ne} çok kısa"), 'enfazla' => array(127, "{$ne} çok uzun")))) {
            F3::set('error', $hata);
            return;
        }
        F3::set("REQUEST.{$alan}", ucfirst($value));
    });
}
// tc numara geçerli olmalı
F3::input($alan = 'tc', function ($value) use($alan) {
    $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;
    }
    $kul = new Axon('kul');
    if ($kul->found("tc={$value}")) {
        F3::set('error', "{$ne} {$value} daha önceden eklendi");
        return;
    }
});
开发者ID:seyyah,项目名称:uzkay,代码行数:31,代码来源:denetle.php


注:本文中的F3::input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。