&find_mail; &get_input; $htp=$path_to_domain.$folder."/.htpasswd"; open(HT,"$htp"); while(){ chomp(); ($m,$p,$e)=split(/\:/); if($query=~/\@/){ if($e eq $query){ $email=$e; &gen; $_=qq~$m:$p:$e~; } }else{ if($m eq $query){ $email=$e; &gen; $_=qq~$m:$p:$e~; } } $SAVE.=$_."\n"; } close(HT); if($fnd){ open(HT,">$htp"); print HT "$SAVE"; close(HT); &send; ######################################### SEND EMAIL $note=qq~New Password was sent to $email~; }else{ if($query =~ /\@/){ $note = qq~Your Email Address $query Was Not Found~; }else{ $note=qq~Your Member Name $query Was Not Found~; } } print "Content-type: text/html\n\n"; print "$note"; sub send{ if($found_sendmail){ open(MAIL,"|$found_sendmail -t"); print MAIL "From: $host <$account_email>\n"; print MAIL "To: $email\n"; print MAIL "Subject: New Password For $host\n\n"; print MAIL qq~Your New Password for\n\nhttp://$ENV{'HTTP_HOST'}$folder\n\n$px~; }else{ $sm_recipient=$email; $sm_from=$account_email; $sm_subject="New Password For $host"; $sm_message=qq~Your New Password for\n\nhttp://$ENV{'HTTP_HOST'}$folder\n\n$px~; &sendemail; } }#send sub gen{ $fnd=1; $px=time; $px=reverse($px); $px=crypt($px,"ce"); $px=~s/\W//g; $px=substr($px,2,8); if($^O !~ /mswin32/i){ $salt=substr($px,0,2); $p=crypt($px,$salt); }else{ $p=$px; } } sub find_mail{ eval "`which sendmail`"; if(!$@){ $found_sendmail = `which sendmail`; } if(!$found_sendmail){ $@ = undef; if(-e "/usr/sbin/sendmail"){ $found_sendmail="/usr/sbin/sendmail"; } elsif(-e "/usr/lib/sendmail"){ $found_sendmail="/usr/lib/sendmail"; } elsif(-e "/usr/bin/sendmail"){ $found_sendmail="/usr/bin/sendmail"; } elsif(-e "/usr/local/sbin/sendmail"){ $found_sendmail="/usr/local/sbin/sendmail"; } elsif(-e "/usr/local/lib/sendmail"){ $found_sendmail="/usr/local/lib/sendmail"; } elsif(-e "/usr/local/bin/sendmail"){ $found_sendmail="/usr/local/bin/sendmail"; } } }find_mail 1;