PDA

View Full Version : [PHP] Generatore quasi OK!


race2
21-04-2004, 15:35
Come posso fare a raccogliere il valore generato da questo script ???

$My_Value=" ??? ";


<?
$arr=array("1"=>a,"2"=>b,"3"=>c,"4"=>d,"5"=>e,"6"=>f,"7"=>g,"8"=>h,"9"=>j,"10"=>k,"10"=>l,"11"=>m,"12"=>n,"13"=>o,"14"=>p,"15"=>q,"16"=>r,"17"=>s,"18"=>t,"19"=>u,"20"=>v,"21"=>w,"22"=>x,"23"=>y,"24"=>z);
for($i=1;$i<=10;$i++){
$num_yes_or_not=(rand(0,1));
$case_yes_or_not=(rand(0,1));
if($num_yes_or_not=="0"){
if($case_yes_or_not=="0"){
$num=(rand(1,24));
echo"$arr[$num]";
}else{
$num=(rand(1,24));
$temp=$arr[$num];
$numtd=strtoupper($temp);
echo"$numtd";
}
}else{
$num=(rand(0,9));
echo"$num";
}
}
?>

cionci
21-04-2004, 16:47
Se ho capito ciò che vuoi raccolgiere si fa così:

<?
$result = "";
$arr=array("1"=>a,"2"=>b,"3"=>c,"4"=>d,"5"=>e,"6"=>f,"7"=>g,"8"=>h,"9"=>j,"10"=>k,"10"=>l,"11"=>m,"12"=>n,"13"=>o,"14"=>p,"15"=>q,"16"=>r,"17"=>s,"18"=>t,"19"=>u,"20"=>v,"21"=>w,"22"=>x,"23"=>y,"24"=>z);
for($i=1;$i<=10;$i++){
$num_yes_or_not=(rand(0,1));
$case_yes_or_not=(rand(0,1));
if($num_yes_or_not=="0"){
if($case_yes_or_not=="0"){
$num=(rand(1,24));
$result .= $arr[$num];
echo"$arr[$num]";
}else{
$num=(rand(1,24));
$temp=$arr[$num];
$numtd=strtoupper($temp);
$result .= $numtd;
echo"$numtd";
}
}else{
$num=(rand(0,9));
echo"$num";
$result .= $num;
}
}
?>

race2
21-04-2004, 19:42
VEROOO!!!!!!!!!


function Password_Generator(){
$result = "";
$arr=array("1"=>a,"2"=>b,"3"=>c,"4"=>d,"5"=>e,"6"=>f,"7"=>g,"8"=>h,"9"=>j,"10"=>k,"10"=>l,"11"=>m,"12"=>n,"13"=>o,"14"=>p,"15"=>q,"16"=>r,"17"=>s,"18"=>t,"19"=>u,"20"=>v,"21"=>w,"22"=>x,"23"=>y,"24"=>z);
for($i=1;$i<=10;$i++){
$num_yes_or_not=(rand(0,1));
$case_yes_or_not=(rand(0,1));
if($num_yes_or_not=="0"){
if($case_yes_or_not=="0"){
$num=(rand(1,24));
$result .= $arr[$num];
echo"$arr[$num]";
}else{
$num=(rand(1,24));
$temp=$arr[$num];
$numtd=strtoupper($temp);
$result .= $numtd;
echo"$numtd";
}
}else{
$num=(rand(0,9));
echo"$num";
$result .= $num;
}
}
return $result;
}


Grazie nille!!!