We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2266
    • 7 Posts
    I have been using php robot visit script http://stevedawson.com/robotvisit.php on my sites without any issue, except that the script doesn’t work on any add-on domain in cpanel.

    I use the script as snippet and call it in the template.

    Any ideas why the script is not working in add-on domain (will be third level domain).

    Here is the script in any case to have a look at:

    <?php
    $EmailAddress = "[email protected]";
    $EmailAddress = preg_replace("/[\n\r]+/", "", "$EmailAddress");
    $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
    $footer = "------------------------------------------------------------------------------
    RobotVisit v1.0 
    
    ------------------------------------------------------------------------------";
    $today = date("F j, Y, g:i a");
    $header = "-----------------------------------------------------------------------------
         SEARCH ENGINE ROBOT HAS VISITED 
    -----------------------------------------------------------------------------";
    ##  GOOGLE SEARCH ENGINE	
    
     if(eregi("Googlebot",$_SERVER['HTTP_USER_AGENT'])) {
     global $header;
     global $footer;
     global $today;
      if ($_SERVER['QUERY_STRING'] != "")  {$GoogleLink = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];}
    else  {$GoogleLink = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];} 
    $Googlereferer = "http://".$_SERVER['HTTP_REFERER'];
    $GoogleEmail = "
    ".$header."
    Hi There,
    The Search Engine robot Googlebot has been detected on your website.
    Googlebot is ".$_SERVER['HTTP_USER_AGENT']."
    Googlebot has visited http://".$_SERVER['SERVER_NAME']."
    Googlebot came from page $Googlereferer
    Googlebot has crawled the page ".$GoogleLink."
    Time of visit - ".$today."
    
    Search Engine Link: http://www.google.com
    ".$footer."
    ";
    	      @mail("$EmailAddress", "Google Robot Visit", $GoogleEmail, "From: <Google Robot>$EmailAddress");		  
       }
    
    if(eregi("Yandex",$_SERVER['HTTP_USER_AGENT'])) {
        global $header;
     global $footer;
     global $today;
      if ($_SERVER['QUERY_STRING'] != "")  {$YandexLink = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];}
    else  {$YandexLink = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];} 
    $Yandexreferer = "http://".$_SERVER['HTTP_REFERER'];
    $YandexEmail = "
    ".$header."
    Hi There,
    The Search Engine robot Yandex has been detected on your website.
    Yandex robot address is ".$hostname."
    Yandex robot is ".$_SERVER['HTTP_USER_AGENT'].";
    Yandex has visited http://".$_SERVER['SERVER_NAME']."
    Yandex came from page ".$Yandexreferer."
    Yandex has crawled the page ".$YandexLink."
    Time of visit - ".$today."
    
    Search Engine Link: http://www.yandex.ru
    ".$footer."
    ";
    	      @mail("$EmailAddress", "Yandex Robot Visit", $YandexEmail, "From: <Yandex Robot>$EmailAddress");		  
      }
    ?>