Lunarpages Web Hosting Forum

Scripting Languages Hosting Help => C++ / PERL / CGI Support => Topic started by: flavor76 on October 27, 2004, 08:37:14 AM

Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 08:37:14 AM
Hi,

My forms on my website was working until formmail was not allowed on lunarpages due to spamming concerns.

My web-designer has left the company and i'm left with forms that is not working.

My script:
<form action="http://www.aycez.com/cgi-bin/FormMail.cgi" method="POST" onSubmit="return CheckMsgFrm(this);">
<input type="hidden" name="recipient" value="sales.enquiry@aycez.com">
<input type="hidden" name="subject" value="Enquiry/Biz Opportunity">
<input type="hidden" name="redirect" value="http://www.aycez.com/thankyou.html">

I'm not familiar with scripts. Dunno wat to do......

Can anyone help ?

Thanx.
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 08:42:01 AM
Hi there,

First of all you shlould look and tell us what cgi you are running to do the job.
If it is NMS formmail or TFMail it should be okay. Althought you *will* have to change it's name as LP doesn't allow running scripts with the words form nor mail in their name.
You can find this info by downloading the cgi script that is named FormMail here and editing it in a text-only editor.

Once this done, you may have to change the script to switch to one I mentionned above. I can walk you through if you want.
Have a look and carefully read this post, it may help  :thumb:
http://www.lunarforums.com/forum/viewtopic.php?t=20913

EDIT : BTW, Welcome to LunarForums  :yey:
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 08:55:50 AM
have downloaded the compact formmail and renamed to aycez.pl

wat should i do next ?
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 09:08:58 AM
With a text only editor, open the newly baptized aycez.pl

Quote

From the how-to :
2) Make sure that your changes to the following configs (located at the beginning part of the script) look like this:
Code:
$mailprog = '/usr/sbin/sendmail -oi -t';
Code:
$postmaster = 'user@yourdomain.com';
Code:
@referers = qw(yourdomain.com localhost);
Code:
@allow_mail_to = qw(user@yourdomain.com localhost);
Code:
From: user@yourdomain.com


* NOTE: "yourdomain.com" and "user" should be replaced with whatever your domain name and email addy would be.

 

Now, make sure you don't erase a ; sign at the end of the lines, nor the qw thing

in other words, the only things you need to change by now are yourdomain.com and user@yourdomain.com to suit your case.

once done, quickly double check no ; nor ( ) misses and save back the file.
At that point you can upload it to your cgi-bin folder in ascii mode and make sure to chage the chmod to 755 with your ftp client.

just let me know, well shall then have a look at the contact form..
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 09:11:03 AM
hi,

the .pl file contains lots of texts....

sorri...i really not familiar with this stuff....think you got to walk with me on this
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 09:18:19 AM
No problem, I guess that's why I hang aroung here  :wink:

however, regarding your script, there is a lot of text indeed  :P
but the part that is important to us right now is just after the line which states :
Quote
# USER CONFIGURATION SECTION

this is around line 31.
You ust have to read around that part and make the chages i mentioned above, making sure you do replace user@yourdomain.com by the email address you use for receiving those messages, and of course, yourdomain.com with your domin's name.

Let me know if you are really lost  :thumb:
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 09:25:33 AM
okie let me disgest a bit....and read them......

okie....now my texts looks like this:
# USER CONFIGURATION SECTION
$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'sales.enquuiry@aycez.com@aycez.com';
@referers = qw(aycez.com localhost);
@allow_mail_to = qw(sales.enquiry@aycez.com localhost);
From: sales.enquiry@aycez.com

Is this correct ?
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 09:30:34 AM
sorri....

should be:

# USER CUSTOMISATION SECTION

$mailprog = '/usr/sbin/sendmail -oi -t';
$postmaster = 'sales.enquiry@aycez.com';
@referers = qw(aycez.com localhost);
@allow_mail_to = qw(sales.enquiry@aycez.com localhost);
From: sales.enquiry@aycez.com

# USER CUSTOMISATION << END >>

