There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Web Design & Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers dvd error excel external hard drive firefox freeze freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop malware motherboard mouse network networking outlook 2007 power printer problem ram restart router screen slow sound trojan usb virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
CGI Problem, it just won't work???


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
chris124's Avatar
Member with 41 posts.
 
Join Date: Oct 2002
Location: Stourbridge, United Kingdom
19-Apr-2005, 07:58 AM #1
CGI Problem, it just won't work???
I have moved a friends website from one windows server to another, I haven't touched the coding at all, they have a contact form on this site and a cgi script to handle it, but for some reason the cgi script isn't sending the form. The contact form can be found at http://www.smartchoicepropertyservic...ontact_us.html

below is the cgi script:


#!/usr/bin/perl
use OLE;
use CGI;
$jmail = CreateObject OLE "JMail.SMTPMail";

print "Content-type: text/html\n\n";

$form = new CGI;
$Recipient=$form->param('EMAIL');

$domain = $ENV {'SERVER_NAME'};
$referer = $ENV {'HTTP_REFERER'};
$url = $referer;
$url =~ s/^http:\/\///i;
$url =~ s/^www\.//i;
$domain =~ s/^www\.//i;

$name = $form->param('NAME');
@type_of_enquiry = $form->param('TYPE_OF_ENQUIRY');


$Sender = "website\@$domain";
$SMTPServer = "smtp.$domain:25";
$Subject = "WEBSITE: Contact Form Submission";
$Body = "------------------------------\n";
$Body .= "WEBSITE CONTACT FORM SUBMITTED\n";
$Body .= "------------------------------\n\n\n";
$Body .= "NAME : " . $form->param('NAME') . "\n\n";
$Body .= "ADDRESS : \n" . $form->param('ADDRESS') . "\n\n";
$Body .= "HOME PHONE : " . $form->param('PHONE_HOME') . "\n\n";
$Body .= "MOBILE PHONE : " . $form->param('PHONE_MOBILE') . "\n\n";
$Body .= "WORK PHONE : " . $form->param('PHONE_WORK') . "\n\n";
$Body .= "EMAIL : " . $form->param('EMAIL') . "\n\n";
$Body .= "TYPE OF ENQUIRY : \n";

foreach $element (@type_of_enquiry) {
$Body .= $element ."\n";
}

$Body .= "------\n" . $form->param('OTHER') . "\n";
$Body .= "\n\nDETAILS :\n" . $form->param('DETAILS') . "\n\n";
$Body .= "------------------End Of Message------------------\n\n";
$Priority = 3;
$Header = "Originating-IP", $ENV{'REMOTE_ADDR'};

$jmail->{ServerAddress} = $SMTPServer;
$jmail->{Sender} = $Sender;
$jmail->{Subject} = $Subject;
$jmail->AddRecipient ("kingstanding\@$domain");
# $jmail->AddRecipientBCC ("cgreen\@blueyonder.co.uk");
$jmail->{Body} = $Body;
$jmail->{Priority} = $Priority;
$jmail->AddHeader ($Header);

if ($url =~ m/^$domain/)
{
$mailmessage = "mail sent";
$jmail->Execute;
}
else
{
$mailmessage = "mail was not sent. Incorrect Referer";
}

print<<"RESPONSE_HTML";
<html>
<head>
<title>Thank You</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/styles.css">
<script language="javascript">
<!--
function formComplete(objForm) {
if (objForm.NAME.value == '') {
alert('Please enter your name. Thank You.');
return false;
}
if (objForm.ADDRESS.value == '') {
alert('Please enter your full address. Thank You.');
return false;
}
if (!(telValid(objForm.PHONE_HOME.value))) {
alert('Please enter your home phone number. Thank You.');
return false;
}
if (!(emailValid(objForm.EMAIL.value))) {
alert('Please enter your valid email address. Thank You.');
return false;
}
oneChecked = false;
for (i = 0; i < objForm.TYPE_OF_ENQUIRY.length; i++) {
if (objForm.TYPE_OF_ENQUIRY[i].checked == true) {
oneChecked = true;
}
}
if (oneChecked == false) {
alert('Please select one or more types of enquiry. Thank You.');
return false;
}
return true;
}

