Jump to content

Creating random number


ZeroShade
 Share

Recommended Posts

Uh... why?Anyway, you can just do it at the top of your page

$rand = rand(0, 100); //rand takes the range (min and max ) of the random numbermysql_query("INSERT INTO table (randomnum_field) VALUES ($rand)");

Link to comment
Share on other sites

For security reasons, maybe?E.g.* Generate random number, store to $rand* Store it to database* Include non-hotlinking page* Inside non-hotlinking page: -- Get random number $rand -- Retrieve most recent random number from db -- If $rand != random number from db then die(hotlink attempt) -- Else continue with execution* EndThat is one application I could think of...

Link to comment
Share on other sites

Hot link is a direct link to a file, so say if you had a file include.php, which was included in other files, but then if someone accessed it directly that would be hotlinking. Many hosts have provisions against image hotlinking due to bandwidth costs.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...