PDA

View Full Version : Page expire


everglade
06-21-2001, 01:18 PM
Anyone please help with this? I have read about this before but can't rememeber where!!

I have a page (a competition actually) which I only want to be visible upto a set date, after which I would like another page to replace it..(you know, a 'sorry the competition has closed page')

Anyone help me on doing this...what do i need to add to set the dates, etc?

drivle
06-21-2001, 03:31 PM
Do you have perl available to you?

I haven't tried writing such a script - but I figure you could redirect to a different page on or after a certain date.

Dr. Web
06-21-2001, 03:43 PM
you could do it server side, or client side with JS. If you used client side, the user could reset the date to view the page (though not likely).

Which do you prefer?

everglade
06-21-2001, 06:00 PM
I am not bothered which one I use to be honest with you as long as it works. I have no knowledge of java and am only able really to edit/ amend pre-written scripts....but I am very affluent with HTML so with that in mind if you could explain both methods then perhaps I could choose which one I find easiest and best for this instance?

JohnM
06-22-2001, 03:35 AM
/*I hope this helps, this is the best that I can explain it!*/

Server Side is when all the work is done on the server, then sent to your browser. Examples of server side languages are: php, asp, perl (cgi).

Client Side is when the browser does all the work. JavaScript is client side. Server side usually loads faster than client because the browser doesn't have to do any of the work.

Personally, I would do this in JavaScript as it is much easier than the server side languages.

*Note: Just for the record, JavaScript is not the same thing as java.

everglade
06-22-2001, 04:06 AM
OK, thanks for that, but have you an example of a script to work client-side that would do the above task that i can view please?

Dr. Web
06-22-2001, 12:02 PM
moving this to client side scripting....

Dr. Web
06-22-2001, 12:03 PM
<html>
<head>
<script language=javascript>
mo=today.getMonth()+1;
day=today.getDate();
yr=today.getYear();
alert(mo+"," +day+","+yr);

if (mo>=6 && day>=24 && yr>=2001){
alert("it is 'or after' June, 24, 2001");
document.location="http://www.eye4u.com";
}else{
alert("it is before the date, so go ahead");
document.location="http://www.yahoo.com";
}



// -- end hiding
</script>
</head>
<bidy>
</body>
</html>

Dr. Web
06-22-2001, 12:08 PM
That code will redirect to two different web pages... depending on the current date of the USERS computer. If their date is wrong.... then obviously this script will not work. Still you should be fairly ok, giving in to time zone/ date differences.

One final word, please note I set it up to check US dates/ time. I don't know if its different for other countries.

Good luck.