📄 save_access.cgi
字号:
#!/usr/local/bin/perl# save_access.cgi# Save, create or delete an access rulerequire './sendmail-lib.pl';require './access-lib.pl';&ReadParse();$access{'access'} || &error("You are not allowed to configure spam control");$conf = &get_sendmailcf();$afile = &access_file($conf);($adbm, $adbmtype) = &access_dbm($conf);@accs = &list_access($afile);if (!$in{'new'}) { $a = $accs[$in{'num'}]; }if ($in{'delete'}) { # delete some rule &delete_access($a, $afile, $adbm, $adbmtype); }else { # Saving or creating.. check inputs $whatfailed = "Failed to save spam control rule"; $from = $in{'from'}; $in{'from_type'} == 0 && $from !~ /^[^\@ ]+\@[A-z0-9\.\-]+$/ && &error(&text('ssave_etype0', $from)); $in{'from_type'} == 1 && $from !~ /^[0-9\.]+$/ && &error(&text('ssave_etype1', $from)); $in{'from_type'} == 2 && $from !~ /^[^\@ ]+$/ && &error(&text('ssave_etype2', $from)); $in{'from_type'} == 3 && $from !~ /^[A-z0-9\.\-]+$/ && &error(&text('ssave_etype3', $from)); $from .= '@' if ($in{'from_type'} == 2); if ($in{'action'}) { $action = $in{'action'}; } else { $in{'err'} =~ /^\d\d\d$/ || &error(&text('ssave_ecode', $in{'err'})); $action = "$in{'err'} $in{'msg'}"; } %newa = ( 'from', $from, 'action', $action ); if ($in{'new'}) { &create_access(\%newa, $afile, $adbm, $adbmtype); } else { &modify_access($a, \%newa, $afile, $adbm, $adbmtype); } }&redirect("list_access.cgi");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -