Просмотр файла admin/server/seo_analyze.php

Размер файла: 2.64Kb
  1. <?php
  2.  
  3. include '../../engine/includes/start.php';
  4.  
  5. $set['title'] = 'Информация о сервере';
  6.  
  7. include incDir . 'head.php';
  8.  
  9. if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1')
  10. {
  11. Core::msg_show('На локальном сервере Сео анализ не возможен');
  12. }
  13. else
  14. {
  15.  
  16. $ci_url = 'http://bar-navig.yandex.ru/u?ver=2&show=32&url=http://www.'.$_SERVER['SERVER_NAME'].'/';
  17. $ci_data = implode("", file($ci_url));
  18. preg_match("/value=\"(.\d*)\"/", $ci_data, $ci);
  19.  
  20.  
  21. $xml = file_get_contents('http://bar-navig.yandex.ru/u?ver=2&url=http://'.$_SERVER['SERVER_NAME'].'&show=1&post=1');
  22. preg_match('/<tcy rang=\"\d\" value=\"(\d+)\"\/>/Usi', $xml, $res);
  23.  
  24. function GetPosition($keyword, $max_pos = 10)
  25. {
  26. if(isset($keyword))
  27. {
  28. $make_url = 'http://www.google.com/search?hl=en&q=' . urlencode($keyword) . '&start=';
  29. $index=0; // counting start from here
  30. $found=false; // set this flag to true when position found
  31. for ($page = 0; $page < $max_pos; $page++)
  32. {
  33. if($found==true) // break the loop when position found
  34. break;
  35. $readPage = fopen($make_url . $page . 0 ,'r');
  36. $contains = '';
  37. if ($readPage)
  38. {
  39. while (!feof($readPage))
  40. {
  41. $buffer = fgets($readPage, 4096);
  42. $contains .= $buffer;
  43. }
  44. fclose($readPage);
  45. }
  46. $results = array();
  47. preg_match_all('/a href="([^"]+)" class=l.+?>.+?<\/a>/',$contains,$results);
  48. foreach ($results[1] as $link)
  49. {
  50. $link = preg_replace('(^http://|/$)','',$link);
  51. $index=$index+1;
  52. if (strlen(stristr($link,$this->url))>0)
  53. {
  54. $found=true;
  55. break;
  56. }
  57. }
  58. }
  59. if($found==true)
  60. return $index;
  61. else
  62. return -1;
  63. }
  64. return -1;
  65. }
  66. @set_time_limit(25);
  67.  
  68. ?>
  69. <div class="menu_razd">SEO анализ сайта</div>
  70.  
  71. <div class="p_m">
  72. Google PR: <?=$res[1]?><br />
  73. Yandex ТИЦ: <?=is_numeric($ci[1]) ? $ci[1] : 0?>
  74. </div>
  75.  
  76. <div class="p_t">Позиции в Google по мета ключам:<br />
  77. <?php
  78. $keys = explode(',', $set['meta_keywords']);
  79. foreach($keys as $key)
  80. {
  81. echo $key . GetPosition($key).'<br />';
  82. }
  83. ?>
  84. </div>
  85. <?php
  86. }
  87. echo '
  88. <div class="menu_razd">См. также</div>
  89. <div class="link"><a href="..?act=server">Сервер</a></div>
  90. <div class="link"><a href="..">Админка</a></div>';
  91. include incDir . 'foot.php';