July 24, 200718 yr J'ai quelques petites difficultés à mettre ce bout de code en PHP : Public Function Calcul(Chaine As String) As String Dim I As Integer Dim N As Integer Dim C As String Dim CheckSum As String Dim HCheck As String Dim Chk As Integer Chk = 0 For I = 1 To Len(Chaine) Chk = Chk + Asc(Mid(Chaine,I,1)) Next I HCheck = "" For I = 1 To 4 N = Chk Mod 16 C = IIf(N > 9, Chr(55 + N),LTrim(Str(N))) HCheck = C + HCheck Chk = (Chk - N) / 16 Next I For I = 1 To 4 C = Mid(HCheck,I,1) CheckSum = CheckSum + C Next I Calcul = CheckSum End Function Ne connaissant pas le VB j'm'embrouille vite fais et je tatonne... étant sous linux je ne sais pas si on peut tester du code VB, un peu d'aide sera là bienvenue...
July 24, 200718 yr Bon allez, je me jette à l'eau, sans garantie aucune: <?php public function calcul( $chaine ) { $n = 0; $c = ""; $chk= 0; for( $i = 1; $i < strlen( $chaine ); $i ++ ) { $chk += Asc( Mid( $chaine, $i, 1 ) ); } $hCheck = ""; for( $i = 1; $i < 4; $i ++ ) { $n = $chk Mod 16 $c = IIf( $n > 9, chr(55 + $n ), ltrim( str( $n ) ) ); $hCheck = $c + $hCheck; $chk = ( $chk - $n ) / 16; } for( $i = 1; $i < 4; $i ++ ) { $c = Mid( $hCheck, $i, 1 ); $checkSum += $c; } $calcul = $checkSum; } ?> Sauf que y a des fonctions propres à VB qui sont appelées apparemment, et je ne sais pas à quoi elles servent, donc je ne connais pas leurs équivalents
Archived
This topic is now archived and is closed to further replies.