Error with script - internal error or misconfiguration

S

sino74

Hi

I'm been having this error nad can't seem to locate the source of the
problem. I though the the error was the variables but even after
isolating them, the error message:

<<The server encountered an internal error or misconfiguration and was
unable to complete your request.>>

Still shows up. Does any have any idea what the cause is. Any help
would be appreciated.

HTML FILE________________________________________________________
<!-- ** INFORMATION ON THE PAGE ****************************

Page name _________________ : PY_iPass.html
Version ___________________ : 1.2

CSS used __________________ :
http://webcat.mt.cgi.ca/z_class_file/styles.css
Inputs ____________________ :
Outputs ___________________ :
Scripts used ______________ :

****** END OF INFORMATION ON THE PAGE ******************** -->
<html><head>
<!-- These 2 lines must be there for the character set and the Cascaded
Style Sheet -->
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<LINK REL="stylesheet"
HREF="http://webcat.mt.cgi.ca/z_class_file/styles.css" TYPE="TEXT/CSS">

<title>iPass Form</title>
<script LANGUAGE="JavaScript">
<!--


function doUser()
{
document.frmpending.msg2.value = "";
document.frmpending.msg2.value = "\n\tHere is your iPass / VPN
username: " + document.frmpending.user.value;
document.frmpending.msg2.value = document.frmpending.msg2.value +
"\n\tYour iPass / VPN and Token usage costs will be charged to the
following business unit: " + document.frmpending.bu.value + "\n";
}

function doLoad()
{
document.frmpending.msg3.value = "\nThe password to use with your
account is a combination of a PIN and a Token code (from the Token you
will receive soon). To set your PIN, you need to access the following
link : \nhttps://web.globalace.alcan.com/securidtest\n\nThis link is
only accessible from the Pechiney network, if you don't access, please
call the Helpdesk. If you have not already taken the interactive
tutorial for iPass, please go to the following webpage for iPass
training.\nhttp://www.intranet.plastics.pechiney.com/is/User_Audience/Remote_default.htm\n\nYou
can view an iPass User Guide or save it to your desktop for reference
while you are traveling. Click on \"iPass User Guide\" from the Remote
Usage webpage. Then click File, Save As. Give it a name and save it
to your desktop or C:\ drive. It will be saved as an .htm
document.\nhttp://www.intranet.plastics.pechiney.com/is/User_Audience/Remote_Usage/iPass_Usage_Guide.htm\n\nAfter
reviewing the interactive tutorial or User Guide, if you have any
questions about using iPass contact the Help Desk at
1-888-557-3400.\n\n-iPass has been added to your software profile. If
it does not automatically install the next time that you login, please
do the following:";
document.frmpending.msg3.value = document.frmpending.msg3.value +
"\n\n1. Double click on the \"ZenApplication\" icon on your
desktop\n\n2. Double click on the \"All\" icon\n\n3. Now you should
see iPass Install icon, if you double click on the icon, the software
should install.\n\nPlease let us know if the application is
working.\n\nIf we have not heard from you within two business days, we
will assume the install was completed successfully and your ticket will
be closed.\n\n\nSincerely,\nPechiney Americas Help
Desk\n1-888-557-3400\[email protected]";
}

function echeck(str)
{
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)

if(-1 == str.indexOf("@pechiney.com") && -1 ==
str.indexOf("@alcan.com") && -1 == str.indexOf("@PECHINEY.COM") && -1
== str.indexOf("@ALCAN.COM"))
{
alert("Your email must have a '@pechiney.com' or
'@alcan.com'.");
return false;
}


if (str.indexOf(at)==-1)
{
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 ||
str.indexOf(at)==lstr)
{
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 ||
str.indexOf(dot)==lstr)
{
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(at,(lat+1))!=-1)
{
alert("Invalid E-mail ID")
return false
}

if (str.substring(lat-1,lat)==dot ||
str.substring(lat+1,lat+2)==dot)
{
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(dot,(lat+2))==-1)
{
alert("Invalid E-mail ID")
return false
}

if (str.indexOf(" ")!=-1)
{
alert("Invalid E-mail ID")
return false
}

return true
}

