| Code Perl |
sub idtLire {local($From,$IDENT,$AUTH) = @_;
local $In = ''; if (&wsFile("read",$From,$$IDENT,"Id",\$In)!=0) {return 100}; local $x = $In;
local($k,$x0,$y,$cas);
$y = "*"; $cas = 0;
while(true) {
if ($x ne "") {$x =~ s/^\s*//};
if ($x eq '') {last}; $k = index($x,"/#T)");
if ($k==-1) {return 1}; $k = $k+4; $x0 = substr($x,0,$k); $x = substr($x,$k);
if ($x0!~/\(#T\(Compte\)new:(.*)\/#T\(Identification\):(\w+)\/#T\(Authentification\):(.*)\/#T\(Date\)/) {next};
if ($2 ne $$IDENT) {next}
$cas = (($1 ne "")?1:0);
$y = $3;
}
if ($y eq "*") {return 21};
if ($y ne $$AUTH) {return (($cas==0)?11:12)}; return (($cas==0)?0:2);
}
|
| Code JavaScript |
function idtLire(From,IDENT,AUTH) {
var In = Array(''); if (wsFile("read",From,IDENT[0],"Id",In)!=0) {return 100}; var x = In[0];
var k,x0,y,cas;
y = "*"; cas = 0;
while(true) {
if (x!="") {x = x.replace(/^\s*/,"")};
if (x=='') {break}; k = x.indexOf("/#T)");
if (k==-1) {return 1}; k = k+4; x0 = x.substr(0,k); x = x.substr(k);
if (!x0.match(/\(#T\(Compte\)new:(.*)\/#T\(Identification\):(\w+)\/#T\(Authentification\):(.*)\/#T\(Date\)/)) {continue};
if (RegExp.$2!=IDENT[0]) {continue}
cas = ((RegExp.$1!="")?1:0);
y = RegExp.$3;
}
if (y=="*") {return 21};
if (y!=AUTH[0]) {return ((cas==0)?11:12)}; return ((cas==0)?0:2);
}
|