[ back to toc ]

[xyz.com password]

Date: 2002/03/28 11:16

Q:
PERL/CGI

Hello!
I have a flat file database (data.txt)with data stored and seperated by
|| in the format below:

1b5610|raj|normal|raj|raj|abc@xyz|nnnnnnnnnnnn|bbbbbbbbbbb|m|m|i|6336893||
|on

The 1st field is Password,the 2nd is Username, the
6th field is the email ID.
I need a simple program that can retrieve the username & password & mail
it to that email ID.

Basically there must be a form action,where the
person must enter his email ID and then the program checks for that email
ID & sends the username & password of that user by email.
Something like this:
TO: [emailID]
Your username is raj
Your password is raj

Can you help me please??
Sunil Advani.

A:
Yes, I can help you. If you have specific problem with the program then
ask me a question and I can help you find the issue. I will not, however
solve the issue instead of you. For me this volunteering task is to teach
others, help with knowledge delivery.

regards,
Peter
Q:
OK,
I am trying to do something like this. Could u kindly let me know if
anthing else is reqd ??

sub find {

&checkaddress;

# Open member database, read info
open (DAT,"<$memberinfo/amdata.db");
if ($LOCK_EX){
flock(DAT, $LOCK_EX); #Locks the file
}
@database_array = <DAT>;
close (DAT);

foreach $lines(@database_array) {
@edit_array = split(/\:/,$lines);

&parseemail;
# if ($edit_array[2] =~ /$INPUT{'email'}/i) {last; }

if ($edit_array[2] eq $email) {last; }

}

# unless ($edit_array[2] =~ /$INPUT{'email'}/i) {

unless ($edit_array[2] eq $email) {

print "Content-type: text/html\n\n";
&header;
print "<CENTER><BR><TABLE
BORDER=\"0\" WIDTH=\"450\"><TBODY><COLDEFS><COLDEF></COLDEFS><ROWS><TR><TD
COLSTART=\"1\"><P><B><FONT FACE=\"verdana, arial, helvetica\"><FONT
COLOR=\"#FF0000\">Account Manager</FONT> Status: Not
Found!</FONT></B></P><P><FONT
SIZE=\"-1\" COLOR=\"$fontcolor\" FACE=\"verdana, arial, helvetica\">Your
$orgname account information was not found in our database. Please make
sure that you used the same email address that you created your account
with.</FONT></P><P><FONT
SIZE=\"-1\" COLOR=\"$fontcolor\" FACE=\"verdana, arial,
helvetica\">Please contact <A
HREF=\"mailto:$orgmail\">$orgname Support</A> for your account
information.</FONT></P><HR
SIZE=\"1\"><CENTER><FONT SIZE=\"-2\" FACE=\"verdana, arial, helvetica\">
$orgname is maintained with <A
HREF=\"http://www.xyz.com\"><B>xyz.com</B></A></FONT>
</CENTER></TD></TR></ROWS></TBODY></TABLE></CENTER>";
&footer;
exit;
}

print "Content-type: text/html\n\n";
&header;
print "<CENTER><BR><TABLE
BORDER=\"0\" WIDTH=\"450\"><TBODY><COLDEFS><COLDEF></COLDEFS><ROWS><TR><TD
COLSTART=\"1\"><P><B><FONT FACE=\"verdana, arial, helvetica\"><FONT
COLOR=\"#FF0000\">Account Manager</FONT> Status:
Success!</FONT></B></P><P><FONT
SIZE=\"-1\" COLOR=\"$fontcolor\" FACE=\"verdana, arial, helvetica\">Your
$orgname account information has been emailed to you at:
$INPUT{'email'}.</FONT></P><P><FONT
SIZE=\"-1\" COLOR=\"$fontcolor\" FACE=\"verdana, arial, helvetica\">Please
contact <A
HREF=\"mailto:$orgmail\">$orgname Support</A> if you need any further
assistance.</FONT></P><HR
SIZE=\"1\"><CENTER><FONT SIZE=\"-2\" FACE=\"verdana, arial, helvetica\">
$orgname is maintained with <A
HREF=\"http://www.xyz.com\"><B>xyz.com</B></A></FONT>
</CENTER></TD></TR></ROWS></TBODY></TABLE></CENTER>";
&footer;

open (MAIL, "|$mailprog -t")
|| print "Can't start mail program";

print MAIL "To: $edit_array[6]\n";
print MAIL "From: $orgmail ($orgname Support)\n";
print MAIL "Subject: $orgname Account Information\n\n";
#Date
print MAIL "$date\n";

# Check for Message Subject

print MAIL "-" x 75 . "\n\n";

print MAIL "You requested your $orgname account information:\n\n";

print MAIL "Your $orgname User ID is: $edit_array[0]\n";
print MAIL "Your $orgname password is: $edit_array[1]\n\n";

print MAIL "please contact $orgname support at: $orgmail\n";
print MAIL "if you have any questions.\n\n";

print MAIL "$orgname Support Team\n";

close (MAIL);

exit;

}

xxxxxxxxxxTHIS IS THE FORM ACTIONxxxxxxxxxxxxxxxxxxxx
<FORM ACTION="http://www.xyz.com/cgi-xyz/members/find.pl" METHOD="POST">
<P><FONT SIZE="-2" FACE="verdana, arial, helvetica">E-mail
Address</FONT><BR>
<INPUT TYPE="TEXT" NAME="email" SIZE="11"><BR>
<INPUT TYPE="SUBMIT" VALUE=" Search " NAME="find"></P></FORM>
A:
Maybe a good pint of beer.

I did not check that it works, but if it did, what else is needed?

Regards,
Peter

[ back to toc ]