Gayner Posted December 17, 2009 Share Posted December 17, 2009 so like a php function that each time it's refreshed it generates a number 1 through 10 and i can echo it out? Link to comment https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/ Share on other sites More sharing options...
mikesta707 Posted December 17, 2009 Share Posted December 17, 2009 a randomly generated number? $num = rand(0,10); ... Do you even use google? Link to comment https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/#findComment-978923 Share on other sites More sharing options...
oni-kun Posted December 17, 2009 Share Posted December 17, 2009 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. Link to comment https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/#findComment-978926 Share on other sites More sharing options...
Gayner Posted December 17, 2009 Author Share Posted December 17, 2009 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 https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/#findComment-978930 Share on other sites More sharing options...
oni-kun Posted December 17, 2009 Share Posted December 17, 2009 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 https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/#findComment-978932 Share on other sites More sharing options...
Gayner Posted December 17, 2009 Author Share Posted December 17, 2009 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 https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/#findComment-978936 Share on other sites More sharing options...
Deoctor Posted December 17, 2009 Share Posted December 17, 2009 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 https://forums.phpfreaks.com/topic/185432-php-number-generator-1-thru-10-each-refresh/#findComment-978944 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.