Random number generator |
Random number generator |
Oops! |
Jan 16 2012, 01:12 PM
Post
#1
|
Group: Members Posts: 2 Joined: 16-January 12 Member No.: 16,267 |
Hello
I am trying to figure out the best way to go about generating a random number but having that number stored on a separate html page. I am setting up a forum that allows quest posting but I wish to offer a way for the OP to request thread deletion or an edit, The only way I can see to achieve this would be to generate a random code to be displayed after thread creation (which I have a script for) but I then need to save that code in the thread with a conditional so that only admin and mods can see but I cant seem to figure out how to store the generated number into a separate html page. If anyone has any ideas it would be much appreciated, below is the script I am currently looking at. CODE <script LANGUAGE="JavaScript"> num= new Array(16); for (i=0; i<16; i++) { num[i]=Math.floor(16*Math.random()+1); if (num[1]==num[0]) { while (num[1]==num[0]) { num[1]=Math.floor(16*Math.random()+1); } } if (num[2]==num[1] || num[2]==num[0]) { while (num[2]==num[1] || num[2]==num[0]) { num[2]=Math.floor(16*Math.random()+1); } } if (num[3]==num[2] || num[3]==num[1] || num[3]==num[0]) { while (num[3]==num[2] || num[3]==num[1] || num[3]==num[0]) { num[3]=Math.floor(16*Math.random()+1); } } document.write(num[i],""); } </SCRIPT> |
pandy |
Jan 16 2012, 01:16 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
You can't do things like that with JavaScript as it only exists in the browser, i.e. it can't write to files on the server.
Doesn't your forum require login? In that case it should be enough that the member who asks for deletion is the same as started the thread. |
Oops! |
Jan 16 2012, 01:36 PM
Post
#3
|
Group: Members Posts: 2 Joined: 16-January 12 Member No.: 16,267 |
Thanks, I think that saved me some wasted time researching.
To answer your question, No it does not require login so I am seeking a solution for proof of thread ownership for the odd few that request changes or deletion. |
remoteasgiven |
May 11 2012, 10:06 AM
Post
#4
|
Group: Members Posts: 1 Joined: 11-May 12 Member No.: 17,097 |
Hi everyone
talking about random numbers, I would like to show you a true random number generator. http://remoteasgiven.altervista.org/ bye |
Lo-Fi Version | Time is now: 19th April 2024 - 09:54 PM |