首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mailto主题引用

Mailto主题引用
EN

Stack Overflow用户
提问于 2013-04-19 12:49:41
回答 2查看 466关注 0票数 0

我已经修改了一个内部错误页面,一旦网址被SquidGuard阻止,它就会显示给用户。以下是脚本中我需要一些帮助的部分:

代码语言:javascript
复制
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</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);
}

我需要做的是将阻止的url添加到mailto主题中。

代码语言:javascript
复制
<a href="mailto:firewall_support@iuass.org?subject=[HELP IS NEEDED HERE]&body=Please unblock this URL, thanks">

据我所知,url是由{$cl'u'}指针引用的。如果我将它添加到上面的"?subject=“之后,由于语法错误,它不能工作。因此,有没有办法通过html或php或任何其他脚本,使用户一旦点击firewall_support@iuass.org链接,就能打开一封新的电子邮件,其中主题字段已经填满了quest中的url?

在这方面的任何帮助都是非常感谢的。

提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-23 01:11:01

你有没有尝试过这样的东西:

代码语言:javascript
复制
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>";

粘贴代码总是很有用的,例如粘贴在粘贴板上,这样我们就可以查看它,特别是在出现语法错误的情况下。

此外,请注意,如果您使用我建议的简单方法,您将会遇到麻烦,因为urls将包含像&这样的字符。您必须首先用它们的htmlentities替换&的所有匹配项。

票数 1
EN

Stack Overflow用户

发布于 2013-04-19 12:56:28

这样如何:

代码语言:javascript
复制
<?php echo "<a href='mailto:firewall_support@iuass.org?subject=" . $cl['u'] . "&body=Please unblock this URL, thanks'" ?>

这将创建一个超链接,其中包含您提到的插入$cl'u‘内容的mailto URI。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16097397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档