PDA

View Full Version : Help Me Plz,am Befor the Beginner :$


eXe
08-01-2005, 06:09 PM
HI everbody
am new user here
and i realy tried alot of ways to make cgiemail and i did not succeed
and iam beginner in these things
all what i want is the following:
i will make form with 2 inputs,and one command bottom (send)
when any user check this form and put the data inside this 2 inputs
and then press over the command bottom,these data the user put them i want form to send me them to an e-mail address i choose
so if u plz give me the form and a good free webhosting to upload the cgi script on it, am before the beginner status,but if u told me how to do clearly and step by step and a gr8 student i can understand directly
wish all of u tell me your experiences to me to know how to make it
thanks alot and am waiting your replies :thumbsup:

Note:
when the user check my form and press over the command bottom,i dont want the data he/she entered to appear in another page,i want when he/she press over the command bottom take it to url i define it for the script

Aradon
08-01-2005, 07:47 PM
Have you come up with any code on your own? I'm not totally thrilled about writing code that I"m not getting paid for. But here are a couple things that will help you along your way:


http://search.cpan.org/~lds/CGI.pm-3.10/CGI.pm
http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm
http://www.codingforums.com/showpost.php?p=339323&postcount=5

(thanks Fishmonger, I stole the first two from a previous thread :D )

There are also several threads on this forum already about the subject. Let us know what you come up with. (If you want someone to write it for you www.rentacoder.com I think is a good address)

Edit: It seems I mis-understood what you were saying as well. What I was looking for at the time was examples of what you are using currently etc. I figured you wanted us to write it for you. My fault.

eXe
08-01-2005, 07:53 PM
look as i told u
if u want cgi script i have alot
but i dnt know what to do with them
if u dnt care for helping me then dnt come and say i will not write a code for you,u dnt know what help means? :confused:
so if u dnt want to help,no need to post any reply anymore in my subject,others will do,and i know there are alot of good people who help others just for they are great people not for gain money :mad:

eXe
08-01-2005, 08:10 PM
guys i have these scripts
one i brought it from here and the other i downloaded it from another website
so anyone want realy to help me and teach me i will be very thanks for him or her

1st Script (http://www.geocities.com/w_a_n_2004/bizmail2_2.zip)

2nd Script (http://www.geocities.com/w_a_n_2004/formmail.zip)

mlseim
08-01-2005, 08:24 PM
eXe ...

Here is a place where you can host for free w/Perl (cgi-bin), PHP.

"Free" means that it's free, but every page has a fixed ad banner at the top.

http://www.netfirms.com/web-hosting-free

----------------

You need to know how to do these things:

1) Use an FTP program to upload your scripts into your cgi-bin directory.
2) How to set script permissions using the FTP program (CHMOD).

Netfirms has a help section on using FTP, your cgi-bin, etc.

----------------

Once you get that set up, run this script to see if it works. It's a simple
"Hello World" script that tests the function of your cgi-bin.

#!/usr/bin/perl

use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $query = new CGI;
my $date = localtime();

print $query->header();

print "
<html>
<head>
<title>The Famous Hello World Example ;-)</title>
</head>
<body bgcolor=\"\#fffcc9\">
<h1>The Famous Hello World Example </h1>
<p> The date is $date </p>
<hr noshade=\"noshade\";>
</body>
</html>
";

If you can get that script to run without any errors in loading, CHMOD, etc.
let us know ... we can't help you unless you can do this basic task.

Google is your best method to get help: Search for "Perl tutorial".


EDIT: eXe ... this is not a chatroom. You can type using full English
words and sentences. I'm having a hard time reading your posts. I'm
44 years old and can't read chatroom slang.


.

FishMonger
08-01-2005, 08:43 PM
The NMS FormMail script is an excellent script but overkill for what you need, especially considering that you are a beginner. I wouldn’t even consider using the BizMail script; not only is it overkill but it’s NOT written very well.

In your case, I’d start out with something very simple and once you build up a little more knowledge and require the need, you can switch over to the NMS FormMail script. Aradon provided you with good info that shows you how to do this, so you should look at those links.

