I want to report deadlinks on my site, my current script does work but it allows search engine bots to click the dead link report which makes it hard for me to determine which reports are form visitors and which are from bots.

What am I doing wrong here?
As the bots are still able to click the link and send the report to me.

Any help is much appreciated
Thanks.

$x=$_GET['Deadlink'];
$agent=$_GET['agent'];

$bots = array(
'bing' => 'http://onlinehelp.microsoft.com/en-us/bing/gg132928.aspx', 
'yahoo' => 'http://help.yahoo.com/help/us/ysearch/slurp', 
'google' => 'http://www.google.com/support/webmasters/bin/answer.py?answer=182072',
'ask'=>'http://www.ask.com/questions-about/Webmaster-Tool',
);
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
foreach( $bots as $name => $bot)
{
    if(stripos($agent,$bot)!==false)
    {
        echo $name;
		echo"Sorry, No Link or Data";
    }
}    

if($x==1 && $agent !==true){
{ 
 $to="admin@blitz-labs.com \r\n";
 $subject.="Dead Link Reported \r\n";
 $message.="url link \r\n";
 $message.=" IP address :".$_SERVER["REMOTE_ADDR"]."\r\n";

	echo "Thank you for Reporting the Deadlink! We will rewview the link and repklace it if nesseart";
  } 
else 
{
/////NOT SURE HOW TO MAKE THIS WORK /////
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
foreach( $bots as $name => $bot)
{
    if(stripos($agent,$bot)!==false)
    {
        echo $name;
        echo"Sorry, No Link or Data";
    } 
/////////////////////////////////////////////
echo "Link not loading or broken.  Why not ";
	echo"<a href='?Deadlink=1&agent=false>Report Deadlink?</a>";
}

Recommended Answers

All 3 Replies

sorry this doesnt exist in the scirpt sorry

/////NOT SURE HOW TO MAKE THIS WORK /////$agent = strtolower($_SERVER['HTTP_USER_AGENT']);foreach( $bots as $name => $bot){    if(stripos($agent,$bot)!==false)    {        echo $name;        echo"Sorry, No Link or Data";    } /////////////////////////////////////////////

If you amended your notification links to have their own subdirectory, to something like:

<a href="/report/dead?id=123" title="Report dead link">Report dead link</a>

Then you could use a robots.txt file to exclude the /report directory. This should stop robots from indexing any page in that directory.

R.

thanks for the reply sorry I took so long to reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.