wat is next then ? thanx....
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 09:33:33 AM
Quote

$postmaster = 'sales.enquuiry@aycez.com@aycez.com';

Should look like this :
Quote

$postmaster = 'sales.enquuiry@aycez.com';


Otherwise it is correct.
now upload this pl file to your cgi-cin directory with an FTP client, and while you're there, just delete the old 'FormMail.pl' file.
Do not forget to change the chmod of the aycez.pl file to 755

Then we'll have a look to your form file. Can you please give the adress so I can take a look at your submission form, i'll get the changes you'll have to do so I can tell you :wink:
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 09:36:29 AM
sorri......

how do i change the chmod to 755 when i upload

i'm using ftp commander.....

address is aycez.com/contactus.html

thanx......
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 09:43:53 AM
Errr... i actually dont know FTP commander that well so I won't be able to help...
But that won't stop us  :wink:  I have a workaround ! 8-)
Go to your cPanel and choose File Manager. Browse to your aycez.pl file by clicking the folder icon next to www then next to cgi-bin. your file shoulb be there.
Clicking on that file will make it appear on the upper right side of the window and you'll get the 'Change Permissions' command. Give it a shot !
You'll see a little table where you can enter the 7 5 5 pattern and click on change to get it done.
Won't be stuck that easy :poke:

Meanwhile, i'll be looking at your form  :wink:
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 09:51:27 AM
done!

thanx....change the permission to 755...

wat's next ? i'm getting excited now....
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 09:55:17 AM
DAMN ! this is one of a form you have here !
can you provide me some details about how all those fiels were sent tou you ? I mean how did they appear in the mail ?
Were there something like :
Quote
Mr firstName LastName
Job title :
Department :
Direct phone :
...
Message : etc...


if so i'll have to make some changes inside the pl file foe it to handle all those informations.. Please, just tell me that this is how the informations are transmitted  :-?
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 09:59:53 AM
honestly.....this is done by my ex-designer who have since left the company....

but when it was working......i received via email in the format:
Firstname:
Lastname:
JobTitle:
etc.......

like the ones you mentioned.....

so can this be done ? thanx.........
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 10:06:25 AM
Okay, i assume you don't mind some minor changes in the layout of the info you receive ?

If it possible... however, i'll have to make some changes into the script so it can take all that bunch of informations and make something with it  :wink:
We may have some minors modifications to make to the form then... but nearly nothing.

If you leave me a few moments, i'll try and modify the script for you... hou'll have to redownload it from my place and replace the one we uploaded a few moments ago, then a little 755 chmoding, and if all goes well, it should be okay  :thumb:

Sorry for the delay.  :? Didn't realized that your form could be so 'complicated'.

But i won't give up...I'm getting to it now, i'll let you know when i'm okay with it.
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 10:10:58 AM
no problem.....be my guest...it was not working anyway......trying to make it work is a top priority.....

thanx for the help....really appreciate it..........
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 10:12:50 AM
errr.... parsing the code give me a little doubt indeed.

Can you please try the following :
In your form, from where you took this information :
Quote
<form action="http://www.aycez.com/cgi-bin/FormMail.cgi" method="POST" onSubmit="return CheckMsgFrm(this);">
<input type="hidden" name="recipient" value="sales.enquiry@aycez.com">
<input type="hidden" name="subject" value="Enquiry/Biz Opportunity">
<input type="hidden" name="redirect" value="http://www.aycez.com/thankyou.html">


Make it look like this :
Quote
<form action="http://www.aycez.com/cgi-bin/aycez.pl" method="POST" onSubmit="return CheckMsgFrm(this);">

<input type="hidden" name="subject" value="Enquiry/Biz Opportunity">
<input type="hidden" name="redirect" value="http://www.aycez.com/thankyou.html">


Then, give your form a try... It is possible that the script handles every field you send to him...
Please, test this and let me know about how's the mail you receive looks like...
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 10:14:21 AM
okie.........give me a moment
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 10:19:44 AM
just changed the html file and uploaded it but......

the form cannot work

Error:
"The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed. "

