Location: PHPKode > projects > Astanda Open Directory Project > adp-1.3b/admin/pages.php
<?php
//-------------------------------------------------//
//                                                 //
//        ASTANDA DIRECTORY PROJECT  [ADP]         //
//                  Version 1.3b                   //
//               License: SHAREWARE                //
//             http://www.astanda.com              //
//      © Copyright 2005, 2006, Pavel Golovko      //
//                                                 //
//-------------------------------------------------//
//                                                 //
// Any attempt to remove or alter "Powered by ADP" //
// recip link will automatically wave your rights  //
// to any use of ADP software!                     //
//                                                 //
// Reverse engineering and redistribution of       //
// ADP code or any part of its code is strictly    //
// prohibited!                                     //
//                                                 //
//-------------------------------------------------//
//                                                 //
// ADP is distributed in the hope that it will be  //
// useful, but WITHOUT ANY WARRANTY; without even  //
// the implied warranty of MERCHANTABILITY or      //
// FITNESS FOR A PARTICULAR PURPOSE.               //
//                                                 //
//-------------------------------------------------//

menu($adp); switch ($action) { case "main": if(!isset($id)){ $result = mysql_query("SELECT COUNT(`id`) FROM `pages`"); echo mysql_error(); if(mysql_num_rows($result)){ while($row = mysql_fetch_array($result)){ $NumberOfResults = $row['0']; } } $NumberOfPages=ceil($NumberOfResults/cfg("admin_limit")); $Nav = ""; $Nav_l = ""; if($page > 1) { $Nav .= "<A HREF=\"index.php?adp=pages&action=main&orderby=".$orderby."&how=".$how."&page=".($page-1)."\"><b><<</b></A>"; } for($i = 1 ; $i <= $NumberOfPages ; $i++){ if($page > 5){ $Nav_l = $page - 5; } $Nav_h = $page + 5; if($i == $page){ $Nav .= " <B>$i</B> "; } elseif(($i > $Nav_l) && ($i < $Nav_h)){ $Nav .= " <A HREF=\"index.php?adp=pages&action=main&orderby=".$orderby."&how=".$how."&page=".$i."\">$i</A> "; } } if($page < $NumberOfPages){ $Nav .= "<A HREF=\"index.php?adp=pages&action=main&orderby=".$orderby."&how=".$how."&page=".($page+1)."\"><b>>></b></A>"; } ?> <table width="100%" border=0><tr><td align="left"><font size="1"><?=$Nav?></font</td><td align="right"><font size=1><b>Order by:</b> Title (<a href="index.php?adp=pages&action=main&orderby=title&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=title&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | URL (<a href="index.php?adp=pages&action=main&orderby=url&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=url&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | Date (<a href="index.php?adp=pages&action=main&orderby=date&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=date&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | Google PR (<a href="index.php?adp=pages&action=main&orderby=gpr&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=gpr&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | Recip (<a href="index.php?adp=pages&action=main&orderby=recip&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=recip&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) </font></td></tr></table> <? $query = "SELECT * FROM `pages` ORDER BY `".$orderby."` $how LIMIT ".($page-1)*cfg("admin_limit").",".cfg("admin_limit").""; $result = mysql_query($query); echo mysql_error(); if(mysql_num_rows($result)){ ?> <table width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr><td><table width="100%" cellspacing="1" cellpadding="3" border="0"><tr bgcolor="#CCCCCC"><td></td> <td><font size="1">URL (<a href="index.php?adp=pages&action=main&orderby=url&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=url&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>)</font></td> <td><font size="1">Title (<a href="index.php?adp=pages&action=main&orderby=title&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=title&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>)</font></td> <td nowrap><font size="1">Date (<a href="index.php?adp=pages&action=main&orderby=date&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=date&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>)</font></td> <td><font size="1">PR</font></td> <td><font size="1">Rcp</font></td><td></td> </tr> <? while($row = mysql_fetch_array($result)){ ?> <tr bgcolor="#F4F4F4" onMouseOver="this.bgColor='#FFFFFF';" onMouseOut="this.bgColor='#F4F4F4';"> <? print "<td width=\"1%\"><a href=\"index.php?adp=pages&action=main&id=".$row['id']."\"><img border=0 src=\"images/edit.png\"</a></td>"; print "<td><font size=1 color=green>".$row['url']."</font></td>"; print "<td><font size=1><a target=\"_blank\" href=\"".$row['url']."\">".$row['title']."</a></font></td>"; print "<td nowrap><font size=1>".$row['date']."</font></td>"; print "<td><font size=1>".$row['gpr']."</font></td>"; if ($row['recip'] == "0"){ $recip_yn = "<font size=1 color=purple>No</font>"; } else { $recip_yn = "<font size=1 color=blue>Yes</font>"; } print "<td>".$recip_yn."</td>"; print "<td><a href=\"index.php?adp=pages&action=delete&id=".$row['id']."&url=".$row['url']."\"><img border=0 src=\"images/delete.png\"</a>"; ?> </td></tr> <? } ?> <tr bgcolor="#CCCCCC"><td></td> <td><font size="1">URL (<a href="index.php?adp=pages&action=main&orderby=url&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=url&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>)</font></td> <td><font size="1">Title (<a href="index.php?adp=pages&action=main&orderby=title&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=title&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>)</font></td> <td nowrap><font size="1">Date (<a href="index.php?adp=pages&action=main&orderby=date&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=date&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>)</font></td> <td><font size="1">PR</font></td> <td><font size="1">Rcp</font></td><td></td> </tr> </table></td></tr></table> <table width="100%" border=0><tr><td align="left"><font size="1"><?=$Nav?></font</td><td align="right"><font size=1><b>Order by:</b> Title (<a href="index.php?adp=pages&action=main&orderby=title&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=title&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | URL (<a href="index.php?adp=pages&action=main&orderby=url&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=url&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | Date (<a href="index.php?adp=pages&action=main&orderby=date&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=date&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | Google PR (<a href="index.php?adp=pages&action=main&orderby=gpr&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=gpr&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) | Recip (<a href="index.php?adp=pages&action=main&orderby=recip&how=ASC&page=<?=$page?>"><img border=0 src="images/asc.png"></a>/<a href="index.php?adp=pages&action=main&orderby=recip&how=DESC&page=<?=$page?>"><img border=0 src="images/desc.png"></a>) </font></td></tr></table> <? } } else { $query = "SELECT * FROM `pages` WHERE `id` = ".$id." LIMIT 1"; $result = mysql_query($query); echo mysql_error(); if (mysql_num_rows($result) <> '') { while ($row = mysql_fetch_array($result)) { ?> <form action="index.php" method="POST"><input type="hidden" name="adp" value="pages"><input type="hidden" name="action" value="update"> <input type="hidden" name="id" value="<?=$id?>"> URL:<br><input type="text" name="url" value="<?=$row['url']?>" size="80"><p> Title:<br><input type="text" name="title" value="<?=$row['title']?>" size="80"><p> Text content:<br><textarea rows="5" name="description" cols="60"><?=$row['description']?></textarea><p> <input type="submit" value="Save Page!"></form> <? } } } break; case "date": ?>This is where you can see how many pages where indexed and when. Click the date to reindex all pages that were indexed at that specific date.<hr> <table border="1" cellspacing="0" cellpadding="3"><tr><th><font size="2">Date</th><th><font size="2">Links</th><th><font size="2">Pages</th><th><font size="2">Size (bytes)</th></tr><? $result = mysql_query("SELECT `date`, COUNT(`date`), SUM(`size`) FROM `pages` GROUP BY `date`"); echo mysql_error(); if(mysql_num_rows($result)){ $pages_total = 0; $size_total = 0; $links_total = 0; while($row = mysql_fetch_array($result)){ $links_num = 0; $result1 = mysql_query("SELECT `link_id`, COUNT(`link_id`) FROM `pages` WHERE `date` = '".$row[0]."' GROUP BY `link_id`"); echo mysql_error(); if(mysql_num_rows($result1)){ while($row1 = mysql_fetch_array($result1)){ $links_num++; $links_total++; } } if($row[0] <> date("Y-m-d")){ $spider_today = "<a target=\"_blank\" href=\"spider.php?date=".$row[0]."\">".$row[0]."</a>"; } else{ $spider_today = $row[0]; } print "<tr><td><font size=\"2\">".$spider_today."</td><td><font size=\"2\">".$links_num."</td><td><font size=\"2\">".$row[1]."</td><td><font size=\"2\">".$row[2]."</td></tr>"; $pages_total = $pages_total + $row[1]; $size_total = $size_total + $row[2]; } print "<tr><th><font size=\"2\">Total:</td><th><font size=\"2\">$links_total</td><th><font size=\"2\">$pages_total</td><th><font size=\"2\">$size_total</td></tr></table>"; ?><hr>If the total ammount of links crawled is less than the total ammount of links in your directory, then some of the links in your directory were not crawled. This could be due to misconfiguration, fault connection to the web sites while crawling, web sites being offline when ADP tried to connect to them, or could be that you simply didnt index all your links.<p> Size (bytes) is <b>not</b> the ammount of space used in your MySQL database. (see admin main page if you need that value). This is the size of pages at the remote location. This is also the ammount of bytes your spider fetches from remote servers while indexing pages. If in <a href="index.php?adp=config&action=spider">Config/Spider</a> you select the maximum value for <b>Title max chars</b>, <b>Description and pages content max chars</b>, and "Yes" next to <b>Display pages content while crawling</b>, then this will also be the ammount of bytes your server will send to your web browser. Thus wasting huge ammount of your bandwidth.<p> Todays indexes are not available for reindexing, because the spider will fall into an endless loop recrawling the same pages over and over.<p><? } break; case "reindex": ?> Reindex all pages<P> This will take some time and server resources. Are you sure you want to reindex all links in your directory?<P> <a target="_blank" href="spider.php?full=1">Reindex all!</a><p> <? break; case "update": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { $today = date("Y-m-d"); mysql_query("UPDATE `pages` SET `url` = '".$_REQUEST['url']."', `title` = '".$_REQUEST['title']."', `description` = '".$_REQUEST['description']."' WHERE `id` = '$id' LIMIT 1"); echo mysql_error(); ?> Updating ...<br> <?=$id?><br> <?=$_REQUEST['url']?><br> <?=$_REQUEST['title']?><br> <?=$_REQUEST['description']?><br> <?=$today?><br> <? } break; case "delete": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { mysql_query("DELETE FROM `pages` WHERE `id` = '$id'"); echo mysql_error(); ?> Deleted ...<br> <?=$url?><p> <? } break; case "recip": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { $result = mysql_query("SELECT COUNT(`id`) FROM `pages`"); echo mysql_error(); if(mysql_num_rows($result)){ while($row = mysql_fetch_array($result)){ $total_num = $row[0]; } } $result = mysql_query("SELECT `id`, `url`, `recip` FROM `pages` ORDER BY `recip` DESC LIMIT ".$num.", ".cfg("admin_limit").""); echo mysql_error(); while($row=mysql_fetch_array($result)){ print $row['url']; $res = eregi(cfg("recip_regex"),fetchURL($row['url']))?1:0; if($res == 1){ print " <font color=green><b>YES</b></font><p>\n"; } else{ print " <font color=red>NO</font><p>\n"; } mysql_query("UPDATE `pages` SET `recip` = '".$res."' WHERE `id` = '".$row['id']."'"); } $next = $num + cfg("admin_limit"); if($total_num > $next){ print "<P><center><a href=\"index.php?adp=pages&action=recip&num=".$next."\">Next >>></a></center>"; print "<meta http-equiv=\"refresh\" content=\"1;url=index.php?adp=pages&action=recip&num=".$next."\">"; } else{ print "<hr><b>Finished!</b><p>"; } } break; case "gpr": if($demo == "1"){ print "DISABLED IN DEMO MODE"; } else { include('pagerank.php'); $result = mysql_query("SELECT COUNT(`id`) FROM `pages`"); echo mysql_error(); if(mysql_num_rows($result)){ while($row = mysql_fetch_array($result)){ $total_num = $row[0]; } } $result = mysql_query("SELECT `id`, `url`, `gpr` FROM `pages` ORDER BY `gpr` LIMIT ".$num.", ".cfg("admin_limit").""); echo mysql_error(); while($row=mysql_fetch_array($result)){ $oPR=new ADPPageRank(); $gpr = $oPR->getRank($row['url']); if($gpr == "-1"){ $gpr = "0"; } print "<font color=green>PR: <b>".$gpr."</b></font> ".$row['url']."<br>\n"; mysql_query("UPDATE `pages` SET `gpr` = ".$gpr." WHERE `id` = ".$row['id'].""); } $next = $num + cfg("admin_limit"); if($total_num > $next){ print "<P><center><a href=\"index.php?adp=pages&action=gpr&num=".$next."\">Next >>></a></center>"; print "<meta http-equiv=\"refresh\" content=\"1;url=index.php?adp=pages&action=gpr&num=".$next."\">"; } else{ print "<hr><b>Finished!</b><p>"; } } break; }
?>
Return current item: Astanda Open Directory Project