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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.