pls advise....
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 10:38:03 AM
???
Allright... when I go to your form and try to send it, I do receive a 500 error... which means there is a problem with the script itself...

Please, just try and take the aycez.pl file you have modified in the first place, and re try uploading it into your cgi-bin directory, giving it the 755 chmod setting...
Then let me know !

For the good news part, i tested your form and your script here at home... all is working as expected !
This means we're gonna get it  :thumb:
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 10:40:09 AM
okie......let me try
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 10:44:11 AM
err.....i still get the http 500 internal server error......

shit !
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 10:47:30 AM
I'll PM you
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:04:09 AM
Allright, what I'll do is making a zip file for you containing both the form HTML page and the aycez.pl files.
As soon as you'll have this downloaded, i'll delete it from the server.

Anyway, donwload the file and uncompress it to get your hand on the two files I mentioned...
then upload the .pl file to cgi-bin and chmod it 755
and upload the form file to replace your ancient one.

then give it a try okay ?

In a few minutes, the URL will be the following. Just follow it to download the files...
http://www.sws-web.net/aycez-form.zip
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:05:58 AM
okie..........will let you know once i have downloaded the file
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:08:13 AM
OH ! btw, i need to know if both forms are to be sent to sales.inquiry@aycez.com ?
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:09:22 AM
yes....both forms will be sent to sales.enquiry@aycez.com "not"
sales.inquiry@aycez.com
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:14:49 AM
allright, you can download it...

I think all this is kind of my fault... I think I know where the error is

You can upload both files but be sure to upload the aycez.pl file into you cgi-bin directory in ascii mode !
then chmod it 755. the normal chmod for the html file is 644, if you wonder.

It should work then
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:18:44 AM
btw.....the new contactus.html file seems to be different in terms of fonts and layout when i preview it.......should i go ahead and upload it ?

pls advise....
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:24:53 AM
I think it's only related to the stylesheet not being included when you look at it locally... anyway, if you want to be sure, just rename the file to contactus2.html then upload it.

BTW, please, edit aycez.pl for a change I forgot and change this :
Quote
 $style             = '/css/nms.css';

to
Quote
 $style             = 'http://www.aycez.com/styles/styles3.css';


Then again, just upload it, be sure to upload it in ascii mode and to set the chmod.
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:26:45 AM
hey.....the form works.......i am still using the previous contactus.html file....

but the sender is nobody@lyra.lunarpages.com......


another thing: Do my form also send reply emails to enquirers as well ?
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:34:32 AM
yes the original form works, i just got a couple of lines which weren't required out, but it works :)

The form can send replies to your enquirers, for this you only have to put :

Quote
 $send_confirmation_mail = 0;

to
Quote
 $send_confirmation_mail = 1;


and maybe you would want to tweak the confirmation text that is displayed just a few lines below. The default text being :
Quote
Thank you for your form submission.


As for the sender, it should be what you inserted into the $postmaster value...
investigating...

did you changed

Quote
$style = '/css/nms.css';

to
Quote
$style = 'http://www.aycez.com/styles/styles3.css';

as well ?
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:39:08 AM
yes......have changed the $style

Fei Chang Xie Xie Ni.......you've been really helpful on this.....

(means "Thank you very much" in Mandarin)

btw....if i have another form, do i have to use another database ?
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:45:55 AM
o domo arigato (japanese style)  :thumb:

sorry again this has taken this long ! There are a couple of things i should have figured quicker ! sorry again  :oops:

Regarding you second form... No this script is able to handle various forms with a little tweaking.
This is taken from the readme file you shall find into the orginial script's package :
Quote
%recipient_alias    - A hash for predefining a list of recipients in the
                      script, and then choosing between them using the
                      recipient form field, while keeping all the email
                      addresses out of the HTML so that they don't get
                      collected by address harvesters and sent junk email.

                      For example, suppose you have three forms on your
                      site, and you want each to submit to a different email
                      address and you want to keep the addresses hidden.
                      You might set up %recipient_alias like this:

                      %recipient_alias = (
                        '1' => 'one@your.domain',
                        '2' => 'two@your.domain',
                        '3' => 'three@your.domain',
                      );

                      In the HTML form that should submit to the recipient
                      'two@your.domain', you would then set the recipient
                      with:

                      <input type="hidden" name="recipient" value="2" />

                      The recipients in %recipient_alias are automatically added
                      to the allowed recipients list, so there's no need to list
                      them all in @allow_mail_to as well.