function ValidateForm(){
var emailID=document.frmpending.MIN_NUMBER

if ((emailID.value==null)||(emailID.value==""))
{
alert("Please Enter your Email ID")
emailID.focus()
return false
}
if (echeck(emailID.value)==false)
{
emailID.value=""
emailID.focus()
return false
}
return true
}

-->
</script>
</head>

<body >
<FORM name="frmpending"
ACTION="http://webcat.mt.cgi.ca/cgi-bin/xipassfollowup.cgi"
METHOD="post" onSubmit="return ValidateForm();">

<INPUT TYPE="hidden" NAME="TEMPLATE"
VALUE="/img/tnpp-fr/general/outbox/messageConfirmation.html">
<INPUT TYPE="hidden" NAME="EXCEPTION_TEMPLATE"
VALUE="/img/tnpp-fr/imgHtmlException.html">
<INPUT TYPE="HIDDEN" NAME="SMTP_RETURNPATH">
<INPUT TYPE="HIDDEN" NAME="MIN_RETURNPATH">
<INPUT TYPE="HIDDEN" NAME="FROM">
<INPUT TYPE="HIDDEN" NAME="CALLBACK_NUMBER">
<INPUT TYPE="HIDDEN" NAME="STATUS_REQUEST">
<basefont FACE="Arial,Helvetica">
<table width="100%" border="0">
<tr>
<td width="15%">To :</td>
<td width="85%"> <input name="MIN_NUMBER" type="text"
id="MIN_NUMBER" size="50">
</td>
</tr>
<tr>
<td>Subject:</td>
<td><input class="TXTR" name="MESSAGE_SUBJECT" type="text"
id="MESSAGE_SUBJECT" value="iPass Account Creation - Software Push -
Help Desk Ticket: " size="75" readonly="true"></td>
</tr>
<tr>
<td>AR Number:</td>
<td><input name="AR_NUMBER" type="text" id="AR_NUMBER"></td>
</tr>
<tr>
<td>User Name:</td>
<td><input name="user" type="text" id="user" value="" size="75"
onBlur="doUser();"></td>
</tr>
<tr>
<td>Department:</td>
<td><input name="bu" type="text" id="bu" value="" size="75"
onBlur="doUser();"></td>
</tr>
<tr>
<td>Site:</td>
<td><input name="site" type="text" id="site" size="75"></td>
</tr>
<tr>
<td>Group to which the user is assigned:</td>
<td>
<select name="group" id="group">
<option value="py-americas">RSA py-americas</option>
<option value="Neenah Customer Service Shared">RSA Neenah
Customer Service
Shared</option>
<option value="CGI">RSA CGI</option>
<option value="SOHO (Home User)">RSA SOHO (Home
User)</option>
<option value="Akron Shared">RSA Akron Shared</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="submit" type="submit" value="submit">
<br><input class="TXTD" name="CAT_PEOPLE" type="text"
value="(e-mail address removed)">
</td>
</tr>
</table>
</form>
</body>
</html>

___________________________________________________________________


CGI Script_________________________________________________________

#!/usr/bin/perl
#
==================================================================
# This script is for to use with the form followup.html
# ==================================================================
# Variables From the Form :
#
# CAT_PEOPLE : (FORM)HelpDesk, client company.
# (SCRIPT)For the field "From" in the e-mail sent.
#
# MIN_NUMBER: (FORM)Email address for message to be sent to.
# (SCRIPT)For the field "To" in the e-mail sent.
#
# MESSAGE_SUBJECT: (FORM) Subject line
# (SCRIPT) For the field "Subject" in the e-mail sent

