/    Sign up×
Community /Pin to ProfileBookmark

input from form to a Birthday script

Hi!

1) I have this birthdayscript on a website. The website is for families with children adopted from Colombia. We want to congratulate all the children on the website on their birthdays. Is it possible to make a form that writes the correct if line to a document (birthdays.txt) so I can just cut and paste the new lines into the script? The cut and paste is ment as a security so we ceep it clean (no dirty words)
2) When I got this script the name of the writer was taken out. Does anyone know who it might be. I would like to give him/her credit for the work.

<html>
<head>
<title>Birthdays</title>
</head>
<body>
<p align=”center”><font size=4 color=#000080>Today we celebrate…</font></p>
<SCRIPT>
today = new Date();
month = today.getMonth()+1;
day = today.getDate();
year = today.getFullYear();
var used = 0;

if(( month == 01 ) && ( day == 30 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname1 Lastname1 “+(year-1997)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 02 ) && ( day == 28 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname2 Lastname2 “+(year-1986)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 03 ) && ( day == 15 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname3 Lastname3 “+(year-1999)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 04 ) && ( day == 30 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname4 Lastname4 “+(year-2001)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 05 ) && ( day == 30 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname5 Lastname5 “+(year-2001)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 06 ) && ( day == 30 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname6 Lastname6 “+(year-2000)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 08 ) && ( day == 29 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname7 Lastname7 “+(year-1989)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 09 ) && ( day == 27 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname8 Lastname8 “+(year-1996)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }
if(( month == 10 ) && ( day == 29 )){ document.write( “<center><p><font size=4 color=#FF0000>Firstname9 Lastname9 “+(year-1979)+” years! <a href=mailto:[email protected]><img src=images/forum/email.gif border=0></a></font></p></center>” ); used=1; }

if( used == 0 ){ document.write( “<center><p><font size=4 color=#000080>…no one.</font><br><font size=2 color=#000080>(As we know)</font></p></center>” );}
if( used == 1 ){ document.write( “<center><p><font size=4 color=#000080>Congratulation!!</font></p></center>” );}
</SCRIPT>
</body>
</html>

Bacchus

to post a comment
JavaScript

32 Comments(s)

Copy linkTweet thisAlerts:
@PittimannMar 15.2004 — Hi!

First of all: js is not the language to write to text files.

Are the email links supposed to be the origin of the input you want to "filter" (bad words)? What I mean is, will anybody be able to send a mail and you want to avoid bad words in there?

The script you posted isn't able to display additional information. If you explained, what exactly you have in mind, we might be able to help.

Another thing concerning the script: it would easily be possible to modify it (or better: make a new one) providing easier maintenance and a more condensed code...

Cheers - Pit
Copy linkTweet thisAlerts:
@BacchusauthorMar 15.2004 — So I will have to use php or perl to handle input.

The emailaddresses are not the address where the data came from but part of the input from the user of the site.

And yes allmost anybody could send an email.

On the website we post (or the script posts) the childrens birthdays (on their birthdays) Saying that Lisa Hansen is 5 years old and Tom Petersen is 7 years old today. There is also an emailaddy so other visitors can send them a greeting.

I would realy apprecheate it if you can help me with a new script. I am open for ideas.
Copy linkTweet thisAlerts:
@PittimannMar 15.2004 — Hi!

That will make you very busy! You will have to receive all the congratulation mails, check them for unwanted contents and allow those messages, which are ok. - Lot of work!!

I do not have any idea, how many mails per kid might have to be expected and I also don't know, whether the address on the page is always the same or related to the kid, whose birthday is "today".

I also see a timing problem. If the mail address only shows up on a kid's birthday, mails will have to come in, be checked and - if ok - be put online on the same day.

Could you please tell me, how you want to handle this? I would be willing to write a js or a php script for that, but I need more input. Depending on your expectations, it might take a time to write it...

Please post everything you have in mind.

Cheers - Pit
Copy linkTweet thisAlerts:
@BacchusauthorMar 15.2004 — First one correction. The emails goes directly to the kid (or in most cases their parents mailboxes) from the sender. The data I want to check is if someone entered Adolph Hitlers birthday or Crappy Johnson...

Then: The site is build with perl (webapp) and uses flatfile databases. Today I have the script in a birthday.txt wich I post with Iframe. You can see it on www.colombiaklubben.no The birthdayscript is in the lower left side. (The site is in Norwegian)

What I realy would like is that the visitor enter the data in a form and clicks Add or Send. The data is the kids firstname, lastname, birthdate, adoptiondate, birthplace and email.

The script (or some script) writes this to a file. Then it is posted on the websites frontpage as Today we celebrate these birthdays...With firstname, lastname, age and email.

Under the kids names a link to Add, Edit, Delete, Search and List All. The list all can be a list with each kid on one line. Firstname, Lastname, Birthdate, Adoptiondate, Birthplace and Email. Maybe this list can be sorted by clicking the column title

Ooops... this got bigger than what I started out with, but still something I have been looking for some tome. Tell me if this is too much. The Collection of birthdates and posting them on frontpage has priority.
Copy linkTweet thisAlerts:
@PittimannMar 15.2004 — Hi!

Unexpectedly, my Norwegian is too weak for me to find the link to the birthday script ? (I know very few words).

Without seing it, I will face a problem in understanding, what is there so far. Anyway - after your explanations I would say: what you want is possible (maybe without js or js just being a part of it).

Could you please post the norwegian text to click (or - if it is an image - which one) to get there?

Cheers - Pit
Copy linkTweet thisAlerts:
@steelersfan88Mar 15.2004 — Sorry to but in, but just to make a suggestion, why don't you put that all in an array?

var birthdays = new Array

birthdays[0] = {day:15,month:3;year:2004;name:"My Name";email:"[email protected]"}

....

then,. all you would have to do is loop thru the array, find if any match, and if so, print it out. Of course, writing to text files ... refer to Pit's replies ?
Copy linkTweet thisAlerts:
@PittimannMar 15.2004 — Hi steelersfan88!

The arrays are already on my machine.

The main problem is, that users can submit new "array members" which will have to be checked by Bacchus, before going online and he would prefer storing them somewhere after checking.

That of course could be done in a js file, but Bacchus and I haven't proceeded that far yet...

Cheers - Pit

Btw - I like your new avatar!! ?
Copy linkTweet thisAlerts:
@BacchusauthorMar 15.2004 — Hi again!

If you go to www.colombiaklubben.no and log in with

Username: demo

Password: demo

You will see the output I have today. There are no birthdays today, but if you change your computerdate to may 5th a birthday will turn up

You find the script at www.colombiaklubben.no/files/birthdays.txt
Copy linkTweet thisAlerts:
@PittimannMar 15.2004 — Hi!

Thanks - that's enough input to start with it. As far as I am concerned: I will not be able to deal with it right now, but I will have an eye on your thread and if the stuff isn't solved by somebody else, I will deal with it.

Cheers - Pit
Copy linkTweet thisAlerts:
@PittimannMar 15.2004 — Hi!

I've had a deeper look at the code(s) and would suggest, that the script itself remains javascript, but your part would be PHP (edit, delete etc => modify the "main" file).

Unfortunately, I don't know Perl (might be better to use that, because a part of the entire site already is Perl stuff).

If you don't receive a satisfactory solution here from somebody else, I will fiddle out a mixed javascript/PHP thing to get it work these days.

Good night - Pit
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

I've started dealing with your script. Could you do me a favour and store information about new entries probably coming in these days for me seperately, so that I can insert them without redoing all the stuff?

Cheers - Pit
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

Thanks! Just in this minute I finished all the modifications concerning the output from a js file with an array. Would you please have a look, play with your machine's date a bit and tell me if that part is ok?

http://www.pit-r.de/scripts/Bacchus/Colombiaklubben.htm

Cheers - Pit
Copy linkTweet thisAlerts:
@BacchusauthorMar 16.2004 — This looks very nice
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

The js file containing the data now only has about 30% of the size of the file you are using. I will simplify it a bit more and than start with the main stuff in PHP.

If you like, you can already implement this now (because the structure for the output will remain like that).

If you need hints on how to do it, just let me know...

Cheers - Pit
Copy linkTweet thisAlerts:
@BacchusauthorMar 16.2004 — Yes I would realy like some hints. This is not what I do every day. Do you also have some new files to put somewhere?
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

Just hold on a few minutes - I have to put the files together for you!

Cheers - Pit
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

In the main page, you will have to change this:

<iframe name=cwindow src="http://www.colombiaklubben.no/birthdays.txt" width=160 scrolling=yes height=400></iframe >

to this:

<iframe name=cwindow src="http://www.colombiaklubben.no/birthdays.htm" width=160 scrolling=yes height=400></iframe >

The two files in the zip will have to be uploaded to your root directory (where you have birthdays.txt at present). That's all.

You should have in mind, that I didn't add the kids, you have in merkedager.txt! I will put them in today...

Cheers - Pit

[upl-file uuid=2b52afb0-8a00-43c6-8f61-7311df671570 size=7kB]bacchus.zip[/upl-file]
Copy linkTweet thisAlerts:
@BacchusauthorMar 16.2004 — This works great - Thank you

Do you need more input for the next part?
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

Yes - some more input needed:

Due to the fact that it would be a lot of work to split first names and family names of the kids for ordering them alphabetically (for editing entries etc.) -> would you mind, if alphabetical ordering would be done with the first name?

Would the date of birth as a second sort option be enough??

This information, I think, would do it for the moment. Just a tiny little thing concerning Colombia's birthday: I couldn't locate "colombia.ico" on your server. Maybe not important, but just to get things complete - can you direct me there, please?

Cheers - Pit
Copy linkTweet thisAlerts:
@BacchusauthorMar 16.2004 — How about putting the whole name (both first and lastname) in the field for lastname and sort that. Then the members can split the names themselves when they click edit? That is if you make one field for firstname and one for lastname?

I rather want adoptiondate and birthplace sortable. If it is difficult and/or too much to do make adoptiondate sortable. The adoptiondate is there so other members can find people they travelled to Colombia with.

I can't remember the colombia.ico, but you find colombia.gif here www.colombiaklubben.no/images/uploads/colombia.gif and here www.colombiaklubben.no/files/colombia.gif
Copy linkTweet thisAlerts:
@PittimannMar 16.2004 — Hi!

It seems, there is some major misunderstanding.

I thought, we are dealing only with the data, you used in the script:

day, month and year of birth, full name, mail address, homepage (just saw one example, but that doesn't matter) and the special icon for the country's "birthday".

So far, the birthday page didn't display anything else than that and I thought, you need to "automatize" entering exactly these data into the textfile for the script, if new kids have to be there.

If you need more than that, I would need the full sets of data for each kid. Except for those, you have in the "merkedager.txt", I only have the data I mentioned above...

Cheers - Pit
Copy linkTweet thisAlerts:
@BacchusauthorMar 16.2004 — I should of course have written it here too. In the merkedager.txt I wrote about the fields I wanted.

  • - Navn (Barnets_navn = The kids name)

  • - Fødselsdato (Birthdate)

  • - Adopsjonsdato (Adoptiondate)

  • - Fødested (Birthplace)

  • - Epost (email)
  • Copy linkTweet thisAlerts:
    @BacchusauthorMar 16.2004 — This is how the data looks like when I get it. I just haven't found out how to do this yet.

    email: [email][email protected][/email]

    realname: Parents name

    subject: Merkedager - Colombiaklubben

    Jeg_er_medlem: Ja

    Barnets_navn: Firstname Lastname

    Fodselsdato: 28/11-98

    Adopsjonsdato: 29/11-00

    Fodested:

    Melders_privattelefon: xx xx xx xx

    Melders_mobiltelefon: xxx xx xxx

    (I have as you see taken out the personal data before posting here)
    Copy linkTweet thisAlerts:
    @PittimannMar 16.2004 — Hi!

    I had seen that there of course, but in that file, there are data concerning 15 out of 217 kids...

    Apart from that: do you want the parents to be able to edit something? In that case, you would have to check things again and again. Just an example: if I wanted do do something bad to your association (you mentioned, you want to avoid, someone puts Hitler's birthday there), I would post harmless data, you check them and after they are online, I will change my "kid's" name to Hitler and change the birthday to April 20th.

    I don't think that is a good idea. I would suggest, that parents can send an email (maybe with a form made for that) to you, telling you, what has to be changed and you are the only one, to administrate the file.

    What do you think about that?

    Cheers - Pit
    Copy linkTweet thisAlerts:
    @PittimannMar 16.2004 — Hi!

    Are the data just sent to you by email or are they as well stored in some database?

    Cheers - Pit
    Copy linkTweet thisAlerts:
    @BacchusauthorMar 16.2004 — First. The 15 kids was those not added to the scrip yet.

    So clicking Add brings up an empty form with all the fields.

    Clicking Edit brings up the same form with their kids data

    In both cases the data in the form is written to a something.txt

    in this format?: bArr[0]=new Array(01,01,'firstname Lastname',1988,'[email protected]');

    Will I get an email saying there are new posts?

    Then I look at the post and cut'n paste to the birthdays.js

    That will work for the greetings on the frontpage, but maybe not for the sortable, searchable list that opens when clicking List All (This is where Adoptiondate and Birthplace are stored)

    |Firstname|Lastname|Birthdate|Adoptiondate|Birthplace|Email|

    PS I have to atend a meeting here. Will be back online at 5 pm
    Copy linkTweet thisAlerts:
    @PittimannMar 16.2004 — Hi!

    Ok - til later. I will play a bit in the meantime...

    Cheers - Pit
    Copy linkTweet thisAlerts:
    @BacchusauthorMar 16.2004 — Did you get the answers you need?
    Copy linkTweet thisAlerts:
    @PittimannMar 16.2004 — Hi!

    Not really!

    Most important: do not let the parents edit that directly! This would require another member area to be made for the site to make thinks half way safe or have your own perl guru make all the stuff we are talking about here.

    I would suggest: Parents, whose kid is already in the list, can fill a form for modifications (new email address or whatever has changed, respectively delete their kid from the list). You will receive an email, check it and use the edit feature (still to be written) to comfortably accept changes.

    The edit/add/delete feature can be used by you only!

    Logged in members can view the entire list (no edit, no delete!) sorted by name, birth date, adoption date and birth place - as they wish. Email icon and homepage icon will be links to open an email window or the kids homepage.

    I would need more adoption dates and all the birth places for continuing...

    Cheers - Pit
    Copy linkTweet thisAlerts:
    @BacchusauthorMar 16.2004 — I aggree to you suggestion. I think that's a smart way to do this.

    As for the adoption dates and birthplaces: They wil have to be updated by the parents. (they email this to me) I was so smart and deleted the emails after putting the data in the script...I know...Very smart of me.

    Will it help if I gave you the dates and birthplace for two kids?

    I can send the data as PM. The rest will have to be blank fields till they (parents) send an email with updates.
    Copy linkTweet thisAlerts:
    @PittimannMar 16.2004 — Hi!

    Well - you will be able to add the adoption dates and birth places with the script I have prepared. Anyway, it would be nice to get a few birth places (I already have several adoption dates).

    Did you receive my pm?

    Have a nice evening (already quite late) - Pit
    ×

    Success!

    Help @Bacchus spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...