Jump to content

php number generator? 1 thru 10 each refresh


Gayner

Recommended Posts

so like

 

a php function that each time it's refreshed it generates a number 1 through 10 and i can echo it out?

 

rand - And yes, It's more a convenience for the people helping you, when you help yourself.

 

i did look on google what am i supposed to search?

random generator php well go try it. it's all random thx tho.

so like

 

a php function that each time it's refreshed it generates a number 1 through 10 and i can echo it out?

 

rand - And yes, It's more a convenience for the people helping you, when you help yourself.

 

i did look on google what am i supposed to search?

random generator php well go try it. it's all random thanks tho.

 

The VERY first result I get when I search up "random generator php" gives me:

http://php.net/manual/en/function.rand.php

so like

 

a php function that each time it's refreshed it generates a number 1 through 10 and i can echo it out?

 

rand - And yes, It's more a convenience for the people helping you, when you help yourself.

 

i did look on google what am i supposed to search?

random generator php well go try it. it's all random thanks tho.

 

The VERY first result I get when I search up "random generator php" gives me:

http://php.net/manual/en/function.rand.php

 

silly i get this:

 

http://www.webtoolkit.info/php-random-password-generator.html

 

lol

if u need a random password generator i have one..

<?php
/** * The letter l (lowercase L) and the number 1 
* have been removed, as they can be mistaken 
* for each other. */
function createRandomPassword() 
{    $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz023456789";srand((double)microtime()*1000000); $i = 0;$pass = '' ;    
while ($i <= 10) 
{            $num = rand() % 33;        
            $tmp = substr($chars, $num, 1);        
            $pass = $pass . $tmp;  
            $i++;    
}    
return $pass;
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Enter text :<table>
          <tr><td><input name="randpass" type="text" ></td></tr>
          <tr><td><input type="submit" name="submitBtn" value="Submit"></td></tr>
</table> 
</form>

<?php
if(isset($_POST['submitBtn']))
{
    $randpass=$_POST['randpass'];
    if($randpass==$password)
    {
        echo "OK";
    }
    else
    {
        echo "Not Ok";
        
    }
}
$password = createRandomPassword();
echo "Your random password is: $password";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.