#
# MESSAGE_BODY : (FORM) TextArea with all information about the case
to sent to support
# (SCRIPT) For the boby, where the text is in the
e-mail sent
#
=======================================================================================
# Others Variables
#
# time, months, days, day, year, timestamp : Not use in this script
# $content : Contains the text Message: to be concatenate with main
text in the body of the mail.
# $formdata : containt pair Key/Value (Key=name of field from the form
field, Value=text in that field)
#
=======================================================================================
# Parameter to setup
#
# #!/usr/bin/perl : Path where perl is locate
# open (MAIL, "|/usr/lib/sendmail -t -i") : Path where sendmail is
locate (to sent e-mail without e-mail client).
#
#
######################


#variable declarations

@time = localtime;

#Date manipulations

($hour, $min, $sec) = sprintf ('%02d:%02d:%02d', $time[2], $time[1],
$time[0]);

@months = qw(January February Mach April May June July August September
October November December);
#Making 2 Scalars
$month = $months[$time[4]];
$day = $time[3];

$year = $time[5] + 1900;
$timestamp = "$day, le $time[3] $month, $year $hour$min$sec";

#read for POST method to $buffer

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair ( @pairs ) {
($key,$val) = split(/=/,$pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
$val =~ tr/+/ /;
$val =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
$val =~ s/<!--(.|\n)*-->//g;
$val =~ s/%(..)/pack("c",hex($1))/ge;

if($formdata{$key}){
$formdata{$key} .= ", $val";
}
else{
$formdata{$key} = $val;
}
}
$content="";
print 'Content-type: text/html ', "\n\n";

# Creating the TO, FROM, and SUBJECT fields

#formating email content

if ($formdata{'problem'} =~ "--Veuillez") {
print "<P><center> Vous n'avez pas choisi de contrainte.<BR> No
email has been sent out.</center>";
exit;
}
else {

open (MAIL, "|/usr/lib/sendmail -t -i") || &ErrorMessage;

print MAIL "To: $formdata{'MIN_NUMBER'}\n";
print MAIL "Cc: $formdata{'CAT_PEOPLE'}\n";
print MAIL "From: $formdata{'CAT_PEOPLE'}\n";
print MAIL "Subject: $formdata{'MESSAGE_SUBJECT'}
$formdata{'AR_NUMBER'}\n\n";
print MAIL $content . "The following iPass account was created:\n\nUser
name: $formdata{'user'}\nSite: $formdata{'site'}\nDevision:
$formdata{'bu'}\nGroup to which user is assignd: $formdata{'group'}\n";
close (MAIL);

print "E-mail follow up procedure has been started. The following text
has been e-mailed:<BR><BR>";
print "To: $formdata{'MIN_NUMBER'}<BR>";
print "Cc: $formdata{'CAT_PEOPLE'}<BR>";
print "From: $formdata{'CAT_PEOPLE'}<BR>";
print "Subject: $formdata{'MESSAGE_SUBJECT'}
$formdata{'AR_NUMBER'}<BR><BR>";
print $content . "The following iPass account was created:<BR><BR>User
name: $formdata{'user'}<BR>Site: $formdata{'site'}<BR>Devision:
$formdata{'bu'}<BR>Group to which user is assignd:
$formdata{'group'}<BR>";

sub ErrorMessage {
print "<P>The server has a problem. Aborting script.\n";
exit;
}}
 
B

Brian Wakem

<snipped loads of stuff>

Do yourself a favour and

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

Sherm Pendley

I'm been having this error nad can't seem to locate the source of the
problem. I though the the error was the variables but even after
isolating them, the error message:

<<The server encountered an internal error or misconfiguration and was
unable to complete your request.>>

You are asking a Frequently Asked Question. Have a look at:

perldoc -q 500

First and foremost, do what the error message tells you to do, and look in
your web server logs. Perl has extensive diagnostics and error reporting
available - but none of it will help if you disable it and/or ignore what
it tells you.

Also, please read and follow the posting guidelines that appear here twice a
week. More to the point, please don't post a bunch of irrelevant HTML and
JavaScript - no one here is going to wade through all that.

sherm--
 
A

A. Sinan Unur

Brian Wakem said:
<snipped loads of stuff>

Do yourself a favour and

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

This is also a very good time for the OP to read the posting guidelines
for this group. The guidelines contain valuable information on diagnosing
and describing problems that help one either fix the problem oneself or
describe it in a way that helps others help.

Sinan.
 
A

A. Sinan Unur

(e-mail address removed) wrote in
Hi

I'm been having this error nad can't seem to locate the source of the
problem. I though the the error was the variables but even after
isolating them, the error message:

<<The server encountered an internal error or misconfiguration and was
unable to complete your request.>>

You should consult the Perl FAQ

perldoc -q 500
perldoc -q CGI
Still shows up. Does any have any idea what the cause is. Any help
would be appreciated.

Then you should help others help you. Please read the posting guidelines.
HTML FILE________________________________________________________
<!-- ** INFORMATION ON THE PAGE ****************************

Don't clutter your posting with useless information. It makes it harder
for others to read.

....

<title>iPass Form</title>
<script LANGUAGE="JavaScript">
<!--


function doUser()

Please don't :) Also, note that this is a Perl forum and there is no point
to posting Javascript here.

....
CGI Script_________________________________________________________

OK, so, after I don't know how many irrelevant lines, we finally come to
your Perl script.
#!/usr/bin/perl
#
==================================================================
# This script is for to use with the form followup.html
# ==================================================================
# Variables From the Form :
#
# CAT_PEOPLE : (FORM)HelpDesk, client company.
# (SCRIPT)For the field "From" in the e-mail sent.

I have the distinct impression that this is something you are planning to
sell or otherwise make money off of. There is absolutely nothing wrong
with that. You just cannot expect people to then donate their time in
support of your business when you have not put any effort into posing your
question.

Note that this is still useless information that clutters your post and
makes it harder for others to read it.
# #!/usr/bin/perl : Path where perl is locate

I realize this line is commented out in the script you posted, but do you
realize that if it were not, ": Path where perl is locate" would very
likely be passed to perl when this script is run?
# open (MAIL, "|/usr/lib/sendmail -t -i") : Path where sendmail is
locate (to sent e-mail without e-mail client).

Extra long comments that extend beyond the right margin have a tendency to
wrap around at most inopportune moments.

By the way, you are better off using a module such as Mime::Lite or
similar (see the past discussions on this newsgroup as well as the FAQ:

perldoc -q "send mail"

).


use strict;
use warnings;

missing.
@time = localtime;

#Date manipulations

($hour, $min, $sec) = sprintf ('%02d:%02d:%02d', $time[2], $time[1],
$time[0]);

See

perldoc -f sprint

to find out that sprintf returns a single string. What do _you_ think the
line above does?

@months = qw(January February Mach April May June July August
September October November December);
#Making 2 Scalars
$month = $months[$time[4]];
$day = $time[3];

$year = $time[5] + 1900;
$timestamp = "$day, le $time[3] $month, $year $hour$min$sec";
http://www.faqs.org/rfcs/rfc3339.html

#read for POST method to $buffer

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair ( @pairs ) {
($key,$val) = split(/=/,$pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
$val =~ tr/+/ /;
$val =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
$val =~ s/<!--(.|\n)*-->//g;
$val =~ s/%(..)/pack("c",hex($1))/ge;

You copied and pasted this from somewhere and I would venture to guess
that you do not have the foggiest idea what it does.

use CGI;

and throw away this crap.
open (MAIL, "|/usr/lib/sendmail -t -i") || &ErrorMessage;

Do you know what calling a sub with & does and do you need that? My guess
is that you don't. Also, your ErrorMessage subroutine does not do anything
useful. A simple:

open my $mail, "|/usr/lib/sendmail -t -i" or
die "Cannot open pipe to sendmail: $!";

would provide you with invaluable information in the server logs.

(You could also use CGI::Carp to have these error messages displayed in
the browser but I tend to avoid that for fear of accidentally leaving it
in when the script is deployed.)
sub ErrorMessage {
print "<P>The server has a problem. Aborting script.\n";
exit;
}}

Why do you have two braces at the end of the sub definition???

Sinan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top