Edit:
mlseim's example is a good starting point.

netroact
08-02-2005, 08:32 AM
I don't think that is chatroom slang. I think the poster has a native language other than English. Any slang in there was probably derived from online conversations with an English speaking person.

eXe
08-02-2005, 06:07 PM
thnx my bro mlseim
1st of all for people who say that am not english,yeah am not english person
and if you are with apartheid (netroact)
anyway, iam using internet from 5 years and i have knolege in computer
but in webprograming and zero,but i know html,not professional but i can make pages and also without frontpage,with coding over notepad
so my bro mlseim,i have already two accounts over netfirms
and i've uploaded the script but they said contact the customer
i will save the code u wrote as cgi script and upload it,then call it from any browser?
or what to do with it?
u got what i need from the form i want to make?
plz if u want contact me at My Messenger (Cracker@CracKerZ-LanD.net)
and realy thanks for your help

eXe
08-02-2005, 06:32 PM
by the way i have these two FTP programs to upload and i know how to CHMOD,1st program is : cuteftppro 2nd program is : WSFTP_ProT40_Install

so i wish you can tell me how,i will tell you gain what i want the cgi script to do:

i want to put the cgi script in my form html coding like :
<form method=POST action="http://xxx.netfirms.com/cgi-bin/mailform.cgi">
<input type="hidden" name="CMD" value="CMDSubmitFormElement">
<input type="hidden" name="FORM_SUBMIT_EMAIL_submit" value="xxxxxx@msn.com">

when he/she press over Submit Command directly the script send me e-mail to my x email inbox with the data,and the script dnt post the data on another page and let the visitor see it,it can direct it to any other page

i were using this coding

<FORM method=post action="http://hotmail.homestead.com/~site/Scripts_ElementMailer/ElementMailer.dll" target=_top>
<input type="hidden" name="CMD" value="CMDSubmitFormElement">
<input type="hidden" name="FORM_SUBMIT_EMAIL_submit" value="xxxxxx@msn.com">

but there is an error in the server of the website the script found over it

now i think the idea is very clear
thanks again in helping me mlseim and every one wana help

eXe
08-02-2005, 07:41 PM
mlseim i've just test the small example u gave me and it wrok :thumbsup:
so whats the other step? :confused:
by the way,i can creat any html page within the two print tags?
after the print $query->header();

print "
(i mean here)

and it must be on the same page the server is

but if i want to creat one and put it on another website,so can i? and what is the different in the coding?

