Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
//include_once "Validate/FR.php";
3
require_once "Validate.php";
4
/*
5
test(Validate::creditCard('6762195515061813'), true);
6
// 4
7
test(Validate::creditCard('6762195515061814'), false);
8
// 5
9
*/
10
/*
11
function rib($aCodeBanque, $aCodeGuichet='', $aNoCompte='', $aKey='')
12
function number($number, $decimal = null, $dec_prec = null, $min = null, $max = null)
13
*/
14
$values = array(
15
    'amount'=> '13234,344343',
16
    'name'  => 'foo@example.com',
17
    'rib'   => array(
18
                'codebanque'   => '33287',
19
                'codeguichet'  => '00081',
20
                'nocompte'     => '00923458141C',
21
                'key'          => '52'
22
                ),
23
    'rib2'  => array(
24
                'codebanque'   => '12345',
25
                'codeguichet'  => '12345',
26
                'nocompte'     => '12345678901',
27
                'key'          => '46'
28
                ),
29
    'cc'    => '6762195515061813',
30
    'cc2'   => '6762195515061814',
31
    'mail'  => 'foo@example.com',
32
    'hissiret' => '441 751 245 00016',
33
    'mystring' => 'ABCDEabcde',
34
    'iban'  => 'CH10002300A1023502601',
35
    'cep'   => '12345-123'
36
    );
37
$opts = array(
38
    'amount'=> array('type'=>'number','decimal'=>',.','dec_prec'=>null,'min'=>1,'max'=>32000),
39
    'name'  => array('type'=>'email','check_domain'=>false),
40
    'rib'   => array('type'=>'FR_rib'),
41
    'rib2'  => array('type'=>'FR_rib'),
42
    'cc'    => array('type'=>'Finance_CreditCard_number'),
43
    'cc2'   => array('type'=>'Finance_CreditCard_number'),
44
    'mail'  => array('type'=>'email'),
45
    'hissiret' => array('type'=>'FR_siret'),
46
    'mystring' => array('type'=>'string',array('format'=>VALIDATE_ALPHA, 'min_length'=>3)),
47
    'iban'  => array('type'=>'Finance_iban'),
48
    'cep'   => array('type'=>'ptBR_postalcode')
49
    );
50
 
51
$result = Validate::multiple($values, $opts);
52
 
53
print_r($result);
54
 
55
?>