473,769 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CGI error (need help)

Hi,

I have a problem with a CGI script (Perl) on a Win2000 server.
The script is for sending E-cards and was written by Jason Maloney:
http://www.aestheticsurgerycenter.co...ostcard1.shtml
You can choose from some cards, add your own text and send it to a friend.
This friend get a mail which tell him/her that he/she has a mail and have to
click a link.
So far everything works just fine.
But when the recipient clicks the link he/she gets the following error
message in the browser window:
----------------------------------------------------
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't open perl script
"D:\Inetpub\HCO \www\cgi-bin\postcard\ca rd.cgi107002204 5": No such file or
directory
--------------------------------------------------------
The cgi script is in \cgi-bin\postcard\ca rd.cgi
But the data it has to retrieve is in
\cgi-bin\postcard\ca rds\1070022045. dat(for example)
Each mail generates a new .dat file.

Any ideas???
I already had contact with the author, but he tested it only on a Win NT
server which worked just fine. He has no experience with Win2000 server

You can try it on our test site:
http://195.86.135.223/cgi-bin/postcard/index.html

Thanks,
Bernard
Jul 19 '05 #1
5 3881
On Fri, 28 Nov 2003 15:26:43 +0100, Bernard wrote:
Hi,

I have a problem with a CGI script (Perl) on a Win2000 server.
The script is for sending E-cards and was written by Jason Maloney:
http://www.aestheticsurgerycenter.co...ostcard1.shtml
You can choose from some cards, add your own text and send it to a friend.
This friend get a mail which tell him/her that he/she has a mail and have to
click a link.
So far everything works just fine.
But when the recipient clicks the link he/she gets the following error
message in the browser window:
----------------------------------------------------
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't open perl script
"D:\Inetpub\HCO \www\cgi-bin\postcard\ca rd.cgi107002204 5": No such file or
directory
--------------------------------------------------------
The cgi script is in \cgi-bin\postcard\ca rd.cgi
But the data it has to retrieve is in
\cgi-bin\postcard\ca rds\1070022045. dat(for example)
Each mail generates a new .dat file.

Any ideas???
I already had contact with the author, but he tested it only on a Win NT
server which worked just fine. He has no experience with Win2000 server

You can try it on our test site:
http://195.86.135.223/cgi-bin/postcard/index.html

Thanks,
Bernard


Hey Bernard--

I'm no guru, but I think I can help you with this one...

