How to have msql connect just in some preset time intervals?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
phpnewbie3
Forum Newbie
Posts: 17
Joined: Sat Sep 20, 2008 10:15 am
Location: NJ, USA

How to have msql connect just in some preset time intervals?

Post by phpnewbie3 »

I'm doing my own project for my own website, and I want to run a sports handicapping contest.

I have this problem to solve:

I would need that participants to be able to input data in the database just in some preset time intervals.
These would be between 11 AM EST -18.30 PM EST on weekdays (Monday-Friday)
and between 8.30 AM EST - 11.30 EST on weekends (Saturday - Sunday).
It's very important that these times must be is EST (New York's time).

There is any solution to this?
Something applying the if, else and elseif statements?
I'm using PHP.

Thanks in advance! :)
phpnewbie3
Forum Newbie
Posts: 17
Joined: Sat Sep 20, 2008 10:15 am
Location: NJ, USA

Re: How to have msql connect just in some preset time intervals?

Post by phpnewbie3 »

Probably this can't be done... :banghead:
User avatar
pavanpuligandla
Forum Contributor
Posts: 130
Joined: Thu Feb 07, 2008 8:25 am
Location: Hyderabad, India

Re: How to have msql connect just in some preset time intervals?

Post by pavanpuligandla »

I'm doing my own project for my own website, and I want to run a sports handicapping contest.

I have this problem to solve:

I would need that participants to be able to input data in the database just in some preset time intervals.
These would be between 11 AM EST -18.30 PM EST on weekdays (Monday-Friday)
and between 8.30 AM EST - 11.30 EST on weekends (Saturday - Sunday).
It's very important that these times must be is EST (New York's time).

There is any solution to this?
Something applying the if, else and elseif statements?
I'm using PHP.

Thanks in advance! :)
hii..
yes u can do it, but ur topic is related to php security..
my opinion is, u need to maintain a table for time stamps, and those who are able to insert or update the database.
track the time of each user, and if the time stamp is equal to ur predefined time., then block them, release after x hrs.. hope this may work.. :idea:

i can give pseudo code;

get usrname
get timestamp

if (!time=predefined time of ur server){

//insert, update DB
}
else {
// write a query to block the user and update the time stamp after X hrs.
}
hope u understand..
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: How to have msql connect just in some preset time intervals?

Post by califdon »

phpnewbie3 wrote:I'm doing my own project for my own website, and I want to run a sports handicapping contest.

I have this problem to solve:

I would need that participants to be able to input data in the database just in some preset time intervals.
These would be between 11 AM EST -18.30 PM EST on weekdays (Monday-Friday)
and between 8.30 AM EST - 11.30 EST on weekends (Saturday - Sunday).
It's very important that these times must be is EST (New York's time).

There is any solution to this?
Something applying the if, else and elseif statements?
I'm using PHP.

Thanks in advance! :)
Just stop and think about it. All you need to do is have your PHP code test what the current time is when that page is requested and determine whether or not to allow the option to input data or not. The current time is determined by the server, so it doesn't matter what time it is at the requestor's location. I won't write your code for you, but there's nothing complicated about the idea. If the current time is not within your desired "windows", just display a notice that says something like, "Sorry, we only accept input at the following hours: ..." instead of displaying the input Form.
Post Reply