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