On line lottery

Hi Experts

I need your help here.

My  scenario is as follows

 I have a page that when a counter reaches zero will open a new window and my script generates a random number.

My problem is that the random number is different to each online client. How can i do this ?

All on line clients must see the same number ( and all the generation process.)

To understand better what i want to do here is a link to these pages.

http://www.travelbookstore.gr/index/win4popup.htm
farmakisAsked:
Who is Participating?
 
LFLFMCommented:
You random number is being generated in JavaScript... JavaScript runs on the client's computer and therefore will generate a different one for each person AND it can be changed by anyone.
You must never have any important processing in javascript and never, ever trust any information generated in javascript.
Basically, whatever javascript sends to your server is, essentially as if the user typed up the information and sent it to you.
All your important code must be executed in the SERVER (with PHP or ASP or shell scripting).

So, you generate your random number in your SERVER side, and then have a page that shows the number. Javascript should be used to make little effects, like your countdown and dynamic webpages...
0
 
leakim971PluritechnicianCommented:
Put this number in a database, before generate a new number, check your database to see if you've an number for the day (or the week, month,...)
0
 
sybeCommented:
I would not call it a random number if everyone gets the same number.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
LFLFMCommented:
@sybe: The lottery is a random number.. a single result; what farmakis is trying to achieve isn't the individual numbers, its the final result, winning number; so yes, it has to be the same for everyone.
0
 
farmakisAuthor Commented:
Thank you all.

Maybe i was not quite clear

LFLFM got the point. the creation of the winning  number ( when the numbers spin and stops to one number ) is a random number. I have not critical data so i use javascript. The number is just a number that as soon as it created will be placed in a data base and ths process stops. The window will close and this number will be placed on the home page of the site.

The reason of the  pages is only for presentation perpose. I want all online clients see the creation of the number ( spining numbers ) AND they must see the same result at the same time.

This is my problem. Fot this i want your opinion. How i can present to everyone the same page at the same time with spining numbers that will stop to the same result.

Thank you again all
0
 
leakim971PluritechnicianCommented:
generate the number on the server side, put it in a table in the database
you can generate this number the first time a user ask for it if this number is not already created

of the client side, do an ajax call to get this number
play a animation to simulate the spining, the user think the number is created on its side but it come from the server/database
the spinning is a fake


0
 
farmakisAuthor Commented:
Hello Experts and thanks again for your answers.

@ leakim971

This was my first thought.
I am running the random number to the server and then provide the created number  in the pop-up page. No need for  animation. convert the javascript  of the page to do a real spining but the show ends with the number I want.
simple, safe and certainly very easy but it is not the most correct.
For this reason I am addressing you. I would like a more professional approach

Thanks again
0
 
leakim971PluritechnicianCommented:
You don't need to generate it when creating the page. With an ajax call you can retrieve it.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.