when you're sending the e-mail to the recipient, the link that it
generates (in this case,
http://www.aestheticsurgerycenter.co....cgi1070022045) is
missing a separator for the query string (the 1070022045 part). Find the
portion of the script that puts the message together and add a
question mark between the .cgi and the following varible, and it should work!

hope that helps!

no_guru


Jul 19 '05 #2
> Hey Bernard--

I'm no guru, but I think I can help you with this one...

when you're sending the e-mail to the recipient, the link that it
generates (in this case,
http://www.aestheticsurgerycenter.co....cgi1070022045) is
missing a separator for the query string (the 1070022045 part). Find the
portion of the script that puts the message together and add a
question mark between the .cgi and the following varible, and it should work!
hope that helps!

no_guru

Here's the code, I have no experience with Perl. So, maybe can you see which
part of the script puts the message together.

#!D:/Program Files/Perl/bin/perl.exe
############### ############### ############### ###########
############### ############### ############### ###########
# Don't Edit This CGI Part #
############### ############### ############### ###########
############### ############### ############### ###########

$i=0;
read(STDIN,$buf fer,$ENV{'CONTE NT_LENGTH'});
if ($ENV{'QUERY_ST RING'})
{$buffer = "$buffer\&$ENV{ 'QUERY_STRING'} ";}
@pairs = split(/&/,$buffer);
foreach $pair (@pairs){
($name,$value) = split(/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1 ))/eg;
$VALUE{$name} = $value;
}

############### ############### ##############
#Gets the Current Date
############### ############### ##############
($sec,$min,$hr, $day,$month,$ye ar,$day_of_week ,$day_of_year,$ some) =
localtime(time) ;
@months =
("January","Feb ruary","March", "April","May"," June","July","A ugust","Septemb e
r","October","N ovember","Decem ber");

$year = $year + 1900;

$DATE = "$months[$month]-$day";
$SHORTDATE = "$months[$month] $day, $year at $hr:$min:$sec";

############### ############### ##############
#Gets Picture Data and Moves on to Next Page
############### ############### ##############

if ($VALUE{'action '} eq 'preview') {

$pic = $VALUE{'PICTURE S'};
$VALUE{'PICTURE '} = $VALUE{'PICTURE S'};
$VALUE{'PICTURE S'} = "$basepicurl$pi c";

print "Content-type: text/html\n\n";
open(TEMPLATE," $preview1");
&template;
print $template;
exit;
}
############### ##########
#Prints the Preview Page
############### ##########
if ($VALUE{'action '} eq 'preview1') {
$pic = $VALUE{'PICTURE '};
$VALUE{'PICTURE S'} = "$basepicurl$pi c";

$VALUE{'MESSAGE '} =~ s/\r//g;
$VALUE{'MESSAGE '} =~ s/\<[^\>]*\>//ig;
$VALUE{'MESSAGE '} =~ s/"/'/g;
$VALUE{'MESSAGE '} =~ s/\n/<BR>/g;

print "Content-type: text/html\n\n";
open(TEMPLATE," $preview2");
&template;
print $template;
exit;
}

##########
#Send Card
##########
if ($VALUE{'action '} eq 'send') {
&no_email unless $VALUE{'MAILFRO M'} && $VALUE{'MAILTO' };

############### #######
#Save the Data
############### #######
$date = time;
$create_card = "$cards$date.da t";

open(DATA, ">>$create_card ");
print DATA
"$VALUE{'SENDER '}|$VALUE{'MAIL FROM'}|$VALUE{' RECIPIENT'}|$VA LUE{'MAILTO'}|$ V
ALUE{'MESSAGE'} |$VALUE{'PICTUR E'}|0\n";
close(DATA);

$url_of_card = "$cgi?$date ";

############### ###########
#Print Thank You HTML
############### ###########
print "Content-type: text/html\n\n";

open(TEMPLATE," $thank_you");
&template;
print $template;

$template = '';

############### ###########
#Send E-mail to Recipient
############### ###########

open (MAIL, "|$mailprog -t") || die "Kan $mailprog niet openen!\n";
print MAIL "To: $VALUE{'MAILTO' } ($VALUE{'RECIPI ENT'})\n";
print MAIL "From: $VALUE{'MAILFRO M'} ($VALUE{'SENDER '})\n";
print MAIL "Subject: $VALUE{'RECIPIE NT'}, $subject1\n\n";

open(TEMPLATE," $email1");
&template;
print MAIL $template;

print MAIL ".\n" ;
close(MAIL);

$deletes = "$cards$DATE.da t";

if(-e $deletes){
}
else{
open(DATA, ">>$deletes ");
close(DATA);
&delete;
}
exit;
}

############### #########
#No E-Mail Addresses
############### #########
sub no_email {
print "Content-type: text/html\n\n";
print "<HTML>\n<TITLE >Fout! E-Mail adres niet geldig</TITLE>\n";
print "<BODY COLOR=\"#FFFFFF \">\n";
print "Kan niet verstuurd worden!<BR>\n";
print "<B>[Mogelijke oorzaken:]</B><BR>\n";
print "&nbsp;&nbsp;1. ) U bent beide e-mail adressen vergeten in te
vullen<BR>";
print "&nbsp;&nbsp;2. ) E-Mail Adres(en) niet in de goed formaat ingetypt,
<B>b.v. na**@bedrijf.co m</B>";
exit;
}

############### ############### #########
#Creates the Postcard
############### ############### #########
if ($ENV{'QUERY_ST RING'}) {

############### ############### ##############
#Makes Postcards and Sends Thank You E-mail
############### ############### ##############
$create_card = "$cards$ENV{'QU ERY_STRING'}.da t";

if(-e $create_card){
open(DATA, "$create_card") ;
@data = <DATA>;
close(DATA);

foreach $temp (@data){
chop($temp);
($SENDER, $MAILFROM, $RECIPIENT, $MAILTO, $MESSAGE, $PICTURES, $COUNT) =
split(/\|/, $temp);

$VALUE{'SENDER' } = $SENDER;
$VALUE{'MAILFRO M'} = $MAILFROM;
$VALUE{'RECIPIE NT'} = $RECIPIENT;
$VALUE{'MAILTO' } = $MAILTO;
$VALUE{'MESSAGE '} = $MESSAGE;
$VALUE{'MESSAGE '} =~ s/ /&nbsp; /g;
$VALUE{'PICTURE S'} = "$basepicurl$PI CTURES";
$VALUE{'LINK'} = "$link$LINK ";
$VALUE{'PICTURE '} = "$basepicurl$PI CTURES";
}

unlink("$create _card");

open(DATA, ">>$create_card ");
$COUNT++;
print DATA
"$SENDER|$MAILF ROM|$RECIPIENT| $MAILTO|$MESSAG E|$PICTURES|$CO UNT\n";
close(DATA);

print "Content-type: text/html\n\n";
open(TEMPLATE," $makecard");
&template;
print $template;

$template = '';

if($COUNT eq '1'){
open (MAIL, "|$mailprog -t") || die "Kan $mailprog niet openen!\n";
print MAIL "To: $VALUE{'MAILFRO M'} ($VALUE{'SENDER '})\n";
print MAIL "From: $VALUE{'MAILTO' } ($VALUE{'RECIPI ENT'})\n";
print MAIL "Subject: $subject2\n\n";

open(TEMPLATE," $email2");
&template;
print MAIL $template;

print MAIL ".\n" ;
close(MAIL);
}
}
else {
print "Content-type: text/html\n\n";
open(TEMPLATE," $error");
&template;
print $template;
}
exit;
}

############### ############### #########
#DELETES the information
############### ############### #########
sub delete {

local(@items, $pair);
opendir(DELETE, "$cards");
@items = grep(/.dat/,readdir(DELETE ));
closedir(DELETE );
foreach $pair (@items){
if (-M "$cards$pai r" > $MAX_DAYS){
unlink("$cards$ pair");
}
}
}

############### ######
#Calls the Template
############### ######

sub template {
while (<TEMPLATE>){
$template .= $_;
}
close(TEMPLATE) ;

$template =~ s/\%%%PICTURES%%%/$VALUE{'PICTURE S'}/g;
$template =~ s/\%%%PICTURE%%%/$VALUE{'PICTURE '}/g;
$template =~ s/\%%%SENDER%%%/$VALUE{'SENDER' }/g;
$template =~ s/\%%%MAILFROM%%%/$VALUE{'MAILFRO M'}/g;
$template =~ s/\%%%MAILTO%%%/$VALUE{'MAILTO' }/g;
$template =~ s/\%%%RECIPIENT%% %/$VALUE{'RECIPIE NT'}/g;
$template =~ s/\%%%MESSAGE%%%/$VALUE{'MESSAGE '}/g;
$template =~ s/\%%%CGI%%%/$cgi/g;
$template =~ s/\%%%MAX_DAYS%%%/$MAX_DAYS/g;
$template =~ s/\%%%SHORTDATE%% %/$SHORTDATE/g;
$template =~ s/\%%%url_of_card %%%/$url_of_card/g;
}
Thx,
Bernard
Jul 19 '05 #3
Bernard wrote:
no_guru wrote:
Find the portion of the script that puts the message together and
add a question mark between the .cgi and the following varible,
and it should work!


Here's the code, I have no experience with Perl. So, maybe can you
see which part of the script puts the message together.


Dear Bernard,

It's very annoying to notice that you post the code here too, while
ignoring the help I tried to give you in another group:

http://groups.google.com/groups?thre....uni-berlin.de

On top of it, in this group you didn't post the part of the code that
I suspect is causing the problem.

What you are doing is called multi-posting, and it is very rude. Check
the netiquette guidelines for Usenet.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #4

"Gunnar Hjalmarsson" <no*****@gunnar .cc> schreef in bericht
news:mm******** ************@ne wsc.telia.net.. .
Bernard wrote:
no_guru wrote:
Find the portion of the script that puts the message together and
add a question mark between the .cgi and the following varible,
and it should work!
Here's the code, I have no experience with Perl. So, maybe can you
see which part of the script puts the message together.


Dear Bernard,

It's very annoying to notice that you post the code here too, while
ignoring the help I tried to give you in another group:

http://groups.google.com/groups?thre....uni-berlin.de
On top of it, in this group you didn't post the part of the code that
I suspect is causing the problem.

What you are doing is called multi-posting, and it is very rude. Check
the netiquette guidelines for Usenet.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Dear Gunnar,

I'm very sorry for this, but here at home my provider doesn't support this
newsgroep. I thought I only could check it on monday on my work for your
answers/effort.
With the link you gave me now, I can read your answer and I wil try it right
away.
When something goes wrong, I try to get help where available. But it was not
ment to overrule somebody.
I was/am really please with your help.

Bernard
Jul 19 '05 #5
Bernard wrote:
Gunnar Hjalmarsson wrote:
What you are doing is called multi-posting, and it is very rude.
Check the netiquette guidelines for Usenet.
I'm very sorry for this,


It's okay, now you know something about Usenet that you didn't know
before. ;-)
but here at home my provider doesn't support this newsgroep.


Do they support comp.lang.perl but not alt.perl? They'd better do it
the other way around, because comp.lang.perl is actually defunct.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1193
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select database(); +------------+ | database() | +------------+
5
2149
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator=' in '*this = CTest::operator+(CTest&)((+t2))' test2.cpp:49: error: candidates are: CTest CTest::operator=(CTest&) make: *** Error 1
4
3727
by: Patrick Masson | last post by:
Hello, Our configuration : Apache 2.0.53 PHP 5.0.4 PC Windows 2000 MATLAB 6.1 We work on a consulting project in France which involves MATLAB Web server,
8
4066
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End If ExitHere: Me!SubName.SetFocus
9
3215
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network share that happens to be a Network Appliance NAS.
40
3219
by: vfunc | last post by:
I get an undefined reference error for a definition that clearly looks like it is in a .h file. So what can be the cause of an undefined reference error, when this .h file containing the definition has been included and the namespace has been declared. I blame engineers they are all ponsey zealots.
10
2163
by: deathtospam | last post by:
My employer is starting to take the first steps towards migrating its Classic ASP codebase to ASP.NET v2.0. We have a copy of our existing website on the new Windows Server 2003 R2 test server, and everything is running fine. However, when I create a simple "HelloWorld.aspx" file, then browse to the page from VS.NET 2005 on the same machine, I get the following error message: ================================================ Server...
9
9699
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
2
19491
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9583
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5297
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3955
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.