Link to home
Start Free TrialLog in
Avatar of fedkris
fedkris

asked on

time condition in asp - respect time zone

hey,

i want, that invitations are send between 8 oclock in the morning, and 5 oclock afternoon.

if the thime, is not between these two hours, we don't send a mail

UTC (+1:00) belgium

we don't want, that, hackers, send mails in the night, so, is there a solution, to have a contition, respectiong our time zone?

thx for help, asp or other script, thx

kristof
Avatar of Big Monty
Big Monty
Flag of United States of America image

just to make sure I understand, you want to send out emails between 8am and 5pm of the users time zone, correct? to do that, you're going to need to know what time zone they reside in and then calculate whether or not they're in the right time frame by using the Now() function to get the current time.
First, I assume you have an ASP page that is set up for sending mail.  If that is the case you will first want to set up an event in your server's task scheduler to run the page every x minutes or hours between the time frame.  That is if you need it done automatically.

What I do is have a vbs script outside of the public website that gets hit from my task scheduler.  That vbs script does a post to the ASP page and posts some security info.  Then my ASP page looks for the security info before it accepts any input.  

I could  just as easily do all the mail in my vbs script, the reason I don't is I use the ASP page for multiple other public pages.

You can also look for the time in your ASP page and if it is not in the time frame, skip any sending.

<%
if hour(now()) >= 8 and hour(now()) <=17 then
' run my code

end if
%> 

Open in new window

Avatar of fedkris
fedkris

ASKER

hey,

the idea is, my question is:

a few days ago, we were hacked, a nights, and we sended empty mails tou people in our database. An idea was, we work from 8 till 17 (afternoon), is there a solution, we can work with timetable (UTC (+1:00) belgium ), if we are not open, anyone that will activate a send command in our sendpage, will refuse the send.

so our members will not receive those fake mails at night anymore.

thx
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial