Log in

View Full Version : Date Availability Checker Script



Century
05-10-2007, 04:58 PM
Hi, I love DD, it's a wonderful resource that I have used many times. Ok enough of the sucking up...

I'm an artist and I use the web a lot for promoting and such like, now I've had a few clients ask me if there is any way to put a date checker onto my site, I said I'd look into it.

I'm so poor at coding it's unreal so I fall at your feet here and ask you take pity on a poor sad little girl... Please, Please could anyone code a date checker script and tell me how to use it...

You will have my undying gratitude not to mention that of my clients.

Yours, hoping... Michelle.

djr33
05-10-2007, 05:44 PM
Well, this is a lot more complex than just checking a date. That would likely be just one line of code.
But creating the system to store the calendar of events including the management end of things to add events in the first place, then add an event through this date checker if it is free, etc. would get complex.

Do you already have a system in place, or would you need that as well?

Even if you do have the system in place, it may be difficult to alter it, since the code might be complex as well.

Century
05-10-2007, 06:56 PM
I don't have anything in place at the moment, All I need really is to have a flat file? with the dates already booked in it and then a form to check to see if that date is already in the file and send back a sorry page if it is and a congratulations page if it isn't.

Sounds simple, but I imagine is probably isn't. I've been on w3schools to try and learn the basics but I just can't get my head around it :(

Thank you for replying :)
Yours, Michelle

techno_race
05-11-2007, 02:51 AM
You can easily write the date and time (without the calendar):

<script type="text/javascript">var date = new Date(); document.write(date)</script>

Century
05-11-2007, 10:27 AM
Thank you techno but that' not quite what I was looking for:)

djr33
05-11-2007, 12:33 PM
That script in fact does nothing. It just prints the current date on the page, using javascript. No server side tracking of anything, no options, just placing it there.

Well, you could just use PHP and write to a file for each timestamp (number of seconds since 1970; the official way to save a date) that is taken, then add if it isn't, so it's now reserved.
Seems silly to me, when you should look into a database setup so you can keep track of all of it, by person, IP, whatever.

http://php-mysql-tutorial.com if you want to look into that.

For basic file writing (like with a .txt file) go to www.php.net and search "fwrite", "fread", and "fclose" to see how that loop works.