Perhaps someone here could tell me what I've done wrong?
mt_srand(time());
$letters=array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"0","1","2","3","4","5","6","7","8","9",
"10","13","1337","2008","fail","wat","n00b","fake","luvz","php",
"_");
$letno=(count($letters)-1);
function cstr($length, $randlen){
$string="";
if ($randlen){
$length=mt_rand(1, $length);
}
for ($i=0; $i < ($length+1); $i++){
$string=$string.$letters[(mt_rand(0,$letno))];
}
return $string;
}
FYI, $randlen is a boolean, I tend to send true/false through; but have also tried 1/0 to no avail. An example of how I call the function:
$email_address=cstr(20,true)."@".cstr(20,true).".".cstr(3,false);This makes $email_address:
@.Any ideas would be greatly appreciated.


Sign In
Create Account



Back to top