However should all of your forms send to the same address, you just need to have the from action defined to point to the script and maybe changing the hidden field "subject" setting... without any other change..

regarding the fact that the sender of your mails is not the value you entered in postmaster, i don't understand... as it should be so ! you may try to change the sender address to something without a dot like webmaster@aycez.com provided you have that email address, and give it another try...
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:48:46 AM
no problem....you have really help me a lot......i should be the one saying sorry for taking up your time....

will try other emails for the postmaster....
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:50:19 AM
okay, let me know, i'm interested in the result...

This is something i just can't figure out...
If it still doesn't maybe another topic for asking this would be a good idea
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 11:52:17 AM
yea.....

seems like you like your job very much.... i will be frustrated with all this scripts stuffs...........
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 11:57:09 AM
not really my job but... most of all I don't like not understanding why...

BTW, i checked you form file source... you should give a try to the second form too... I got an error when i did a 'page not found' after hitting the submit button... but got the mail anyway.

If this is the case, these are the relevant lines in the code (down to the lines 451 & 453)
Quote
     <form name="speakerform" method="post" action="/cgi-bin/aycez.pl" onSubmit="return CheckSpkrFrm(this);">
       
        <input type=hidden name="redirect" value="/thankyou.html">

should look :
Quote
     <form name="speakerform" method="post" action="http://www.aycez.com/cgi-bin/aycez.pl" onSubmit="return CheckSpkrFrm(this);">
       
        <input type=hidden name="redirect" value="http://www.aycez.com/thankyou.html">
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 12:05:58 PM
no problems with 2nd form as well.....

but after changing the email for postmaster....still gives nobody@lyra.lunarpages.com....and no reply email received for enquirer...
below is my latest code:
Quote

BEGIN
{
  $DEBUGGING         = 0;
  $emulate_matts_code= 0;
  $secure            = 1;
  $allow_empty_ref   = 1;
  $max_recipients    = 1;
  $mailprog          = '/usr/lib/sendmail -oi -t';
  $postmaster        = 'sales@aycez.com';
  @referers          = qw(aycez.com www.aycez.com localhost);
  @allow_mail_to     = qw(sales.enquiry@aycez.com localhost);
  @recipients        = ();
  %recipient_alias   = ();
  @valid_ENV         = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
  $locale            = '';
  $charset           = 'iso-8859-1';
  $date_fmt          = '%A, %B %d, %Y at %H:%M:%S';
  $style             = 'http://www.aycez.com/styles/styles3.css';
  $no_content        = 0;
  $double_spacing    = 1;
  $wrap_text         = 0;
  $wrap_style        = 1;
  $address_style     = 0;
  $send_confirmation_mail = 1;
  $confirmation_text = <<'END_OF_CONFIRMATION';
From: sales.enquiry@aycez.com
Subject: Enquiry/Biz Opportunity Form submission

Thank you for your form submission. Our staff will be contacting you shortly.

END_OF_CONFIRMATION
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 12:16:11 PM
I  think I know why you don't have reply... this is because the field where you ask for email on your form is not treated as an email address... it is treated as any other data from the form. So the script doesn't take it for an address, and thus cannot send backt to it..

There are two ways to change this... 3 in fact :
1 - you add a line into the script to make the sender address = the field he as entered. this should work, however, it makes the script a little more specialized in that form and it won't be as easy to use it for another if you don't use the same field name for the email info.
2 - you add a line in the form to make the sender adress = the field he has entered. This is the better way I think. as it leaves the script untuched.
3 - you turn back the value to 0 and let off the confirmation mail.

I'm writing the lines you would need to insert in your form to get this working, let me know if you want them...

As for postmaster  :?  Try an open a new topic for this issue, someone else may figure out why this happens... specifying this occurs in NMS frommail script
Title: Problems with forms, pls help !
Post by: flavor76 on October 27, 2004, 12:20:18 PM
hey if you dun find it troublesome....i dun mind adding the lines to my forms for the confirmation email.....thanx again

i will open a new topic but dunno wat to put for the title.......
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 12:21:43 PM
try : NMS formmail sening as nobody@lyra.lunarpages.com

okay.. let me write something diwn and test it :)
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 12:52:23 PM
Allright, i got it

