[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2000,2001 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> 4 * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> 5 * 6 * $Id: bank.lib.php,v 1.10 2005/03/03 16:13:45 rodolphe Exp $ 7 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/bank/bank.lib.php,v $ 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 * or see http://www.gnu.org/ 23 */ 24 25 /*! \file htdocs/compta/bank/bank.lib.php 26 \ingroup banque 27 \brief librairie contenant les fonctions bancaires. 28 \author Laurent Destailleur 29 \version $Revision: 1.10 $ 30 31 Ensemble des fonctions en rapport avec les modules bancaires 32 */ 33 34 35 36 /*! 37 \brief Verifie le RIB d'un compte bancaire grace à sa clé 38 \param code_banque code banque 39 \param code_guichet code guichet 40 \param num_compte numero de compte 41 \param cle cle 42 \param iban Ne sert pas pour le calcul de cle mais sert pour determiner le pays 43 \return int true si les infos sont bonnes, false si la clé ne correspond pas 44 */ 45 46 function verif_rib($code_banque , $code_guichet , $num_compte , $cle, $iban) 47 { 48 if (eregi("^FR",$iban)) 49 { // Cas de la France 50 51 $coef = array(62, 34, 3) ; 52 53 // Concatenation des differents codes. 54 $rib = strtolower(trim($code_banque).trim($code_guichet).trim($num_compte).trim($cle)); 55 56 // On remplace les eventuelles lettres par des chiffres. 57 58 //Ne marche pas 59 //$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); 60 61 $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678923456789"); 62 63 // Separation du rib en 3 groupes de 7 + 1 groupe de 2. 64 // Multiplication de chaque groupe par les coef du tableau 65 for ($i=0, $s=0; $i<3; $i++) 66 { 67 $code = substr($rib, 7 * $i, 7) ; 68 $s += (0 + $code) * $coef[$i] ; 69 } 70 71 // Soustraction du modulo 97 de $s à 97 pour obtenir la clé RIB 72 $cle_rib = 97 - ($s % 97) ; 73 74 if ($cle_rib == $cle) 75 { 76 return true; 77 } 78 79 return false; 80 } 81 82 return true; 83 } 84 85 86 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |