Php 邮件主题引用
我修改了一个内部错误页面,一旦URL被SquidGuard阻止,该页面就会显示给用户。以下是脚本中需要帮助的部分:Php 邮件主题引用,php,javascript,html,Php,Javascript,Html,我修改了一个内部错误页面,一旦URL被SquidGuard阻止,该页面就会显示给用户。以下是脚本中需要帮助的部分: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # IE displayed self-page, if them size > 1024 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function get_error_page($er_code_id, $err
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# IE displayed self-page, if them size > 1024
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function get_error_page($er_code_id, $err_msg='') {
global $err_code;
global $cl;
$str = Array();
header("HTTP/1.1 " . $err_code[$er_code_id]);
$str[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">';
$str[] = '<html>';
$str[] = '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title></title></head>';
$str[] = '<body style="background-color:#FFFFFF; font-family:verdana, arial, sans serif;">';
$str[] = '<div style="padding:5px; background-color:#FFFFFF; text-align:center; font-weight:bold; font-family:verdana,arial,sans serif; color:#2F93D1; font-size:70%;"> <p>';
if ($cl['n']) $str[] = "Your Node Name: {$cl['n']} </p><p> ";
if ($cl['a']) $str[] = "Your Node IP: {$cl['a']} </p><p> ";
if ($cl['i']) $str[] = "Node User: {$cl['i']} </p><p> ";
if ($cl['s']) $str[] = "Group: {$cl['s']} </p><p> ";
if ($cl['t']) $str[] = "Blacklist Category: {$cl['t']} ";
$str[] = '</p></div><div style="background-color:#FFFFFF; text-align:center; padding:20px;">';
$str[] = '<p><img style="padding-top:20px;display: block;margin: 0px auto" src="https://lh4.googleusercontent.com/_aRy3rhrUl64/TaOzVHF01fI/AAAAAAAACVw/H__Us1P5ghc/s800/Untitled.jpg" alt="geblockt"></p></div></div>';
$str[] = '<div style="padding:20px; margin-top:20px; background-color:#FFFFFF; text-align:center; color:#000000; font-family:verdana, arial, sans serif; font-size:80%;">';
if ($err_msg) $str[] = '<p style="font-weight:bold; font-size:150%;"> '. $err_msg.' </p>';
if ($cl['u']) $str[] = "<p><strong>URL: {$cl['u']}</strong></p>";
$str[] = '<p>Because of access restrictions, your request to the above address is not allowed. </p>
<p>Please contact <a href="mailto:firewall_support@iuass.org?subject=[HELP IS NEEDED HERE]&body=Please unblock this URL, thanks">IUASS firewall support</a> if you are of the opinion that this is not correct.</p><p>';
$str[] = '</p><p> </p><p> </p><p> </p><p><img src="http://iuass.org/system/cms/themes/default/img/logo.gif" alt="geblockt" width="315" height="44" style="padding-top:20px;display: block;margin: 0px auto"></p></div></div>';
$str[] = '<div style="width:70%; margin:20px auto; background-color:#FFFFFF; text-align:center; color:#000000; font-size:60%; font-family:verdana,arial,sans serif;">Web Filtering by <a style="color:#000000;">IUASS Firewall implementing pfSense with Squid and SquidGuard</div></div>';
$str[] = "</body>";
$str[] = "</html>";
return implode("\n", $str);
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#IE显示自我页面,如果其大小>1024
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
函数get\u error\u page($er\u code\u id,$err\u msg=''){
全局$err_代码;
全球$cl;
$str=Array();
标题(“HTTP/1.1”。$err_code[$er_code_id]);
$str[]='';
$str[]='';
$str[]='';
$str[]='';
$str[]='';
如果($cl['n'])$str[]=“您的节点名:{$cl['n']}”;
如果($cl['a'])$str[]=“您的节点IP:{$cl['a']}”;
如果($cl['i'])$str[]=“节点用户:{$cl['i']}”;
如果($cl['s'])$str[]=“组:{$cl['s']}”;
如果($cl['t'])$str[]=“黑名单类别:{$cl['t']}”;
$str[]='';
$str[]='';
$str[]='';
如果($err_msg)$str[]='“。$err_msg.
”;
如果($cl['u'])$str[]=“URL:{$cl['u']}”;
$str[]='由于访问限制,您对上述地址的请求是不允许的
如果您认为这不正确,请联系。;
$str[]='';
$str[]=“IUASS防火墙通过Squid和SquidGuard实现pfSense的Web过滤”;
$str[]=“”;
$str[]=“”;
返回内爆(“\n”,$str);
}
我需要做的是将阻止的url添加到中的mailto主题
<a href="mailto:firewall_support@iuass.org?subject=[HELP IS NEEDED HERE]&body=Please unblock this URL, thanks">
据我所知,url由{$cl['u']}指针引用。如果我在“?subject=”之后添加它,由于语法错误,它无法工作。因此,有没有一种方法可以通过html、php或任何其他脚本让用户在单击防火墙时启用_support@iuass.org链接以打开一封新的电子邮件,其中主题字段已填写了quest中的url
我们高度赞赏在这方面提供的任何援助
提前谢谢。怎么样:
<?php echo "<a href='mailto:firewall_support@iuass.org?subject=" . $cl['u'] . "&body=Please unblock this URL, thanks'" ?>
怎么样:
<?php echo "<a href='mailto:firewall_support@iuass.org?subject=" . $cl['u'] . "&body=Please unblock this URL, thanks'" ?>
您是否尝试过以下方法:
if ($cl['u']) $str[] = "<p>Because of access restrictions, your request to the above address is not allowed. </p><p>Please contact <a href=\"mailto:firewall_support@iuass.org?subject={$cl['u']}&body=Please unblock this URL, thanks\">IUASS firewall support</a> if you are of the opinion that this is not correct.</p>";
如果($cl['u'])$str[]=“由于访问限制,您对上述地址的请求是不允许的。如果您认为这不正确,请联系。”;
粘贴代码总是很有用的,例如在pastebin上,这样我们可以查看它,特别是在语法错误的情况下
此外,请注意,如果您使用我建议的简单方法,您将遇到麻烦,因为URL将包含像&这样的字符。您必须首先将所有出现的和替换为它们的HTML属性。您是否尝试过类似的方法:
if ($cl['u']) $str[] = "<p>Because of access restrictions, your request to the above address is not allowed. </p><p>Please contact <a href=\"mailto:firewall_support@iuass.org?subject={$cl['u']}&body=Please unblock this URL, thanks\">IUASS firewall support</a> if you are of the opinion that this is not correct.</p>";
如果($cl['u'])$str[]=“由于访问限制,您对上述地址的请求是不允许的。如果您认为这不正确,请联系。”;
粘贴代码总是很有用的,例如在pastebin上,这样我们可以查看它,特别是在语法错误的情况下
此外,请注意,如果您使用我建议的简单方法,您将遇到麻烦,因为URL将包含像&这样的字符。您必须首先用它们的HTMLENTITY替换所有出现的(&S)。非常感谢Laurence的及时回复。我尝试了您的解决方案,并在第198行的/usr/local/www/sgerror.php中得到了以下错误消息:Parse error:syntax error,意外的T_字符串。有什么建议吗?那一行是198行吗?如果你被杀了怎么办?另外,我上面的答案有一个bug。结尾应该是?>而不仅仅是>,在我的脚本替换第203-235行之间的脚本时,可以到达原始脚本。因此,第198行在我的脚本之前,其中:$str[]=“\n$body\n”;-我也试过了,在第198行收到了同样的错误信息。非常感谢Laurence。实际上我一直在试图找出那一行的错误,所以我再次创建了整个错误页面,并插入了您建议的代码行,在这一点上,该代码行的错误非常明显,如下消息所示:Parse error:syntax error,第229行/usr/local/www/sgerror.php中的意外T_字符串。请建议我应该做什么,谢谢。我希望有人能在这里提供正确的代码语法帮助,谢谢。非常感谢Laurence的及时回复。我尝试了您的解决方案,并在第198行的/usr/local/www/sgerror.php中得到了以下错误消息:Parse error:syntax error,意外的T_字符串。有什么建议吗?那一行是198行吗?如果你被杀了怎么办?另外,我上面的答案有一个bug。结尾应该是?>而不仅仅是>,在我的脚本替换第203-235行之间的脚本时,可以到达原始脚本。因此,第198行在我的脚本之前,其中:$str[]=“\n$body\n”;-我也试过了,在第198行收到了同样的错误信息。非常感谢Laurence。实际上我一直在试图找出那一行的错误,所以我再次创建了整个错误页面,并插入了您建议的代码行,在这一点上,该代码行的错误非常明显,如下消息所示:Parse error:syntax error,第229行/usr/local/www/sgerror.php中的意外T_字符串。请建议我应该做什么,谢谢。我希望有人能在这里提供正确的代码语法帮助,谢谢。非常感谢您的帮助,我实际上非常需要您的帮助。嗯,我尝试了你的解决方案,但它仍然给了我解析错误:语法错误,第229行/usr/local/www/sgerror.php中意外的T_字符串。我已经按照您的建议将整个代码粘贴到:上,其中包括您建议的解决方案。我相信查看该代码将向您揭示错误所在。此外,所有URL都只是域名,没有斜杠或符号,可以是连字符或下划线