Hello Maureen,

The only time I've seen the HTTP Error 405- when submitting a form is
when I've inadvertently used action="post" instead of action="POST"
which I see you've done in your script.

I must have banged my head on that for over an hour before I figured
it out. Hope this helps.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

Wednesday, January 16, 2002, 1:18:39 PM, you wrote:

m> I hope someone can help me out.

m> I set up this cgi file and html form on a Unix server. The script
m> changes a user's password in a text file.

m> This works correctly on a Unix Server. However, I need to move these
m> files to an IIS server.
m> In testing on the IIS server,  I get an HTTP Error 405- Method not
m> allowed when the form is submitted. 

m> I did some research, but was unable to determine how to correct the
m> error. 

m> If anyone could help me out, I'd really appreciate it.

m> Thanks, Maureen

m> #!/usr/bin/perl
m> require "cgi-lib.pl";
m> #process incoming form data 
m> &ReadParse;
m> #set content type
m> print &PrintHeader;
m> #initialize variables
m> $pwfile =
m> "/data1/hypermart.net/worldwidewebstrategies/datafile/pwdata.txt";
m> $tmpfile =
m> "/data1/hypermart.net/worldwidewebstrategies/datafile/pwdata.tmp";
m> $lokfile =
m> "/data1/hypermart.net/worldwidewebstrategies/datafile/pwlock.fil";
m> #Print initial tags for web page
m> print "<HTML><BODY>\n";
m> #check for existence of password file
m> unless (-e $pwfile)
m> { 
m> #password file doesn't exist!
m> #print message & shut down
m> print <<"PrintTag";
m> <H1>Sorry!</H1>
m> <P>$pwfile has't been uploaded to the
m> proper directory. Please contact the webmaster.</P>
m> </BODY>
m> </HTML>
m> PrintTag
m> exit(0);
m> }
m> #check for blank form fields
m> if ($in{'oldname'}eq"" || $in{'oldpw'}eq"")
m> {
m> #re-create form and shut down program
m> print <<"PrintTag";
m> <P><B>ERROR:</B> Please type your current username and
m> password in the spaces provided.</P>
m> <FORM
m> ACTION="http://server37.hypermart.net/worldwidewebstrategies/cgi-bin/changepw.cgi";
METHOD="post">>
m> <P>Your current username:<BR>
m> <INPUT TYPE="text" NAME="oldname" VALUE="$in{'oldname'}"></P>
m> <P>Your current password:<BR>
m> <INPUT TYPE="text"NAME="oldpw" VALUE="$in{'oldpw'}"></P>
m> <P>Your new password:<BR>
m> <INPUT TYPE="text" NAME="newpw1" VALUE="$in{'newpw1'}"></P>
m> <P>Type your new password again:<BR>
m> <INPUT TYPE="text" NAME="newpw2" VALUE="$in{'newpw2'}"></P>
m> <P>
m> PrintTag
m> if ($in{'delete'} eq "yes")
m> {
m> print "<INPUT TYPE=\"checkbox\" 
m> NAME=\"delete\" VALUE=\"yes\" CHECKED>\n";
m> }
m> else
m> {
m> print "\n";
m> }
m> print <<"PrintTag";
m> </P>
m> <INPUT TYPE="submit" VALUE="Change">
m> </FORM>
m> </BODY>
m> </HTML>
m> PrintTag
m> exit(0);  
m> } 
m> #make sure new passwords match 
m> if ($in{'newpw1'} ne $in{'newpw2'})
m> { 
m> #re-create form and shut down program  
m> print <<"PrintTag";
m> <P><B>ERROR:</B> Your new passwords didn't match. 
m> You must type your new password exactly the same way twice. 
m> Please try again.</P>
m> <FORM
m> ACTION="http://server37.hypermart.net/worldwidewebstrategies/cgi-bin/changepw.cgi";
METHOD="post">>
m> <P>Your current username:<BR>
m> <INPUT TYPE="text" NAME="oldname" VALUE="$in{'oldname'}"></P>
m> <P>Your current password:<BR>
m> <INPUT TYPE="text" NAME="oldpw" VALUE="$in{'oldpw'}"></P>
m> <P>Your new password:<BR>
m> <INPUT TYPE="text" NAME="newpw1"></P>
m> <P>Type your new password again:<BR>
m> <INPUT TYPE="text" NAME="newpw2"></P>
m> <INPUT TYPE="submit" VALUE="Change">
m> </FORM>
m> </BODY>
m> </HTML>
m> PrintTag
m> exit(0);  
m> }
m> #check for existence of lock file  
m> if (-e $lokfile)   
m> { 
m> #lock file exists! print message & shut down   
m> print <<"PrintTag";
m> <H1>Try again!</H1>  
m> <P>The database is in use. Please try again later.</P>  
m> </BODY>  
m> </HTML>  
m> PrintTag
m> exit(0);  
m> } 
m> #everything is okay. Create lock file.  
open(LOCK_FILE, ">>$lokfile") || 
m> die "Couldn't create $lokfile\n";
m> #open password file in read-only mode 
m> open(FILE,"$pwfile") || 
m> die "Can't find $pwfile.\n"; 
m> #store database contents in an array and close file
m> @indata = <FILE>;
m> close(FILE);
m> #open temp file in overwrite mode 
open(TEMP,">>$tmpfile") || 
m> die "Can't create $tmpfile.\n"; 
m> #copy password file contents to temp file 
m> #use a foreach loop to process each record in the array
m> foreach $i (@indata)
m> {
m> #remove hard return character from each record
m> chomp($i);
m> #split fields on pipe character
m> #assign a variable name to each of the fields
m> ($username,$password) = split(/\|/,$i);
m> if ($username eq $in{'oldname'} && 
m> $password eq $in{'oldpw'} && 
m> $in{'delete'} ne "yes")
m> {
m> print TEMP "$in{'oldname'}|$in{'newpw1'}\n";   
m> print "<P><h1> Success!</h1>Your password has been changed.</P>\n";
m> }
m> elsif ($username eq $in{'oldname'} && 
m> $in{'delete'} eq "yes")
m> {
m> print "<P>Your password has been deleted.</P>\n";
m> }
m> else
m> {
m> print TEMP "$i\n";
m> }
m> } 
m> #close temp file 
m> close(TEMP);
m> #change file names 
m> rename($pwfile, $pwfile.".old"); 
m> rename($tmpfile, $pwfile); 
m> #close and delete lock file 
m> close(LOCK_FILE); 
m> unlink($lokfile);
m> #close web page
m> print "<P>Thank you! </P>\n";
m> print "</BODY></HTML>\n";
m> #end of script



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to