In your form HTML file, make this (lines 71 to 76 I think)
Code: [Select]
//if(formobj.DirectEmail.value.length == 0)
//{
// alert("Direct Email Address is a required field");
// formobj.DirectEmail.focus();
// return false;
//}

Look like this :
Code: [Select]
if(formobj.DirectEmail.value.length != 0)
{formobj.email.value = formobj.DirectEmail.value;
return true;
}
//if(formobj.DirectEmail.value.length == 0)
//{
// alert("Direct Email Address is a required field");
// formobj.DirectEmail.focus();
// return false;
//}


Then make each DirectEmail fields (one around 309 and the other around 548) :
Code: [Select]
             <input type="text" name="DirectEmail" class="frminput">
like this :
Code: [Select]

              <input type="text" name="DirectEmail" class="frminput">
              <input type="hidden" name="email" class="frminput">

and give it a try, this should duplicate the DirectEmail value and send it to the script as the email adress of the sender...
Moreover, it seems that this solves the sender adress problem (or something else has occured meanwhile...)

Give it a try and tell me about it...
I can give you the file if you are lost.
Title: Problems with forms, pls help !
Post by: Pete on October 27, 2004, 01:11:28 PM
Hi guys.
Ive been asked to advise you, you need to read Leighsww's Setting up NMS FormMail how to at
http://www.lunarforums.com/forum/index.php?topic=18221.0

You are apparently on the wrong track with the $postmaster config (regarding the nobody@lyra.lunarpages.com issue). You need to look at instruction #2 under "The HTML FORM" portion of the instructions on the  tutorial. :thumb:
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 01:17:23 PM
Quote
Ive been asked to advise you

You have ? who sends you ? now talk  :whip:


Thanks for the clue Pete, I did read the howto...
however the readme file gives a little something more :
Quote
$postmaster         - The envelope sender address to use for all emails
                      sent by the script.
This address will recieve bounce
                      messages if any of the emails cannot be delivered.  If
                      in doubt, put your own email address here.


So I've assumed that this was the sender's email showed in the automated reply for example... but of course, I may be wrong  :?
gotta investigate this a little to be sure if you may  :poke:

Thanks man :thumb:

EDIT : all right allright... silly me ! there is actually a field for the confirmation mail... so I guess the issue came with the fact that the script didn't get the adress of the sender before my little mods up there...
Title: Problems with forms, pls help !
Post by: Pete on October 27, 2004, 05:49:33 PM
SOMEONES not reading the tutorial carefully. :whip:
Nor the "README" file properly either :whip: , because if you accurately read the $postmaster configs, the bit bolded in RED
 $postmaster - The envelope sender address to use for all emails sent by the script. This address will recieve bounce messages if any of the emails cannot be delivered. If in doubt, put your own email address here. , is what gives the definition of what that variable does. It's ONLY for "bounced" emails and has nothing to do with the "From:" header. The "email" value is what will change that "nobody@server.lunarpages.com" to the sender's email addy.
Title: Problems with forms, pls help !
Post by: talloth_endill on October 27, 2004, 05:57:31 PM
err okay okay...
I did read carefully the readme, however, the "for all the emails sent by the script" bit got me into the wrong direction. That's all.
As for the "email" value story, that's what i figured out after you point the problem out the first time...
Anyway, no need to get *that* angry.

(http://www.sws-web.net/images/avatar/cryin.gif) don't whip me ! lol