anyone know how to set up a cgi script "formail"

Discussion in 'OT Technology' started by netkilla, Sep 16, 2006.

  1. netkilla

    netkilla Guest

  2. purebad

    purebad I don't need your approval, right?

    Joined:
    Aug 25, 2006
    Messages:
    4,376
    Likes Received:
    0
    Location:
    Smyrna, GA
    Php Ftw!
     
  3. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Dude... which formmail.pl?
     
  4. netkilla

    netkilla Guest

  5. m2e

    m2e OT Supporter

    Joined:
    Aug 9, 2004
    Messages:
    48,119
    Likes Received:
    53
    Location:
    US
    Taken from www.entensity.net (nws for ads)

    PHP:
    PHP Tutorials [Form Mailer]
    Well first before go start make sure your host supports php or this script wont workOK?
     
    OK first since were dealing with php d/l this very easy script I found here
    Now open up formail.php,I'm showing you how to configure the script now..ok find this:
     
    --------------------------
    // referers.. domains/ips that you will allow forms to
    // reside on.
    $referers = array ('
    yourdomain.com','www.yourdomain.com','216.64.145.194');
    ---------------------------
     
    Just just change the areas in bold (if u don'
    t know your host ip just leave it alone)
    OK now right below it you should see this:
     
    -------------------------
    // banned emails, these will be email addresses of people
    // who are blocked from using the script (requested)
    $banlist = array ([email protected]'[email protected]'[email protected]');
    -------------------------
     
    Change the areas in bold in order to block that certain email addy
    Example
    :
    The best thing to do is put email addys so dumbasses wont just push enter an send a blank form so say like mine I have:
    E-mail
    Put for a banned email addy "[email protected]an it will give an error as "banned email addy" ,so just change it up to whatever you put as your form,got it?
    Now that's all the needed configuring,upload formail.php in your cgi-bin then CHMOD it 777 (what'sCHMODingclick here)
    OK now lets make your form,in the script u just d/led it has an example form ,but I'm going to show you an easier way...
     
    -First thing you need to do on making a form mailer insert this tag:
     
    ------------------------------
    <form action=http://www.yoursite.com/cgi-bin/formmail.php
    method=post>
    --------------------------------
     
    -Next make a table with 5 rows and 2 columns with border 0
    Now in the in the columns put these in this order
    -Subject
    -E-mail
    -Url
    -Message
    You can change those later, just use this until you get it working right
    -Next in the 2nd column, first row insert this tag
     
    ------------------- 
    <input class=forms size=23 name=subject2 value="type subject here">
    ------------------------
     
    -Next under that in the next row insert this tag
     
    --------------------------
    <input class=forms size=23 name=email value="[email protected]">
    ---------------------------
     
    -Next under that in the next row insert this tag
     
    --------------------
    <input class=forms size=23 name=url value="http://">
    --------------------
     
    -Next under that in the next row insert this tag
     
    ---------------------
    <TEXTAREA class=forms name=message rows=5 cols=35 >huh?</TEXTAREA>
    --------------------------
     
    -Next in the last row insert your buttons or button
     
    ------------------
    <input type="submit" name="Submit" value="Enter"> | <input type="reset" name="reset" value="Reset">
    ----------------------
     
    -OK now for the hidden fields just put these under the table
     
    -----------------------------
    <input type=hidden [email protected] name=recipient>
    ----------------------------------- 
    <input type=hidden value=subject,email,message name=required>
    ------------------------------------------------
    <input type=hidden value=http://www.yoursite.com/emailsent.htm name=redirect>
    ------------------------------
     
    (For the redirect one, well you don'
    t have to do it but it makes your form better so make a new page an type what u want it to say and save it as "emailsent.htm")
    -
    OK finally end your form with this:
     
    -------------
    </
    form>
    -------------
     
    OK now that's basically how to set up your form except you'll need to make it look all nice the way you want to ,just play with it until you get it to look really nice ,like the one I made belowOn a note my form is disabled,an if you cant get it to work right ask questions in the forums
     
  6. Nefarious77

    Nefarious77 Guest

    We use matt's formmail.pl script all the time. Here the easy setup:

    First make sure the shebang is correct for your server's path

    First line #!/usr/bin/perl should match where perl is stored on the server.

    Next you will want to make another change a few lines down (32 lines, actually) that reads:

    @referers = ('scriptarchive.com','209.196.21.3');

    Change this to:

    @referers = ('yourdomain.com');

    Be sure to put your domain in there and don't leave out the parenthesis and apostrophe's around it.

    Now save the changes you made and close the file.

    Next you will need to upload the file to your server using an FTP program.

    Upload the file into your cgi-bin folder and then change the permissions to 755. On most ftp programs this is done by right clicking on the file and choosing "file attributes", "permissions" , or "UNIX CHMOD".

    Your Formmail.pl file is now ready. Next you will need to have your html form submit the data to the FormMail.pl file. This is done in the beginning html tag for your form. An example would be:

    Code:
    <html>
    <title>FormMail Example Form</title>
    <body bgcolor="white">
    <form action="cgi-bin/FormMail.pl" method=POST>
    Subject: <input type=text name="subject"><br>
    Comment: <input type=text name="comment"><br>
    <input type=hidden name="recipient" value="[email protected]">
    <input type="submit" name="submit">
    </body>
    </html>
    
     
  7. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Imagine that... separating the view from the controller. Didn't someone write about that once?
     

Share This Page