CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
HELP with misconfiguration: I can't seem to find it

 



CuzDesign
Deleted

Nov 15, 2000, 3:29 PM

Post #1 of 4 (292 views)
HELP with misconfiguration: I can't seem to find it Can't Post

Hello,
I have a problem and cannot seem to find what the problem is. I have looked the code over and over and for some reason it is not working all of a sudden. Was working before but nothing now all I get now is an internal server error. Below is the code if anyone can help I would be most appreciated.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


#!/usr/bin/perl

use CGI qw(param);

require 'config.pl';

$mailprog = '/usr/sbin/sendmail';

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

$findemail = param('find');
$good = 0;
open (DATA,"< users.dat") or die "Couldn't open users.dat $!\n";
while (<DATA> ){
chomp;
my @emails = split(/:/,$_);
if (lc($findemail) eq lc($emails[0])){
$good = 1;
$to = $list[0];
$username = $list[1];
$password = $list[2];
$name = $list[3];
}
}
if ($good == 1) {
# Set the body of the email to be sent on order
my $body = <<HERE;
******************** Here is your log-in information *********************

Hello $name,

You requested your $sitetitle account information:

Your $sitetitle User ID is: $username
Your $sitetitle password is: $password

please contact $companyname support at: $adminemail
if you have any questions.

To access $sitetitle use the URL below:
$membersurl

$companyname Support Team

*******************************************************************
HERE

# Send email
open(MAIL,"|$mailprog -t");
print MAIL "To: $to\n";
print MAIL "From: $companyname support <$adminemail>\n";
print MAIL "Subject: Log-in Information for $sitetitle\n\n";
print MAIL $body;
close MAIL;

print <<HTML;
<html>
<head>
<title>$sitetitle</title>
</head>
<body>
<div align="center">
<table width="500" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><font face="Verdana, Arial" size="3" color="#000000"><b>Status: <font color="#FF0000"> Account Found</b></font><br><br>
<font size="-1">Your $sitetitle account information has been emailed to you at: $to.<br><br>
Please contact <a href="mailto:$adminemail">$companyname Support</a> if you need any further assistance.<br><br>
-------------------------------------------------------------------<br>
<font size="-2">$sitetitle is maintained with <a href="http://www.cuzzart.com/cwdmembers/">CWD Member Manager 1.0</a></td>
</tr>
</table>
</div>
</body>
</html>
HTML
}else {
print <<HTML;
<html>
<head>
<title>$sitetitle</title>
</head>
<body>
<div align="center">
<table width="500" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><font face="Verdana, Arial" size="3" color="#000000"><b>Status: <font color="#FF0000"> Account Not Found</b></font><br><br>
<font size="-1">Your $sitetitle account information can not be found<br><br>
Please contact <a href="mailto:$adminemail">$companyname Support</a> if you need any further assistance.<br><br>
----------------------------------------------------------------------<br>
<font size="-2">$sitetitle is maintained with <a href="http://www.cuzzart.com/cwdmembers/">CWD Member Manager 1.0</a></td>
</tr>
</table>
</div>
</body>
</html>
HTML
}
</pre><HR></BLOCKQUOTE>

Thanks in advance.

Ray


sleuth
Enthusiast / Moderator

Nov 15, 2000, 3:58 PM

Post #2 of 4 (292 views)
Re: HELP with misconfiguration: I can't seem to find it [In reply to] Can't Post

 
One thing I see is you never closed(DATA)

I don't think that's it though,

Maybe there is something wrong in the config.pl file, try taking out

require 'config.pl';

And trying it,

Also, take out junks of code to find out where the problem is, proccess of elimination. ;)

Sleuth


CuzDesign
Deleted

Nov 15, 2000, 10:26 PM

Post #3 of 4 (292 views)
Re: HELP with misconfiguration: I can't seem to find it [In reply to] Can't Post

Sleuth,
Thank you for your reply. I took out bits of code like you suggested,
it seems to be a problem with "sendmail" itself.

Everything else works fine untill I put back in the actual part where I am sending the
email then the error comes up.

I forwareded it to our system admin, maybe they will find the problem.

Thank you,
Ray




CuzDesign
Deleted

Nov 21, 2000, 7:26 PM

Post #4 of 4 (292 views)
Re: HELP with misconfiguration: I can't seem to find it [In reply to] Can't Post

Found the problem it wasn't in the sendmail program it was in my code.

In the while loop for the database I referred to the fields wrong.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


open (DATA,"<users.dat") or die "Couldn't open users.dat $!\n";
while (<DATA> ){
chomp;
my @emails = split(/:/,$_);
if ($findemail eq $emails[0]){
$good = 1;
$to = $list[0];
$username = $list[1];
$password = $list[2];
$name = $list[3];
}
}
close (DATA);
</pre><HR></BLOCKQUOTE>

I was putting everthing in the array @emails and then referring to them as $list[0] as if I was using @list.

Thanks for your help.

Regards,
Ray


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives