Hi - I have a perl script that works in UNIX but not Windows. I modified the path to perl and mail prog for the Windows environment but it still will not work and I am not sure what I am doing wrong.
The purpose of the script is to take the data inputted on the form, display a confirmation page (this works) and send out two emails (one to user and one to administrator) and write data to a text file. I keep getting error message that text file is not found.
Can you please help me????
Here is the script.#!c:\perl\bin\perl.exe # ensure all fatals go to browser during debugging and set-up use CGI::Carp 'fatalsToBrowser'; require 'c:\webserver\osarr.org\www\cgi-bin\cgi-lib.pl'; &ReadParse; $mailprog = 'c:\winnt\system32\blat.exe'; print &PrintHeader; #checking for mailprog unless (-e $mailprog) { print <<"PrintTag"; <html><body> Cannot find $mailprog. There must be a typo. </body></html> PrintTag exit(0); } #create confirmation web page print <<"PrintTag"; <HTML><HEAD> <TITLE>OSARR</TITLE> </HEAD> <BODY BGCOLOR="#CAE0F0" TEXT="black"> <center> <H2>Thank You for registering for a class offered by OSARR.</H2> You are registered for $in{'class'}. <P>You will be receiving a confirmation email from OSARR shortly.</P> <FORM> <input type="button" value="Close Window" onClick="window.close();"> </FORM> <br> <a href="http://www.osarr.org">OSARR</a> </body></html> PrintTag #send email to registrant open (MAIL, "|$mailprog -t") || die "Can't open mail program\n"; print MAIL "To: $in{'email'}\n"; print MAIL "Reply-To: $in{'myemail'}\n"; print MAIL "From: $in{'myemail'}\n"; print MAIL "Subject: OSARR Class Registration.\n\n"; print MAIL << "PrintTag"; Dear $in{'fname'} $in{'lname'}, Thank you for registering for the OSARR class - $in{'class'}. If you have any questions, please call OSARR at (401) 295-5757. Sincerely, OSARR PrintTag close (MAIL); #send email to OSARR open (MAIL, "|$mailprog -t") || die "Can't open mail program\n"; print MAIL "To: $in{'myemail'}\n"; print MAIL "Reply-To: $in{'myemail'}\n"; print MAIL "From: $in{'myemail'}\n"; print MAIL "Subject: OSARR class registration.\n\n"; print MAIL << "PrintTag"; $in{'fname'} $in{'lname'} from $in{'agency'} signed up for $in{'class' +}. PrintTag close (MAIL); #check to see if file is in use if (-e "lock.fil") { print &PrintHeader; print <<"PrintTag"; <html><head><title>File in Use</title></body> <body><center><h1>Some one else is accessing the database right now. P +lease try again later.</h1></center></body></html> PrintTag exit(0); } open (LOCKFILE, ">lock.fil"); #Store data #open database open (LOGFILE,">>c:\webserver\osarr.org\www\cgi-bin\data\indsignups.tx +t") || die "Can't find database\n"; #add new data print LOGFILE "$in{'class'}|$in{'fname'}|$in{'lname'}|$in{'address1'}| +$in{'address2'}|$in{'city'}|$in{'state'}|$in{'zip'}|$in{'phone'}|$in{ +'email'}|$in{'agency'}\n"; close (LOGFILE); close (LOCKFILE); unlink ("lock.fil"); #end program
Here is the html form:
<HTML><!-- #BeginTemplate "/Templates/osarr.dwt" --> <HEAD> <META NAME="Author" CONTENT="alicesheerin"> <META NAME="Generator" CONTENT="Jasc Paint Shop Pro 7"> <!-- #BeginEditable "doctitle" --> <TITLE>OSARR </TITLE> <script> function validate() { if ((document.regform.fname.value=="")) || ((document.regform.lname.value=="")) || ((document.regform.address1.value=="")) || ((document.regform.city.value=="")) || ((document.regform.state.value=="")) || ((document.regform.zip.value=="")) || ((document.regform.phone.value=="")) || ((document.regform.email.value=="")) { alert ("You must complete all of the fields!") return false } } </script> <!-- #EndEditable --> <LINK REL=stylesheet STYLE TYPE="TEXT/CSS" href="/main.css"> </HEAD> <BODY> <!-- Begin Table --> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="800" HEIGHT=" +500"> <TR> <TD ROWSPAN="2" COLSPAN="1" WIDTH="196" HEIGHT="165"><a href="/new +site.html"><IMG NAME="gborder0" SRC="/images/gborder_1x1.jpg" WIDTH=" +196" HEIGHT="165" BORDER="0"></a></TD> <TD ROWSPAN="1" COLSPAN="2" WIDTH="604" HEIGHT="84"> <IMG NAME="gb +order1" SRC="/images/gborder_1x2.jpg" WIDTH="604" HEIGHT="84" BORDER= +"0"></TD> </TR> <TR> <TD ROWSPAN="1" COLSPAN="1" WIDTH="101" HEIGHT="81"> <IMG NAME="gb +order2" SRC="/images/gborder_2x1.jpg" WIDTH="101" HEIGHT="81" BORDER= +"0"></TD> <TD ROWSPAN="2" COLSPAN="1" WIDTH="503" HEIGHT="111"><img name="gb +order3" src="/images/gborder_2x2.jpg" width="503" height="111" border +="0"></td> </TR> <TR> <TD valign="top" ROWSPAN="2" COLSPAN="1" WIDTH="196" HEIGHT="335" +background="/images/gborder_3x1.jpg" BORDER="0"> <hr width="75%"> <TABLE WIDTH="190" CELLSPACING="0" CELLPADDING="5" > <TR> <TD align="left"> <A HREF="/newsite.html" class="nav">W +ho We Are</A></TD> </TR> <TR> <TD align="left"> <A HREF="/member.html" class="nav">Me +mber Agencies</A></TD> </TR> <TR> <TD align="left"> <A HREF="/training.html" class="nav" +>Training & Events</A></TD> </TR> <TR> <TD align="left"> <A HREF="/workdev.html" class="nav" > +Workforce Development</A></TD> </TR> <TR> <TD align="left"> <A HREF="/news.html" class="nav" >Wh +at's New</A></TD> </TR> <TR> <TD align="left"> <A HREF="/links.html" class="nav" >U +seful Links</A></TD> </TR> <tr><td><hr width="75%></td></tr> <TR> <TD align="left"> <A HREF="/member/memberpass.html" class="nav" >Membe +r Information</A></TD> </TR> <TR> <TD align="left"> <A HREF="/boardpass.html" class="nav" + >Board Information</A></TD> </tr> <tr><td> <center><hr width="75%"></center> <p align="center" class="smallblue"> OSARR<br> 1130 Ten Rod Road, C-104<br> North Kingstown, RI 02852<br><br> Phone: (401) 295-5757<br> Fax: (401) 295-5462<br><br> Email:<a class="smallblue" href="mailto: info@osarr.org">info@osarr.o +rg<br> <br> </a><a class="smallblue" href="/directions.html">Directions</a> <br><br><br> <SCRIPT SRC="/datemod.js" LANGUAGE="JavaScript"></SCRIPT></p> </td> </TR> </TABLE></TD> <TD ROWSPAN="1" COLSPAN="1" WIDTH="101" HEIGHT="30"> <IMG NAME="gb +order5" SRC="/images/gborder_3x2.jpg" WIDTH="101" HEIGHT="30" BORDER= +"0"></TD> </TR> <TR> <TD valign="top" ROWSPAN="1" COLSPAN="2" WIDTH="604" HEIGHT="305"> <blockquote><table width="500"> <tr><td></td></tr> <tr> <td width="500" bgcolor="#006EC7" valign="top" class="larg +e"><font color="white"> <b><!-- #BeginEditable "Heading" -->Individual Registrat +ion Form<!-- #EndEditable --></b></font></td> </tr> <tr><td><tr><td> <span class="bodytext"> <br> <!-- #BeginEditable "Body%20Text" --> <form name="regform" method="post" action="cgi-bin/ind +regform.cgi" onsubmit="return validate()"> <input type="hidden" name="myemail" value="alicesheerin@cox.net"> Please select Training Class:<span class="bodytext"> <select name="class"> <option>Management Training - January 21, 2004 <option>Wellness Seriers - January 29, 2004 </select> </span><br> <br> First Name: <input type="text" name="fname" size="20"> +Last Name: <input type="text" name="lname" size="20"> <bR><br>Home Address: <input type="text" name="address +1" size="40"> <br> +   +; <input type="text" name="address2" size="40"><bR> <br>City: <input type="text" name="city" size="25"> S +tate:<input type="text" name="state" size="2"> Zip Code: <input type="text" name="zip" size="5"><br>< +br> Contact Phone #: <input type="text" name="phone" size= +"20"><br><Br> Agency Name: <select name="agency"> <option>Arc of Northern RI <option>Avatar <option>Blackstone Valley Art <option>Bridges <option>C.O.V.E Center <option>Community Living of RI <option>Corliss Institute <option>Cranston Center <option>Fogarty Center <option>Gateways To Change <option>Justice Resource Institute <option>Kent Coounty Chapter of Arc <option>LaPlante Center <option>L.I.F.E. Inc. <option>Looking Upwards <option>New England RMS <option>Ocean State Community Resouces <option>Olean Center <option>Opportunities Unlimited <option>Perspectives Corporation <option>Re-Focus <option>Rocky Knoll <option>Spurwink/RI <option>United Cerebral Plasy <option>West Bay Residential </select> <br><BR> Email: <input type="text" name="email" size="30"><br>< +Br> <bR> <center><input type="submit" value="Submit"> <input type="reset" value="Res +et"></center> </form><!-- #EndEditable --> </span> </TD> </TR> </table></blockquote> </td> </tr> </TABLE> <!-- End Table --> </BODY> <!-- #EndTemplate --></HTML>
janitored by ybiC: Retitle from "workingin Windows NT" for searchability, minor format cleanup and balanced <readmore> tags around codeblock for legibility
In reply to Make unix CGI script work on win32 by Ineedhelpplease
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |