ZeroShade Posted October 7, 2007 Share Posted October 7, 2007 I need to create a random number and store it in a mysql database before the page is finished loading (as soon as possible). How should I go about doing this? Link to comment Share on other sites More sharing options...
Synook Posted October 7, 2007 Share Posted October 7, 2007 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 More sharing options...
ZeroShade Posted October 7, 2007 Author Share Posted October 7, 2007 Thanks man! Link to comment Share on other sites More sharing options...
user4fun Posted October 13, 2007 Share Posted October 13, 2007 i would like to know why? Link to comment Share on other sites More sharing options...
Synook Posted October 13, 2007 Share Posted October 13, 2007 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 More sharing options...
user4fun Posted October 14, 2007 Share Posted October 14, 2007 it is funny you say that, i have no idea what a hot link is? lol Link to comment Share on other sites More sharing options...
Synook Posted October 14, 2007 Share Posted October 14, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.