PDA

View Full Version : Help!!!!!



rkania
11-07-2006, 09:40 PM
I have a project wich calls for a count down from 5 days left to 0.

The trick is I can't use the internal clock of users pc but rather have it update every 24 hours from the time of upload to server
(perhaps use the internal server clock)

If anyone has any ideas please let me know. Im stuck and dont know what to do.

rkania
11-07-2006, 10:06 PM
what I'm trying do is the fallowing:

I have a banner that reads " only 5 days left to purchase ....."

>>I need the 5 days to count down a day every 24hours from the time of upload (for example if file upload on Tuesday at 10pm (starts day 5) then the count down for next day start on Wednesday at 10pm (day4) and so on.
this can be a swf loaded to target triggered by actionscript, php, or javascript or a dynamic text box.

what i dont want is if someone has the wrong date or time on their computer to effect the count down. i just dont know how to go about starting this. PLEASE HELP!!!

would this be possible if I had 5 diff swfs one for each day can a php script call up the correct swf every 24hours 5,4,3,2,1 ????????

im not much of a programmer as perhaps this post shows, so please at least point me in the right direction of research...

NTD
11-08-2006, 02:59 PM
Hi,

The easy way to do it in Flash...



startDate = "11/8/2006";
endDate = "11/15/2006";
myDate = new Date();
currentDate = (myDate.getMonth()+1)+"/"+myDate.getDate()+"/"+myDate.getFullYear();
if (currentDate == endDate) {
trace("Date detected "+currentDate);
//do something;
}


However, as you mentioned, this allows the user to manipulate their system clock to counter the code.

Another possible option is to use a LoadVars object to call a PHP script to check server time. Something like...


serverDate = new LoadVars();
serverDate.onLoad = function(success) {
if (!success) {
trace("Failed to load");
} else {
myDate=serverDate;
trace(unescape(myDate));
}
};
serverDate.load("http://somesite.com/date.php");


Then the PHP script...


<?php
$today = date&#40;"F j, Y"&#41;;
echo&#40;$today&#41;;
?>


Check out PHP.net for more info and options on date function usage.

Hope it helps