#!/usr/bin/perl $status_message = '

Your message has been sent!

'; $debug = '0'; # 1 is on 0 is off #$url_to_this_script = 'www.mydomain.com/cgi-bin/paging.cgi'; $default_email_from = 'paging@mydomain.com'; # if your html has single quotes you'll need to backslash them -> ' becomes \' or else you'll get an error # add your html here between the single quotes $html_head = ' Fire District :: Paging '; $html_foot = ' '; ############## do not edit below this line ########## require '/home/mydomain/mydomaincontact.lib'; use CGI; my $cgi=new CGI; $a = $cgi->param('a'); $f = $cgi->param('f'); $b = $cgi->param('b'); $z = $cgi->param('z'); $x = $cgi->param('x'); $g = $cgi->param('g'); @t = $cgi->param('t'); print "Content-type: text/html\n\n"; print $html_head; if($x eq 'all') { @t = ''; foreach $key(keys %name_email) { if($key) { push(@t, $name_email{$key}); } } } if($x eq 'group') { if(exists($groups{$g})) { $email_list = $groups{$g}; $email_list =~ s/^\,|\,$//; @t = split(/,/, $email_list); } else { print "

ERROR : Send to group selected but no group specified!

\n $html_foot";exit; } } if($a eq 'send') { &send; } else { &main; } print $html_foot; exit; sub main { foreach $key(sort keys %name_email) { $mo = "$mo \n"; } @gp_name = keys %groups; if(@gp_name) { $group_menu_code = "All Members
Specific Group \n"; } print <

Paging

 

Hold down the Ctrl or Shift key to select multiple addresses
 
Send Page To:
Member(s) selected above
$group_menu_code
 
Message – Part 1:
If your message exceeds 130 characters, type the rest of your message in the Part 2 box below
 
characters remaining  
   

Message – Part 2:
you may enter up to 130 characters

characters remaining
 
 
FORM } sub send { if(!$b) { $error .= "Enter a message"; } if($error) { print "

Use the back button and fill in the missing items:

\n

$error

$html_foot";exit; } if($debug == 1) { print "
Info sent to be processed : \nA-$a \nX-$x \nTo - @t \nFrom-$f \nBody-$b \n 
$html_foot"; } else { # if($f =~ /^(\w+).*\@(\w+).*\..*(\w+)$/) { $date = `date`; foreach $ad(@t) { $ad =~ s/([^\x20-\x7E])//ge; $ad =~ s/\n|\ |\r//g; if($ad =~ /^(\w+).*\@(\w+).*\..*(\w+)$/) { open (MAIL,"|/usr/sbin/sendmail -i -t -f $default_email_from")||&status("$f could not send the emai l \"$s\" to $ad
\n"); print MAIL "To: $ad \nFrom: $default_email_from \n"; print MAIL "$b \n"; close(MAIL); if(length($z) > 0) { open (MAIL,"|/usr/sbin/sendmail -i -t -f $default_email_from")||&status("$f could not send the email \"$s\" to $ad
\n"); print MAIL "To: $ad \nFrom: $default_email_from \n"; print MAIL "$z \n"; close(MAIL); } &status("-$ad- sent ok

\n"); } } print "$status_message"; # } else { print "ERROR : from email address bad format
\n$html_foot \n";exit; } } } sub status { $status_message = "$status_message $_[0]"; }