Hello,
I am trying to write something to edit a sendmail aliases file via the web. The script should have a drop down menu with the different pager numbers in it. When someone picks their number out of the list, the script should replace one entry in the aliases file. I have written everything with the exception of replacing the entry in the aliases file. This is what i have so far:
#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
#use strict;
use warnings;
my $q = new CGI;
print $q->header( "text/html" );
my $counter;
open(ALIAS, "/etc/aliases") or die "Unable to open tmp file:$!\n";
while(<ALIAS>)
{
if(/pageoncall/)
{
$currentOncall = $_;
}
}
$buffer = $ENV{'QUERY_STRING'};
print $buffer;
print <<EOF;
<html>
<head>
<title>Answer the call!</title>
</head>
<body>
<p>$oncall</p>
<p>If you want to answer the call, please enter your phone number below. (Only the number should be entered, no domain.)</p>
<form action="URL/aliases.cgi" method="GET">
Please select a number: <select name="pager">
<option>
<option>1234567890\@messaging.sprintpcs.com
<option>1234567890\@archwireless.net
<option>0987654321
</select><input type = "submit">
</form>
</body>
</html>
EOF
I am also wondering how to convert the 1234567890%40archwireless.net created by the script to the @domain format.