steven |
05-15-2001 01:04 AM |
This is one awesome hack, the only problem that I am having is that the spider is accessing forums that I have specified it not to. Is there a quick fix for this?
Below is my index.php file
Code:
<?
/*
vbSpiderFriend v0.1a by ~shabang~
** Free License: YOU MUST LEAVE THE FOOTER INTACT **
*/
$privateForums="|4|5||6||7||8||9||33|"; // Hidden forumids, enclosed by | pipes
$firstPost="07/04/2000"; // MM/DD/YYYY of your forum's first post
$spacer=" "; // The characters or spaces to use as one indent
$forumURL="/v2"; // Base URL of your forum
$homeURL="http://www.baddealings.com"; // The link URL for the top of the page
$homeLink="Baddealings.com - Online Source For Consumer Complaints"; // The link text for the top of the page
$keywords="complaints, complain, consumer complaints, consumer, fraud, scams, consumer fraud, grievances, auctions, electronics, feedback, shopping, buyers/sellers, forums, community, ripped off, chat"; // SET META INFORMATION HERE
$description="Baddealings.com provides an arena for members to complain about a product or service. Search our online database for the lastest information on consumer complaints and scams."; // The script will add to these fields
$pagetitle="Baddealings.com - Online Source For Consumer Complaints"; // with the info from the thread
include("class.mysql.php");
// NOTHING MORE TO EDIT BELOW /////////////////////////////////////////////////////////////
$baseURL=$forumURL."/archive";
$dateSplit = split("/",$firstPost);
$firstMonth = preg_replace("/^0/","",$dateSplit[0]);
$firstYear = $dateSplit[2];
$currentYear=date("Y",time());
$currentMonth=preg_replace("/^0/","",date("m",time()));
// setup the DB connection
$db = new MySQL;
if (!$db->init()) {
echo "no DB connection<br>";
exit;
}
// parse query string
if (ereg("/archive/[0-9]",getenv('REQUEST_URI'))) {
$urlArray=explode("/",getenv('REQUEST_URI')); //split the URL path
$a=0;
while($urlArray[$a] != "archive") {
$a++;
}
$forumID=$urlArray[($a+1)];
$year=$urlArray[($a+2)];
$month=$urlArray[($a+3)];
$week=$urlArray[($a+4)];
$threadID=$urlArray[($a+5)];
if (eregi("[a-z]",$forumID) or $forumID < 1 or strstr($privateForums,"|".$forumID."|"))
$forumID=1;
}
header("Status: 200 OK");
//echo "<br> <br>$forumID - $year - $month - $week - $threadID";
if (empty($forumID)) {
htmlHeader();
forumList();
exit;
} else if (empty($year) or empty($month)) {
htmlHeader();
weekList();
} else if (empty($threadID)) {
htmlHeader();
threadList();
} else {
showThread();
}
echo "<center><font size=1><br> <br>vbSpiderFriend by ~shabang~ of <a href=\"http://www.overgrow.com/\">Overgrow</a></font></center></body></html>";
function showThread() {
global $db,$baseURL,$forumID,$threadID,$homeURL,$homeLink,$forumURL,$keywords,$description,$pagetitle;
$query = "SELECT thread.title as ttitle,forum.title as ftitle FROM thread LEFT JOIN forum ON thread.forumid=forum.forumid WHERE thread.threadid='$threadID'";
$data = $db->select($query);
if(!empty($data)) {
while ( list ( $key,$forum ) = each ($data)) {
$forumline = "Forum: <a href=\"$forumURL/forumdisplay.php?forumid=$forumID\">$forum[ftitle]</a><br>";
$threadline = "Thread: <a href=\"$forumURL/showthread.php?threadid=$threadID\"><b>$forum[ttitle]</a></b><br>";
$threadtitle = $forum[ttitle];
}
} else {
echo $query;
}
$ks = str_replace(" ",",",$threadtitle);
$keywords.=",$ks";
$description.=": $threadtitle";
$pagetitle.=" : $threadtitle";
htmlHeader();
echo "<center><a href=\"$homeURL\"><b>$homeLink</b></a><br> </center><br>";
echo spacer(1).$forumline;
echo spacer(2).$threadline;
$data=$db->select("SELECT post.dateline as dateline,post.postid as postid,post.pagetext as pagetext,post.username as fakename,
post.title as title,post.userid as userid, user.userid as userid,user.username as username,
user.usertitle as usertitle,user.posts as posts
FROM post
LEFT JOIN user ON (user.userid = post.userid)
WHERE post.threadid=$threadID AND visible=1
ORDER BY dateline");
if(!empty($data)) {
echo "<table border=0 cellpadding=10>";
while ( list ( $key,$posts ) = each ($data)) {
$username=$posts[username];
if(empty($username))
$username=$posts[fakename];
echo "<tr><td valign=top>$username</td><td>".nl2br($posts[pagetext])."</td></tr>";
}
echo "</table>";
}
}
function threadList(){
global $db,$baseURL,$forumID,$year,$month,$week;
echo "<a href=\"$baseURL/index.php\">Archives</a><br>";
$query = "SELECT title FROM forum WHERE forumid='$forumID'";
$data = $db->select($query);
if(!empty($data)) {
while ( list ( $key,$forum ) = each ($data)) {
echo spacer(1)."<a href=\"$baseURL/$forumID\">$forum[title]</a><br>";
}
}
switch($week) {
case("1"):
$fw = "01";
$lw = "07";
break;
case("2"):
$fw = "08";
$lw = "14";
break;
case("3"):
$fw = "15";
$lw = "21";
break;
case("4"):
$fw = "22";
$lw = "31";
break;
default:
$fw = "01";
$lw = "07";
}
$date1 = "$month/$fw/$year";
$date2 = "$month/$lw/$year";
$ts1 = strtotime("$date1");
$ts2 = strtotime("$date2");
echo spacer(2)."Dates: $date1 to $date2<br> <br>";
$query = "SELECT title,threadid,lastpost FROM thread WHERE lastpost > '$ts1' AND lastpost < '$ts2' AND forumid='$forumID' ORDER BY dateline ASC";
$data = $db->select($query);
if(!empty($data)) {
while ( list ( $key,$thread ) = each ($data)) {
echo spacer(3)."<a href=\"$baseURL/$forumID/$year/$month/$week/$thread[threadid]\">$thread[title]</a><br>";
//echo spacer(3)."<a href=\"http://www.overgrow.com/edge/showthread.php?threadid=$thread[threadid]\">$thread[title]</a><br>";
}
} else {
echo spacer(3)."No posts, please <a href=\"".getenv(HTTP_REFERER)."\">go back</a>.";
}
}
function spacer($n) {
global $spacer;
while($n!=0){
$return.=$spacer;
$n--;
}
return $return;
}
function removeZero($n) {
preg_replace ("/./","",$n);
return $n;
}
function weekList() {
global $db,$baseURL,$forumID,$firstYear,$currentYear,$currentMonth,$firstMonth;
$months = array("blank","January","February","March","April","May","June","July","August","September","October","November","December");
echo "<a href=\"$baseURL/index.php\">Archives</a><br>";
$query = "SELECT title FROM forum WHERE forumid='$forumID'";
$data = $db->select($query);
if(!empty($data)) {
while ( list ( $key,$forum ) = each ($data)) {
echo spacer(1)."$forum[title]<br>";
}
}
for($y=$firstYear;$y<=$currentYear;$y++) {
echo spacer(2)."$y<br> <br>";
if($y==$firstYear)
$fm=$firstMonth;
else
$fm=1;
if($y==$currentYear)
$lm=($currentMonth + 1);
else
$lm=13;
for($m=$fm;$m<$lm;$m++){
echo spacer(3).$months[$m]."<br>";
for($w=1;$w<5;$w++) {
if (strlen($m) < 2)
$mo="0".$m;
else
$mo=$m;
echo spacer(4)."<a href=\"$baseURL/$forumID/$y/$mo/$w\">week $w</a><br>";
}
echo " <br>";
}
}
}
function forumList() {
global $db,$baseURL,$privateForums;
echo "Archives<br>";
$privateForums=preg_replace("/^\|/","",$privateForums);
$privateForums=preg_replace("/\|$/","",$privateForums);
$pfs = explode("|",$privateForums);
$whereclause="";
$wherecounter=0;
while($pf=array_shift($pfs)) {
if(ereg("[0-9]",$pf)) {
if($wherecounter==0) {
$whereclause= " WHERE forumid!='$pf'";
$wherecounter++;
} else {
$whereclause .= " AND forumid!='$pf'";
}
}
}
$query = "SELECT title,forumid FROM forum$whereclause ORDER BY forumid ASC";
$data = $db->select($query);
if(!empty($data)) {
while ( list ( $key,$forum ) = each ($data)) {
echo spacer(1)."<a href=\"$baseURL/$forum[forumid]\">$forum[title]</a><br>";
}
}
}
function htmlHeader() {
global $keywords,$description,$pagetitle;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> <?=$pagetitle?> </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="<?=$keywords?>">
<META NAME="Description" CONTENT="<?=$description?>">
<style type="text/css">
BODY {font: 10pt verdana,arial,sans-serif;}
TD {font: 10pt verdana,arial,sans-serif;}
</style>
</HEAD>
<BODY bgcolor="#ffffff">
<?
}
?>
Thanks Steven
|