Website
Supreme Member
- Feb 8, 2008
- 1,260
- 287
I have a script that is supposed to display a dandom url and a random password
but sometimes only the password will display and not the url
<?php
/**
* The letter l (lowercase L) and the number 1
* have been removed, as they can be mistaken
* for each other.
*/
function createRandomPassword() {
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
// Usage
$password = createRandomPassword();
$urls = @file('files.txt');
$num = count($urls);
$url = $urls[rand(0,$num)];
?>
<?php
echo "$password";
?>
<?php
echo "$url";
?>
but sometimes only the password will display and not the url