Просмотр файла linkrot_phps.php

Размер файла: 6.11Kb
<?php

/*************** PHPLinkRot v 1.3 ***************/ 
/************************************************/ 
/*  written by A. Gianotto - 3/28/2000          */ 
/*   updated: 6/21/2001                                  */
/*  To find out if this is the latest version   */ 
/*  of this script, email [email protected], or   */ 
/*  visit http://www.snipe.net                  */ 
/************************************************/ 
/*  You can see this script in use by going to  */ 
/*  http://www.snipe.net/geek/test.html      */ 
/************************************************/ 
/************************************************/ 
/*  PHPLinkRot may be used freely for private   */ 
/*  or commercial use.  All I ask is that you   */ 
/*  don't include it in any collections without */ 
/*  my permission.                              */ 
/************************************************/ 
/************************************************/ 
/*  DESCRIPTION:                                */ 
/*  This program can be used as a custom 404 page.         */ 
/*                                              */ 
/*  It simply gets the referring URL and prints */ 
/*  a form that allows the user to quickly send */ 
/*  the site administrator notification of the  */ 
/*  broken link.  It also allows the user to    */ 
/*  send their name and email address with the  */ 
/*  notification, as well as a short comment,   */ 
/*  to allow the site administrator to send the */ 
/*  user the correct URL if they choose to.     */ 
/************************************************/ 
/************************************************/ 
/*  INSTALLATION:                               */ 
/*  There is no readme or install file with     */ 
/*  script, because it's so easy to install,    */ 
/*  you just have to follow the comments in the */ 
/*  first part of the code                      */ 
/* ************************************* 
/* To add this into your HTML to make it work, */
/* just set this page as your custom 404           */ 
/*  error page by adding the line below: */ 
/* ErrorDocument 404 /oops.php                                 */ 
/* to your .htaccess file - assuming your page name is oops.php of course */ 
/************************************************/ 
/************************************************/ 

// SCRIPT BEGINS - edit the variables below

// path to header include
include "/your/path/info/header.php";

// Enter the website administrators email address here 
$adminaddress = "[email protected]"; 

// Enter the company name or site name here 
$sitename = "YourSite.Com"; 

// Enter the address of your website here 
$siteaddress ="http://www.yoursite.com"; 

// Unless you are changing the verbage of the printed message, 
// there are no further configurations that need to be done  
// past this point, except editing the path to your footer includes 

// If you do not use header and footer files, you can just replace 
// the include calls with your HTML, but be sure to close the PHP tags 
// before and after the HTML, so you don't get parse errors. 

IF ($action==""){ 
?> 


<? 
$referer = getenv("HTTP_REFERER");
$badpage=($siteaddress.$REQUEST_URI);

?> 
<b>To report this link broken</b> and help us fight the nasty V.D. of the internet known as Linkrot,  
please fill out the simple form below. 
<BR> 
<BR><B>NOTE:</B>  We only request your name and email address so that we may notify  
you if the page you are looking for has been moved. 
<BR><FORM METHOD=POST ACTION="<? echo "$PHP_SELF"; ?>"> 

<TABLE BORDER="0" CELLSPACING="3" CELLPADDING="3"> 
<TR> 
    <TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="- 
1"><b>Name</b>:</FONT></TD> 
    <TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"  
SIZE="3"><INPUT TYPE="text" NAME="name"></FONT></TD> 
</TR> 
<TR> 
    <TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="- 
1"><b>Email</b>:</FONT></TD> 
    <TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif"  
SIZE="3"><INPUT TYPE="text" NAME="email"></FONT></TD> 
</TR> 
<TR> 
    <TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="- 
1"><b>Broken Link</b>:</FONT></TD> 
    <TD VALIGN="TOP"><i><?php echo "$badpage"; ?></i></FONT></TD> 
</TR> 
<?php if ($referer!=""){ ?>
<TR> 
    <TD VALIGN="TOP"><FONT FACE="Arial, Helvetica, Verdana, Sans Serif" SIZE="- 
1"><b>Linked From</b>:</FONT></TD> 
    <TD VALIGN="TOP"><i><?php echo "$referer"; ?></i></FONT></TD> 
</TR> 
<?php } ?>
<TR> 
    <TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans  
Serif" SIZE="-1"><b>Additional Comments</b>:</FONT></TD> 
</TR> 
<TR> 
    <TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans  
Serif" SIZE="3"><TEXTAREA NAME="comments" ROWS="3"  
COLS="30"></TEXTAREA></FONT></TD> 
</TR> 
<TR> 
    <TD VALIGN="TOP" COLSPAN="2"><FONT FACE="Arial, Helvetica, Verdana, Sans  
Serif" SIZE="3"><INPUT TYPE="hidden" NAME="referer" VALUE="<? echo "$referer"; ?>"><INPUT TYPE="hidden" NAME="badpage" VALUE="<? echo "$badpage"; ?>"><INPUT  
TYPE="submit" NAME="action" VALUE="Send"></FONT></TD> 
</TR> 
</TABLE> 

</FORM> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 


<? 

} ELSEIF ($action="Send") { 
mail("$adminaddress","Broken Link on $sitename","$name has reported the following broken: \n\nBroken link:$badpage \nLinked from:$referer \n\nAdditional Comments: \n------------------------------------ \n $comments \n------------------------------------ \n\n $sitename \n $adminaddress \n $siteaddress","FROM:$email"); 
?> 
<H3>Thank you!</H3> 
We appreciate you taking the time to help us improve our site!  If the page you are looking for  
still exists on our server, but has been moved, we will email you with it's new location. 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 
    <BR> 

<? 
}

// Be sure to edit this to point to your footer file
include "/your/path/info/footer.php";

// ************************************* 
// End script


?>