joeframbach
08-02-2005, 07:45 PM
eXe,
This thread (http://www.codingforums.com/showthread.php?t=64701) may be able to help you. In particular, Fishmonger's post (the fourth one down the page). Again, read the cpan documentation regarding the mail modules.

Best of luck!

mlseim
08-02-2005, 09:49 PM
eXe,

That test script was just to let us know you have your cgi-bin
working correctly. You don't need that script anymore, unless you
want to play around with it. ... and yes, you can make it display
any HTML that you want. A good way to learn about simple dynamic
HTML generation.

The Perl script opens the browser with it's own HTML ... it is not on
a webpage, just displays on the browser.

-----------------

I didn't understand the part about "mailform.cgi".

Did you say it is working OK on Netfirms?

... or ... it is failing?

FishMonger
08-03-2005, 02:53 AM
A more condensed version of the "Hello World" script.

#!/usr/bin/perl -w

use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $q = new CGI;

print $q->header, # create the HTTP header
$q->start_html('hello world'), # start the HTML
$q->h1('Hello World!'), # level 1 header
$q->h2('It is now: '. scalar localtime); # date & time w/ level 2 header
$q->end_html; # end the HTML

FishMonger
08-03-2005, 04:09 AM
Here's another short example that creates a simple form that is submitted to itself for processing and sending the email. It should include returning a confirmation to the user once submited but I'll leave that up to you work out.

use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use MIME::lite;

my $q = new CGI;
my %form = $q->Vars;

print $q->header, $q->start_html('Who are you');

# This is a self refering form/script
# meaning, it's submitted to itself
print $q->start_form,
'Sex: ', $q->radio_group(-name=>'sex', -values=>['Male','Female']), $q->p,
'First Name: ', $q->textfield('firstname', '', 15, 25), q->br,
'Last Name: ', $q->textfield('lastname', '', 15, 25), '<p>',
$q->submit('form','SUBMIT'),
$q->end_form,
$q->end_html;


if ($form{'firstname'} || $form{'lastname'}) {
my $message = "First Name: $form{'firstname'}<br>\n".
"Last Name: $form{'lastname'}<br>\n".
"Sex: $form{'sex'}";

my $msg = MIME::Lite->new(
From => 'me@myhost.com',
To => 'xxxxxx@msn.com',
Subject => 'Form Submission',
Data => $message
);
$msg->send;
}

eXe
08-03-2005, 06:54 PM
FishMonger,
look what i got when i test ur script

Software error:
Can't locate MIME/lite.pm in @INC (@INC contains: /usr/local/nf/lib/perl5/5.8.3/i386-freebsd /usr/local/nf/lib/perl5/5.8.3 /usr/local/nf/lib/perl5/site_perl/5.8.3/i386-freebsd /usr/local/nf/lib/perl5/site_perl/5.8.3 /usr/local/nf/lib/perl5/site_perl .) at 2.cgi line 4.
BEGIN failed--compilation aborted at 2.cgi line 4.

For help, please send mail to the webmaster (support@netfirms.com), giving this error message and the time and date of the error


-----------------------------
whats the problem then?



mlseim,
u said that i can put any code for any html
so can i put any source code for anypage under the print command? this is 1st

2nd:did u understand what i want?
and in the coding u said or not u FishMonger wrote From => 'me@myhost.com', , i dont know what to write in it :rolleyes:
i gave u an example abt a form i were using in my coding webpage
<FORM method=post action="http://hotmail.homestead.com/~site/Scripts_ElementMailer/ElementMailer.dll" target=_top>
<input type="hidden" name="CMD" value="CMDSubmitFormElement">
<input type="hidden" name="FORM_SUBMIT_EMAIL_submit" value="xxxxxx@msn.com">

i dnt even have account over homestead website
i just put that code in my webpage and when the user press over the command bottom i got e-mail with the data the user put

if u did not understand plz mail me or add me and we can talk on the messenger

mlseim
08-03-2005, 07:03 PM
eXe,

Give us a link to your HTML form.

If I can see your form, I can provide a better example of how
to send the form to an email address.

FishMonger
08-03-2005, 07:41 PM
Software error:
Can't locate MIME/lite.pm in @INCIs telling you that the MIME::lite module (for sending the email) is not installed. You could install it within your own home directory but at this point, that's beyond your current knowledge and you probably wouldn't understand our explaination. We could try the Net::SMTP module instead of MIME::lite.

Do you have telnet access to your web directoies? If so, run this command and if you don't receive any error, I'll give you an example how to send the email.
perl -MNet::SMTP -e 1

FishMonger wrote From => 'me@myhost.com', , i dont know what to write in itYou put in your email address.

eXe
08-03-2005, 09:18 PM
FishMonger,
i dnt know how to use telnet am rly sorry
but give me example using smtp and i will test it
and i will give you the result


mlseim,
my webpage is very simple one
all what i want these 3 lines

<form action=" here the script that will send me the data">
<input type=text name=email size =20>
<input type=text name=subject size =20>
<input type=submit value=Submit>
</form>

when the user put his mail and the subject and press over the submit
the script send to my e-mail the data he entered

and the script dnt show him the data he entered in another page,when he press over the submit,it send him to another page i write its code

i think now everything is very clear

mlseim
08-03-2005, 09:43 PM
eXe ...

Now, I realize this example is not yet what you want ... but start out with
this and get it working ... then we'll add onto it.

Here is what your HTML form should look like:
You need to enter your domain name into the form action line.
<form action="http://www.mysite.netfirms.com/cgi-bin/email123.cgi" method="post">
Email Address: <input type="text" name="email" size ="20"><br>
Subject: <input type="text" name="subject" size ="20"><br>
Message: <textarea name="message" cols="60" rows="6"></textarea><br>
<input type="submit" value="Submit">
</form>

Now, copy this script and name it: "email123.cgi"
Use your FTP to upload it into your cgi-bin and CHMOD to 755.
#!/usr/bin/perl

use CGI ':standard';

$email = param('email');
$subject = param('subject');
$message = param('message');

# where is the mail program?
$mailprog = '/usr/sbin/sendmail';

#note: some servers want the @ symbol escaped ( \@ ).
$myemail = "exe\@something.com"; #<--- Enter YOUR EMAIL ADDRESS Here

open (MAIL, "|$mailprog -t") or die "Can't send mail.\n";
print MAIL "To: $myemail\n";
print MAIL "From: $email\n";
print MAIL "Subject: $subject\n";
print MAIL "\n";
print MAIL "=====================================================\n";
print MAIL "$message\n";
print MAIL "\n";
close(MAIL);

# This line is where to send them after they click the SUBMIT button:
print "Location: http://www.mysite.netfirms.com/thankyou.html\n\n";



Put YOUR email address in the script, and the URL to go to at the bottom.


When you get this working, let us know.

eXe
08-03-2005, 09:53 PM
ok mlseim

just few secs and i will give u the result
thanks anyway for helping me

FishMonger
08-03-2005, 10:01 PM
Let's make a couple minor error handling changes to mlseim's last script.

#!/usr/bin/perl -w

use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';

$email = param('email');
$subject = param('subject');
$message = param('message');

# where is the mail program?
$mailprog = '/usr/sbin/sendmail';

#note: some servers want the @ symbol escaped ( \@ ).
$myemail = "exe\@something.com"; #<--- Enter YOUR EMAIL ADDRESS Here

open (MAIL, "|$mailprog -t") or die "Can't send mail.$!\n";
print MAIL "To: $myemail\n";
print MAIL "From: $email\n";
print MAIL "Subject: $subject\n";
print MAIL "\n";
print MAIL "=====================================================\n";
print MAIL "$message\n";
print MAIL "\n";
close(MAIL);

# This line is where to send them after they click the SUBMIT button:
print "Location: http://www.mysite.netfirms.com/thankyou.html\n\n";

eXe
08-03-2005, 10:05 PM
i wana cry :'''''''''''''''''''''''''''''(
look what i got
The page cannot be displayed

**** my luck
whats the problem?

eXe
08-03-2005, 10:22 PM
i wana kiss you FishMonger and mlseim
it works gr8 :thumbsup:
but another thing my bro
in the e-mail i want to get just the information between the <form tags

i will explain more

i want to get this data: Email Address: <input type="text" name="email" size ="20">

also this one: Subject: <input type="text" name="subject" size ="20">

just these two lines of data i want to be in the e-mail i get

also with the headers i mean like this:

E-mai Address:

Subject:

inside the e-mail i receive

and am realy thanks for you and mlsiem and every one who help me :)

mlseim
08-03-2005, 10:45 PM
We're hoping you sort of see what's happening and figure out how to
change it. Just remove the $message part and you'll only have the
email and subject ....

I don't know what an email will look like with only a subject line ...?

If you want the subect line to be the email, instead of the subject line,
do this:

change this: print MAIL "$message\n";
to this: print MAIL "$subject\n";


Look at the script and you should be able to figure out what is happening.

We're happy to help, but unless you try some things on your own, you'll
never learn how to code with Perl. You have to experiment a little.

eXe
08-03-2005, 10:55 PM
mlseim,
idnt knwo how to thank you :thumbsup:
and i will do the changes by myself
and i will try to add new featers to it
i know in coding
but as i told u webcoding am zero
but i know i know some
realy thanks for you and for FishMonger :)

Jeff Mott
08-03-2005, 10:57 PM
mlseim, that script would allow spammers to hijack the server's mail program to send mass email. Using the MIME::Lite module is a much better alternative. We either need to walk eXe through installing the MIME::Lite module, or point him/her to sources to begin learning Perl from the ground up. Anything less would be unhelpful in the long run.

Jeff Mott
08-03-2005, 11:05 PM
eXe, if you're genuinely interested in learning how to write and modify CGI scripts written in Perl then I'd recommend you read through the following.

'Beginning Perl'. A very good book that is free and online that is intented for beginners but still has a good level of depth.
http://learn.perl.org/library/beginning_perl/

'Programming Perl', which is authored by Perl's creator, Larry Wall. (Much of the text of this book is the same found in the Perl documentation.)
http://www.unix.org.ua/orelly/perl/prog3/index.htm

And finally, the Perl documentation itself. There are many sites that provide mirrors of the Perl docs. One of the nicer ones I've found is at...
http://perldoc.perl.org/

mlseim
08-03-2005, 11:18 PM
Jeff ... are you serious? :eek:

Just yesterday, we were explaining how to access his cgi-bin.

I don't think he even has a clue what you're talking about.

------------

Netfirms (the webhost he's using) only allows 200 emails per day.

If anyone hacks into it, so what!

------------

I'll tell you what Jeff ... go ahead and walk him through it.

... and do it on this forum so we can see how you're coming along.
... and don't just give him links ... that's too easy.

===============

eXe,

Jeff is going to walk you through the module stuff so pay attention.

Jeff Mott
08-04-2005, 12:04 AM
Jeff ... are you serious?
Just yesterday, we were explaining how to access his cgi-bin.
I don't think he even has a clue what you're talking about.So giving eXe a script with known security issues is ok because he doesn't know Perl well enough to see there are problems?

But you're right, they probably won't know what we're talking about, which is why I alternatively suggested he learn Perl from the beginning.Netfirms (the webhost he's using) only allows 200 emails per day.
If anyone hacks into it, so what!So what is 1) eXe will most likely not be on that same server forever, and 2), and most importantly, eXe is learning Perl programming from your example. When they try to add features to scripts, or write a new one from scratch they will mimic what they've seen. In this case, the security flaw would most likely propagate into every one of their scripts that sends email. For this reason all of us needs to make sure we provide examples that use the best practices, or explicitly state why we didn't use a best practice and the potential problems in not doing so.I'll tell you what Jeff ... go ahead and walk him through it ... and don't just give him links ... that's too easy.I didn't aim for what is easy or what is hard; I aim for what is best. Those authors are probably better teachers than I am, and almost certainly know Perl better than I do. Why would I try to write my own explanations when I can point people to already existing texts that do a better job?

FishMonger
08-04-2005, 12:31 AM
We don't want to get into an argument over this but I agree with Jeff, we should strive to provide the best quality of examples and explanations. Often that is pointing the user to other resources.

Even my examples would require a number of additions/modifications before I would be willing to use them in an open Internet environment. Unfortunately, we can’t teach everything that a user needs to know to be able to take our brief examples and know how to implement them properly and securely.

mlseim
08-04-2005, 01:39 AM
My point is ....

We have an 8th grade student (eXe) who discovered Perl, and is showing the
inititive to learn about it and see what it can do. Instead of dashing his
hopes and discouraging him, I want to encourage him, and give him
something to try out ... something that he can succeed at.

Look at his excitement when he got his first script to run.

If he develops a passion for programming, he will most likely take
future courses in a higher-learning institute. Maybe he'll be a Computer
Science Major, who knows. At that point, as he learns more, he'll learn
how to use modules, code efficiently, etc.

Every singe question on this forum, and I mean literally, every question,
can be answered with this:
'Beginning Perl'. A very good book that is free and online that is intented for beginners but still has a good level of depth.
http://learn.perl.org/library/beginning_perl/

'Programming Perl', which is authored by Perl's creator, Larry Wall. (Much of the text of this book is the same found in the Perl documentation.)
http://www.unix.org.ua/orelly/perl/prog3/index.htm

And finally, the Perl documentation itself. There are many sites that provide mirrors of the Perl docs. One of the nicer ones I've found is at...
http://perldoc.perl.org/

Well, those things are gospel, everyone should follow that path, everyone
should program according to Perldoc ... but that's not the reality.

I feel my job here is to latch onto anyone new to Perl and get them
excited about learning Perl (or PHP or C++ or whatever) ...

By the time "eXe" begins programming for the "Department of Home Security",
I'm pretty sure he'll be at the level you guys are at.

I learn tons of things from (FishMonger and Mott), I'm utilizing the things I
learn and have high respect for their thoughts and ideas ...

But, I certainly am not "unhelpful", and I certainly want to give "eXe"
something he can understand and something that works instantly, without
being put to sleep reading those boring manuals.

So, I'll get off my soapbox again.

I think I'm done with this forum now, it's not much fun anymore...

Bye Everyone
--Max Seim--
Cottage Grove, MN

netroact
08-04-2005, 01:46 AM
I agree that we should try to give and get good examples, but we should also try to answer questions that are submitted, rather than just criticize code. When someone asks a question, I try to answer the question first. When I ask a question in a forum, I am usually starting with raw code, trying to see how to do something. I always go back and rework and tweak code as needed later. Most people know their code isn't perfect yet when they are trying to figure something out. I used a very basic sendmail script on several domains several years before I had any security problems. When I ran into a spammer on one of my client's domains, it took me just a few hours to identify and correct the problem. The same goes for guestbook scripts.

When someone asks for help with any script, I start out very basic, and then warn them of potential security issues.

One time I asked for help in a well known forum about parsing a html comment tag for a new script I was working on. The discussion turned into a big argument between know-it-alls about the proper standard for making comment tags. No one wanted to answer the question I originally posted. I had to go to another forum to get help with my question.

IMO the original poster on this thread (exe) just wanted some basic examples of a sendmail script, so he could see how it works. IMO giving him complex code won't get him started out right. If you want him to learn from the ground up, lose the modules for now. A person can read stuff all day long, but if he never can apply what he learns, it's useless.

END OF RANT

netroact
08-04-2005, 01:54 AM
Sorry mlseim! I guess I was writing bout the same thing you were writing about at the same time. There's no need to run off. You have helped me a lot. I enjoy reading your posts, and I'm grateful for them.

eXe
08-04-2005, 12:48 PM
hello guys
thanks alot of teaching me
and Jeff i enetered the 1st website and downloaded all the chapeters
and i will print them out and begin to study them
i think its easy language,
by the way what the security u r talking abt my script?just give me info no more,to know whts the bad side of the script as it is now
and thanks again all for helping me

eXe
08-04-2005, 03:39 PM
Guys,
can you tell me whats the wrong in this script?
its fake mailer

#!/usr/bin/perl

use CGI ':standard';

$victimname = param('victimname');
$victimemail = param('victimemail');
$sendername = param('sendername');
$senderemail = param('senderemail');
$message = param('message');
# where is the mail program?
$mailprog = '/usr/sbin/sendmail';

open (MAIL, "|$mailprog -t") or die "Can't send mail.\n";
print MAIL "To: $victimname $victimemail\n";
print MAIL "From: $sendername $senderemail\n";
print MAIL "Subject: $subject\n";
print MAIL "\n";
print MAIL "$message\n";
print MAIL "\n";
close(MAIL);

and here the form elements

<input type="text" name="victimname" size="20">

<input type="text" name="victimemail" size="20">

<input type="text" name="sendername" size="20">

<input type="text" name="senderemail" size="20">

<input type="text" name="subject" size="20">

<textarea name="message" cols="60" rows="25">

i just make this script just for fun to play with my relatives :D
tell me wht the wrong in it

Jeff Mott
08-04-2005, 06:07 PM
A malicious user could submit values, formatted in a specific way, that would allow them to maniplate the email message. They could control the subject line, the full body of the message, who to send it to and who it appears to come from.

eXe
08-06-2005, 07:52 PM
hello guys
realy i dont want to hurt anyone with this script
but i made it and did not even upload the html page
i put it in my desktop,so tell me whats the wrong with it
the script send and everythig in ok
but the problem i want to solve that
imade test on my mail,i got this:

TO: mr@cgi3.cgi3 exe@cgi3.cgi3 <exe@.......com>
From: mr@cgi3.cgi3 exe@cgi3.cgi3 <exe@.......com>


i dont want the @cgi3.cgi3 appear :( so what i can put anything more in the script :confused: