function isBot(&$botname = ''){
/* Эта функция будет проверять, является ли посетитель роботом поисковой системы */
$bots = array(
'rambler','googlebot','aport','yahoo','msnbot','turtle','mail.ru','omsktele',
'yetibot','picsearch','sape.bot','sape_context','gigabot','snapbot','alexa.com',
'megadownload.net','askpeter.info','igde.ru','ask.com','qwartabot','yanga.co.uk',
'scoutjet','similarpages','oozbot','shrinktheweb.com','aboutusbot','followsite.com',
'dataparksearch','google-sitemaps','appEngine-google','feedfetcher-google',
'liveinternet.ru','xml-sitemaps.com','agama','metadatalabs.com','h1.hrn.ru',
'googlealert.com','seo-rus.com','yaDirectBot','yandeG','yandex',
'yandexSomething','Copyscape.com','AdsBot-Google','domaintools.com',
'Nigma.ru','bing.com','dotnetdotcom'
);
foreach($bots as $bot)
if(stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false){
$botname = $bot;
return true;
}
return false;
}
if( isBot($bname) ) {
// Перебрасываем на Москву
}
<?
register_shutdown_function( "fatal_handler" );
function fatal_handler() {
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if( $error !== NULL) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
echo format_error( $errno, $errstr, $errfile, $errline);
}
}
function format_error( $errno, $errstr, $errfile, $errline ) {
$trace = print_r( debug_backtrace( false ), true );
$content = '<table style="background-color: #FFFFFF;margin: 0 auto;">
<thead><th style="width: 100px;">Item</th><th>Description</th></thead>
<tbody>
<tr>
<th>Error</th>
<td><pre>'.$errstr.'</pre></td>
</tr>
<tr>
<th>Errno</th>
<td><pre>'.$errno.'</pre></td>
</tr>
<tr>
<th>File</th>
<td>'.$errfile.'</td>
</tr>
<tr>
<th>Line</th>
<td>'.$errline.'</td>
</tr>
<tr>
<th>Trace</th>
<td><pre>'.$trace.'</pre></td>
</tr>
</tbody>
</table>';
return $content;
}
class PHPFatalError
{
public function set_handler() {
register_shutdown_function(array($this, 'handle_shutdown'));
}
public function handle_shutdown() {
if (($error = error_get_last())) {
// echo сообщения о деталях ошибки
}
}
}