繁体   English   中英

Mailto主题引用

[英]Mailto subject referencing

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

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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主题中

<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链接以打开新的电子邮件,则该主题字段中的任务字段中已经填充了该URL ?

非常感谢在这方面的任何协助。

提前致谢。

怎么样:

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

这将使用您提到的mailto URI创建一个超链接,并插入$ cl ['u']的内容。

您是否尝试过类似的方法:

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>";

粘贴代码(例如在pastebin上)始终很有用,这样我们就可以查看一下,尤其是在语法错误的情况下。

此外请注意,如果按照我建议的简单方式执行操作,将会遇到麻烦,因为url包含&之类的字符。 您必须先用它们的htmlentity替换&的所有出现。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM