如何使报告断开链接按钮

时间:2019-12-08 21:23:25

标签: javascript html hyperlink

我有一个视频网站,我需要创建一个链接或按钮,以便访问者可以单击以报告断开的链接。

我尝试包含REQUEST_URI,但到目前为止没有成功。该URL永远不会显示,并且我不会收到任何消息。

这是report.php的内容:

<?php
$to = 'admin@domain';
$subject = 'domain.com Broken Link';
$message = '
<html>
<head>
  <title>Dead Link from domain.com</title>
</head>
<body>
  <p>The website contains a DEAD LINK</p>
  <p>Please fix or remove the faulty file or page.</p>
<?php 
function url_origin( $s, $use_forwarded_host = false )
{
    $ssl      = ( ! empty( $s['HTTPS'] ) && $s['HTTPS'] == 'on' );
    $sp       = strtolower( $s['SERVER_PROTOCOL'] );
    $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );
    $port     = $s['SERVER_PORT'];
    $port     = ( ( ! $ssl && $port=='80' ) || ( $ssl && $port=='443' ) ) ? '' : ':'.$port;
    $host     = ( $use_forwarded_host && isset( $s['HTTP_X_FORWARDED_HOST'] ) ) ? $s['HTTP_X_FORWARDED_HOST'] : ( isset( $s['HTTP_HOST'] ) ? $s['HTTP_HOST'] : null );
    $host     = isset( $host ) ? $host : $s['SERVER_NAME'] . $port;
    return $protocol . '://' . $host;
}

function full_url( $s, $use_forwarded_host = false )
{
    return url_origin( $s, $use_forwarded_host ) . $s['REQUEST_URI'];
}

$absolute_url = full_url( $_SERVER );
echo $absolute_url;
?>
</body>
</html>';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
mail($to, $subject, $message, implode("\r\n", $headers));
echo ("The report has been sent.<br>Thank you for your time.");
?>

0 个答案:

没有答案