[Pro] Random number generator

How can I create something like this and have someone fill it out where it gets sent to my email.

Similar to a contact form

http://www.randomnumbergenerator.com/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What do you want to do with the number? How random does it need to be? How many possibilities do you need?

Making a random number of any size is pretty simple in lots of different programming languages. At the very bottom of the pile in terms of complexity, you can do it with JavaScript, just as they did at this page. If you need to hide the implementation, though, you need to do this on the server, so the easiest way to do that is with PHP (since most servers have that).

Walter

On Mar 14, 2015, at 4:32 PM, Howard Spaeth email@hidden wrote:

How can I create something like this and have someone fill it out where it gets sent to my email.

Similar to a contact form

http://www.randomnumbergenerator.com/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s for my fantasy baseball league to generate draft order. Only ten options but I want once one number is drawn for me to get an email saying this person got this number and that number can’t be drawn anymore


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Okay, so that’s not a random number generator, but rather a random sort of a known universe of numbers. A truly random number generator will happily and correctly give you the same number four times in a row – this is particularly common in a small universe. When it does, this is not a mistake, just a misunderstanding of what random means.

Now to scramble an array and return one of the members is pretty straightforward. But to take a number out of the array forever – for all subsequent visitors to the page – means you will need a database of some sort (it could just be a text file on your server, nothing fancy) to persist the choices globally. Remember, each person who visits a Web page sees the same original code, and no two browser sessions share anything except that starting point – the original state of your array – if it is hard-coded into your page. So while you could do this in JavaScript in a few lines of code, that would only work on a per person basis. Nobody would know what choices had already been made by other persons in the pool.

Can you say a little more about your goals here? If you can write out what you want the application to do, and for whom, then one of us can no doubt give you some suggestions.

Walter

On Mar 15, 2015, at 9:10 AM, Howard Spaeth email@hidden wrote:

It’s for my fantasy baseball league to generate draft order. Only ten options but I want once one number is drawn for me to get an email saying this person got this number and that number can’t be drawn anymore


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

basically what I want it to do, is where I will have it as password protected(one that I will give them) and it be just like a contact form, where they fill their name out and once they hit… get number… it wlll go through numbers 1 through 10. If I get number 10, i want that to be taken out of circulation.

Once they get a number, i want that to lock and the hit submit so it goes to my email so I can set the draft order

Not sure if this is possible.

I want it to be similar to “draw a number out of a hat”


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is totally possible, but it will require some programming and persistence on the server side. By persistence, I mean that the server will have to remember the user from visit to visit, which is ordinarily not something that the server burdens itself with doing. Each visit to a Web server is like talking to a total amnesiac, as immortalized here: xkcd: Server Attention Span

So this forces your hand pretty sharply in terms of what your solution needs to be. If you were doing this in a totally lightweight manner, then you would store the numbers in a cookie on the browser, and each time they log in from the same computer, you would know what numbers to seed the random picker with (what’s left). But that means they would always have to use the same computer, and you can’t guarantee that in today’s tablet/mobile/work desktop/friend’s laptop world.

Since you need to know who has picked which numbers, you also need to know who has logged in, which leaves out using the .htaccess trick you were planning on. That technique does not allow the server to know which user is logged in at the moment. So you need to log in with PHP or another server-side language, and you’re all the way into a custom programmed solution. Assuming this doesn’t scare you off, here’s the rough pieces you will need:

  1. A database to store the individual users, and authenticate them for login. (This can be as little as a shared text file, if your server is not busy, and the number of users is low.)
  2. A server-side scripting language, like PHP or Ruby installed and configured to work with your Web server.
  3. sendmail (or Dovecot or Postfix) running on your server to deliver mail sent from the scripting language.
  4. A bunch of pages you (probably) were not considering building:
    a. Login form page
    b. Error page
    c. Success page
    d. Form page (where they will pick their next number)
    e. form handler script to manage both forms

You’re probably looking at a day’s work for an experienced programmer, and then you would also need to incorporate the programming into your Freeway-designed layout.

Walter

On Mar 15, 2015, at 11:27 AM, Howard Spaeth email@hidden wrote:

basically what I want it to do, is where I will have it as password protected(one that I will give them) and it be just like a contact form, where they fill their name out and once they hit… get number… it wlll go through numbers 1 through 10. If I get number 10, i want that to be taken out of circulation.

Once they get a number, i want that to lock and the hit submit so it goes to my email so I can set the draft order

Not sure if this is possible.

I want it to be similar to “draw a number out of a hat”


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options