Basically i found this small script on Google today, i just want to know a few answers: <?php $random_number = rand(1,10); $random_numbertwo = rand(1,10); print "<p>$random_number.</p>\n"; print "<p>$random_numbertwo.</p>\n"; ?> PHP: If i wanted to use this script at the backend of my website.. so when i press a button it will refresh the numbers and place the 2 numbers on the main page of the website so both numbers are seeable by the public. How would i do this? Is this safe? Can it be broken so people from the public can see what the next number will be? Is there a better way of doing it? Many thanks, Jamie Hann
Yeah it is random.. However, numbers from 1 to 10 are easy to guess, however, if you use 1 to 1000, it would be practically impossible to guess. Peace,
Thanks for the help guys. But what if i wanted to use this script in an admin panel.. so when i click on a button it will print the 2 random numbers on the homepage? Many thanks, Jamie Hann
Well, you could create a file that it would write to when you pressed the button, then include it wherever in your front page. Or you could add the numbers to the database and use them until you click the button again.
Your md5 script is completely useless, it produces the same results but encrypted with a static algorithm, thus only producing ten results. The possible output would be: c4ca4238a0b923820dcc509a6f75849b (1) c81e728d9d4c2f636f067f89cc14862c (2) ... d3d9446802a44259755d38e6d163e820 (10) Code (markup):
If possible, i'd like the script to run exactly like this: Admin page *- The script sets the 2 numbers to 0 - 0 first before i press the button *- The random script.. with a button called "randomize" *- When i click the button, it will randomize the numbers, place the numbers into a mysql database, and then when i called the table and table info it will place the 2 numbers onto the main page. Main Page *- Two big boxes, with the 2 numbers in place, obviously being set to 0 - 0 before i push the button, then changing into the numbers that are now randomized. Can anyone give me a bit of code for each section if not give me tutorials so then i would know how to do this myself? Many thanks, Jamie Hann