/** * PageRank Lookup (Based on Google Toolbar for Mozilla Firefox) * * @copyright 2011 HM2K <*****@*****.**> * @link http://pagerank.phurix.net/ * @author James Wade <*****@*****.**> * @version $Revision: 2.0 $ * @require PHP 4.3.0 (file_get_contents) * @updated 06/10/11 */ function GetPageRank($q, $host = 'toolbarqueries.google.com', $context = NULL) { $seed = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer."; $result = 0x1020345; $len = strlen($q); for ($i = 0; $i < $len; $i++) { $result ^= ord($seed[$i % strlen($seed)]) ^ ord($q[$i]); $result = $result >> 23 & 0x1ff | $result << 9; } $ch = sprintf('8%x', $result); $url = 'http://%s/tbr?client=navclient-auto&ch=%s&features=Rank&q=info:%s'; $url = sprintf($url, $host, $ch, $q); @($pr = file_get_contents($url, false, $context)); return $pr ? substr(strrchr($pr, ':'), 1) : false; } //Example usage: if (isset($_GET['q'])) { echo GetPageRank($_GET['q']); } //eof
$dbID->Query("SET NAMES UTF8"); $res = $dbID->SelectSet("SELECT * from projects WHERE is_active = 1"); /* include external php scripts */ include_once "project_get_tic.php"; include_once "project_get_pr.php"; include_once "project_pages_in_google.php"; include_once "project_pages_in_yandex.php"; echo "<table width='100%' id='maintable'>"; echo "<tr>\r\n\t\t\t<th>id</th>\r\n\t\t\t<th>Проект</th>\r\n\t\t\t<th>Запросы (шт)</th>\r\n\t\t\t<th>Рост ↑ (шт)</th>\r\n\t\t\t<th>Падение ↓ (шт)</th>\r\n\t\t\t<th>ТИЦ</th>\r\n\t\t\t<th>PR</th>\r\n\t\t\t<th>индекс Yandex</th>\r\n\t\t\t<th>индекс Google (основной)</th>\r\n\t\t\t<th>индекс Google (supplemental)</th>\r\n\t\t\t<th>Статистика</th>\t\r\n\t\t\t<th>Редактировать</th>\r\n\t\t</tr>"; foreach ($res as $key => $value) { $keys = $dbID->SelectValue("SELECT phrase from keywords WHERE is_active = 1 AND project_id = {$value['id']}"); $keys = explode(";", $keys); $num_keys = sizeof($keys); $num_keys_up = 0; $num_keys_down = 0; echo "<tr>\r\n\t\t\t<td>" . $value["id"] . "</td>\r\n <td><a href='project_view.php?project_id=" . $value["id"] . "'>" . $value["name"] . "</a></td>\r\n\t\t\t<td>" . $num_keys . "</td>\r\n\t\t\t<td>" . $num_keys_up . "</td>\r\n\t\t\t<td>" . $num_keys_down . "</td>\r\n\t\t\t<td style='color: #BF390A;'>" . get_yandex($value["name"]) . "</td>\r\n\t\t\t<td style='color: #BF390A;'>" . GetPageRank($value["name"]) . "</td>\r\n\t\t\t<td style='color: #BF390A;'><div style='white-space: nowrap; width: 50px; overflow: hidden;'>" . YandexPagesXml($value["name"]) . "</div></td>\r\n\t\t\t<td style='color: #BF390A;'>" . GoogleIndex($value["name"]) . "</td>\r\n\t\t\t<td>-</td>\r\n\t\t\t<td><a href='project_edit.php?project_id=" . $value["id"] . "' style='text-align: center;'><img src='assets/images/view.png' width='20' height='20' alt='' /></a><a href='project_view.php?project_id=" . $value["id"] . "' style='float: left;'>смотреть</a><div class='clear: both;'></div></td>\r\n\t\t\t<td><a href='project_edit.php?project_id=" . $value["id"] . "' style='text-align: center;'><img src='assets/images/edit.png' width='20' height='20' alt='' /></a><a href='project_edit.php?project_id=" . $value["id"] . "' style='float: left;'>редактировать</a><div class='clear: both;'></div></td>\r\n\t\t</tr>"; } echo "</table>"; ?> <br /> <div style="border: 1px solid #009383; padding: 21px;"> <div style="height: 40px; line-height: 40px;"><a href="project_create.php"><img src="assets/images/add.png" width="20" height="20" alt="" style="padding-right: 20px;" /> добавить проект</a></div> <div style="height: 40px; line-height: 40px;"><a href="check_positions.php"><img src="assets/images/start.png" width="20" height="20" alt="" style="padding-right: 20px;" /> запустить пробивку</a> [по сегодняшней дате. запускается по cron ежедневно в 02:00]</div> </div> <?php function getContent($url, $agent = false) { $contentPage = '';