PHP/shell script

brad brad at ispn.net
Fri Aug 15 17:38:00 CDT 2003


Hi all,

I am trying to write a php script to allow a user to go to a web page
and enter an email address or domain to be blocked or unblocked in the
sendmail access file.  The script needs to check the current access file
to see if the address is already in there, add the address with the
correct attribute (RELAY, or 550 REJECT We do not accept spam!) if its
not in there, or return a notice to the user that the address is already
blocked/released.  I am a complete novice in PHP and not very versed in
shell scripting.

The web page is a php form mail and passes to the script the email
address as $email and the attribute to block or release as an action of
0 or 1.  My approach is to have php call up a shell command within an
IF/ELSE statement and have the shell command determine if the address is
there.  I was thinking of catting the file and grepping for $email, but
I am not sure what to return to the PHP script and how to pass to it
whether the address was followed by RELAY or 550.  Finally, if the
address was not found in access, the script needs to append the address
with the correct attribute and run makemap.  I am wanting a way to
verify that makemap did not return any dupes and give the user an error
if it did.

Any thoughts on how to approach this?  

TIA,

Brad




More information about the Kclug mailing list