function emailValid(inEmail) {
var regexp = /^[a-z][a-z0-9_\.]+@[a-z0-9_\.]+(\.[a-z0-9_]+){1,}\$/;
return (inEmail.match(regexp,'i'));
}
function telValid(inString) {
var regexp = /^[0-9 \+\(\)]+\$/;
return (inString.match(regexp,''));
}
//-->
</script>
<style type="text/css">
<!--
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
.style1 {color: #0066CC}
.style3 {color: #0066CC; font-weight: bold; }
-->
</style></head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table id="Table_01" width="100%" height="116" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="11"><img src="../images/concept_top_01.gif" width="422" height="88" alt=""></td>
<td width="100%" rowspan="3" background="../images/concept_top_02.gif"><img src="../images/concept_top_02.gif" width="6" height="116" alt=""></td>
<td><img src="../images/concept_top_03.gif" width="272" height="88" alt=""></td>
</tr>
<tr>
<td><img src="../images/concept_top_04.gif" width="14" height="18" alt=""></td>
<td width="39" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"> <a href="../index.html">home</a> </td>
<td><img src="../images/concept_top_06.gif" width="23" height="18" alt=""></td>
<td width="58" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"> <a href="../about_us.html">about us</a> </td>
<td><img src="../images/concept_top_08.gif" width="22" height="18" alt=""></td>
<td width="51" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"><img src="../images/spacer.gif" width="1" height="1"><a href="../contact_us.html">contact</a></td>
<td><img src="../images/concept_top_10.gif" width="23" height="18" alt=""></td>
<td width="82" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"><a href="../what_we_do.html">what we do</a></td>
<td><img src="../images/concept_top_12.gif" width="24" height="18" alt=""></td>
<td width="60" height="18" align="center" valign="middle"><img src="../images/spacer.gif" width="1" height="1"><a href="../property.html">property</a></td>
<td><img src="../images/concept_top_14.gif" width="26" height="18" alt=""></td>
<td><img src="../images/concept_top_15.gif" width="272" height="18" alt=""></td>
</tr>
<tr>
<td colspan="11"><img src="../images/concept_top_16.gif" width="422" height="10" alt=""></td>
<td><img src="../images/concept_top_17.gif" width="272" height="10" alt=""></td>
</tr>
</table>
<table id="Table_01" width="700" height="317" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="700" height="1" colspan="3"><img src="../images/spacer.gif" width="1" height="1"> </td>
</tr>
<tr>
<td width="184" height="33" align="left" valign="top"><img src="../images/concept_form_response_02.gif" width="184" height="33" alt=""></td>
<td width="15" height="33"><img src="../images/concept_contact_us_03.gif" width="15" height="33" alt=""></td>
<td width="501" height="33"><img src="../images/concept_contact_us_04.gif" width="501" height="33" alt=""></td>
</tr>
<tr>
<td width="184" height="109" align="left" valign="top"><img src="../images/concept_form_response_05.jpg" width="184" height="158" alt=""></td>
<td width="15" height="109" align="left" valign="top" background="../images/concept_contact_us_06.gif"><img src="../images/concept_contact_us_06.gif" width="15" height="209" alt=""></td>
<td width="501" height="109" align="left" valign="top"><p><img src="../images/title_information_received.gif" width="225" height="20"></p>
<p>&nbsp;</p>
<p>Thank you for contacting us. Your request is very important to us and will be processed shortly.<br>
</p>
</td>
</tr>
<tr>
<td width="700" height="45" colspan="3"><img src="../images/spacer.gif" width="700" height="45" alt=""></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="13,64,192,113" href="../what_we_do_selling_your_home.html">
</map>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" bgcolor="#CCCCCC" height="1"><img src="../images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center" valign="top">&copy;2004 Smart Choice Property Services. All Rights Reserved.<br>
<br>
142 Hawthorn Road Kingstanding Birmingham West Midlands B44 8PX<br>
<strong>telephone::</strong> 0121 382 2000 <strong>fax::</strong> 0121 382 2000</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
RESPONSE_HTML

exit(0);


PLEASE NOTE I didn't write this script, my knowlege of CGI is limited, although I can grasp a basic understanding of what is going on, I can't work out what is wrong with this script can someone please help.

Thanx
Chris
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
19-Apr-2005, 03:41 PM #2
What you posted is not the CGI script. That is in this location on your server:
cgi-bin/process_contact_form.cgi

The form validation also needs some work because it is trying to validate non required fields.
chris124's Avatar
Member with 41 posts.
 
Join Date: Oct 2002
Location: Stourbridge, United Kingdom
19-Apr-2005, 05:37 PM #3
Well yes you are correct, I have temporaliy replaced the scripts, but it is this one (the original) that I can't see what's wrong
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
19-Apr-2005, 10:04 PM #4
THere are probably components like JMail (in your script) that need to be registered on your web server and I am sure your web server also needs to be running some sort of SMTP server. What kind of web server is this running on?
chris124's Avatar
Member with 41 posts.
 
Join Date: Oct 2002
Location: Stourbridge, United Kingdom
20-Apr-2005, 02:30 AM #5
It's running on a Windows server and I believe it is running some sort of SMTP but not sure about JMail, I'll check that one out.
chris124's Avatar
Member with 41 posts.
 
Join Date: Oct 2002
Location: Stourbridge, United Kingdom
20-Apr-2005, 12:20 PM #6
It appears that JMail isn't enabled, furthermore there's no SMTP on this server, so I suppose it's back to the drawing board, thanks anyway.
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
20-Apr-2005, 12:27 PM #7
You can enable SMTP quite easily on a Windows server, but you leave yourself open to people bouncing emails off of your SMTP server if you don't have a firewall or something to protect against it.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:55 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.