pimpinjg said:nice post i guess
haha yeah, its not good compared to you bot is it? haha
pimpinjg said:nice post i guess
MySQL said: Documentation
#1054 - Unknown column 'taglist' in 'thread'
Dman said:@GgAcE This bot is not for users who are on free hosting / crappy shared hosting
bawel said:I just DO NOT understand about this ?
Code:ALTER TABLE `vb_thread` ADD `time_check` INT( 10 ) NOT NULL DEFAULT '0' AFTER `taglist` ; ALTER TABLE `vb_thread` ADD `ignore_check` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `time_check` ;
How to edit/create that?
bawel said:I just DO NOT understand about this ?
Code:ALTER TABLE `vb_thread` ADD `time_check` INT( 10 ) NOT NULL DEFAULT '0' AFTER `taglist` ; ALTER TABLE `vb_thread` ADD `ignore_check` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `time_check` ;
How to edit/create that?
Balegar said:working fine, but its moved thread with many valid post. Its possible to make addon to only report post?
Warning: fopen(botruns.txt) [function.fopen]: failed to open stream: Permission denied in /home/albworg/public_html/vbbot.php on line 25
Warning: fclose(): supplied argument is not a valid stream resource in /home/albworg/public_html/vbbot.php on line 26
Using Method where time_check is 0
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292288 bytes) in /home/albworg/public_html/vbbot.php on line 76
<?php
/*
____ __ __ ______ __ __
/\ __-. /\ "-./ \ /\ __ \ /\ "-.\ \
\ \ \/\ \ \ \ \-./\ \ \ \ __ \ \ \ \-. \
\ \____- \ \_\ \ \_\ \ \_\ \_\ \ \_\\"\_\
\/____/ \/_/ \/_/ \/_/\/_/ \/_/ \/_/ presents the VB LINK CHECKER BOT!
Forums to check syntax
`forumid` = 2 OR `forumid` = 3 - This will check both forum id 2 and 3
`forumid` != 2 OR `forumid` != 3 - This will all forums EXCEPT forum id 2 and 3
*/
$filename = "botruns.txt";
if(isset($_REQUEST['deletefile']))
{
unlink($filename);
exit('File Deleted');
}
elseif(file_exists($filename))
{
exit('Bot is running.');
}
else
{
$fh = fopen($filename , 'w');
fclose($fh);
}
require_once "includes/config.php"; //assumes this is in vb folder
set_time_limit(0);
// Start of user defined variables
$trash = '29'; //Forum id of trash
$botid = '9'; //Userid of bot
$botname = 'Link Bot'; //Username of bot
$check = '`forumid` != 12'; //Forums to check
$pa = '
Links checked on ' . date('d/m/y'). ' by link checker bot'; //This will append this at the end of the checked post
$ppa = '<br /> Links checked on ' . date('d/m/y'). ' by link checker bot'; //VB uses a caching technique, this will append it to end of parsed post. This is HTML!
$perd = '50'; //Percent decision variable.
$tr = "More than $perd percent on the links are dead that is why the topic is moved to trash"; // This is the reply in the topic.
$pmt = 'I have moved your topic to trash'; // PM Title
$reportforumid = '11'; //This is where bot will make new topics stating reports
$showurl = 'http://put your website here/showthread.php?t='; //Your URL
//Check Line 226 to edit PM message.
//End of user defined variables. Don't edit below this line. No really don't.
$y= 0;
$count = 0;
$sleep = 0;
$topic = 0;
$prefix = $config['Database']['tableprefix'];
function check($link , $y , $regex,$pattern='', $replace='')
{
global $y;
if(!empty($pattern))
{
$link = preg_replace($pattern, $replace, $link);
}
if(eregi("megashares.com" , $link))
{
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIE, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "1");
curl_setopt($ch, CURLOPT_COOKIEFILE, "1");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch);
curl_close($ch);
}
else
{
$page = file_get_contents($link);
}
if(eregi($regex , $page))
{
$y++;
flush();
ob_flush();
echo " Active : $link<br />";
}
elseif(!eregi($regex , $page))
{
$y = $y + 0;
flush();
ob_flush();
echo "Dead : $link<br />";
}
else
{
exit('Some error');
}
unset($page);
}
$sites = array(
array("rapidshare\.com\/files\/", "(FILE DOWNLOAD|This file is larger than 200 Megabyte)"),
array("megashares\.com\/\?d01=", "(Click here to download|This link's filesize is larger than what you have left on your Passport)"),
array("megaupload\.com/([a-z]{2}\/)?\?d=", "(Filename|(All download slots assigned to your country)"),
array("rapidshare\.de\/files\/", "You want to download"),
array("filefactory\.com\/file\/", "(download link)|(Please try again later)"),
array("mediafire\.com\/(download\.php)?\?", "You requested"),
array("depositfiles\.com\/([a-z]{2}\/)?files\/", "File Name", "@(com\/files\/)|(com\/[a-z]{2}\/files\/)@i", "com/en/files/"),
array("sendspace\.com\/file\/", "The download link is located below.")
);
$connect = mysql_connect($config['MasterServer']['servername'], $config['MasterServer']['username'] , $config['MasterServer']['password']) or die('Unable to connect to mysql server.');
$dbconnect = mysql_select_db($config['Database']['dbname'], $connect) or die('Unable to connect to the db');
if(isset($_REQUEST['checki']))
{
$qu1= mysql_query("SELECT `threadid` , `firstpostid`, `forumid`, `replycount`, `title` FROM `".$prefix."thread` WHERE `ignore_check` = '1' AND ($check)");
echo 'Checking ignored topics<br />';
}
else
{
$qu1 = mysql_query("SELECT `threadid` ,`firstpostid`, `forumid`, `replycount`, `title` FROM `".$prefix."thread` WHERE `time_check` = '0' AND `ignore_check` = '0' AND ($check)");
$row = mysql_num_rows($qu1);
if($row == 0 )
{
$qu1 = mysql_query("SELECT `threadid` ,`firstpostid`, `forumid`, `replycount`, `title` FROM `".$prefix."thread` WHERE ".time()." - `time_check` >= 86400 AND `ignore_check` = '0' AND ($check)");
$row1 = mysql_num_rows($qu1);
if($row1 == 0 )
{
$qu1 = mysql_query("SELECT `threadid` ,`firstpostid`, `forumid`, `replycount`, `title` FROM `".$prefix."thread` WHERE `ignore_check` = '0' AND ($check)");
echo "Using Method where it seems that all topics have been checked.<br />";
}
else
{
echo "Using Method where 1 day has passed after checking all links.<br />";
}
}
else
{
echo "Using Method where time_check is 0<br />";
}
}
while($re1 = mysql_fetch_assoc($qu1))
{
if(($sleep == 100) || ($topic == 50))
{
if($sleep == 100)
{
$sleep = 0;
}
if($topic == 50)
{
$topic = 0;
}
echo 'Now script will pause for 15 seconds';
sleep(15);
}
$pid = $re1['firstpostid'];
$tid = $re1['threadid'];
$forum = $re1['forumid'];
$replies = $re1['replycount'];
$title = $re1['title'];
$qu2 = mysql_query("SELECT `pagetext`, `userid` , `username` FROM `".$prefix."post` WHERE `postid` = '$pid'");
$re2 = mysql_fetch_assoc($qu2);
$alllinks = $re2['pagetext'];
$uid = $re2['userid'];
$uname = $re2['username'];
$topic++;
$post = $alllinks;
$alllinks = explode(" ", $alllinks);
$alllinks = implode("\n", $alllinks);
$alllinks = explode("\n", $alllinks);
foreach($alllinks as $link)
{
if(eregi("(http|www)" , $link))
{
//Yeah now wen gotta remove the trash from links to get them.
$link = preg_replace("/\[\/(.+)\]/" , "" , $link);
$link = preg_replace("/(\(.+)/" , "" , $link);
$link = preg_replace("/(.*)http:\/\//" , "" , $link);
$link = 'http://' . $link;
foreach($sites as $site)
{
if(eregi($site[0], $link))
{
check(trim($link), $y, $site[1],$site[2],$site[3]);
$count++;
$sleep++;
}
}
}
}
unset($alllinks);
unset($link);
$realurl = $showurl . $tid;
if($count == $y && $count != 0 )
{
$post = preg_replace("/Links checked on(.*)by link checker bot/" , "" , $post); //Replace if it is already checked by LC bot
$post = mysql_real_escape_string($post . $pa); //Append the statement to the post
$qu3 = mysql_query("UPDATE `".$prefix."post` SET `pagetext` = '$post' WHERE `postid` = '$pid'");
$qu4 = mysql_query("SELECT `pagetext_html` FROM `".$prefix."postparsed` WHERE `postid` = '$pid'");
$nqu4 = mysql_num_rows($qu4);
if($nqu4 > 0)
{
$re4 = mysql_fetch_assoc($qu4);
$postparsed = $re4['pagetext_html'];
$postparsed = preg_replace("/<br \/> Links checked on (.*) by link checker bot/" , "" , $postparsed);
$postparsed = mysql_real_escape_string($postparsed . $ppa);
$qu5 = mysql_query("UPDATE `".$prefix."postparsed` SET `pagetext_html` = '$postparsed' WHERE `postid` = '$pid'");
}
$qu6 = mysql_query("UPDATE `".$prefix."thread` SET `time_check` = ".time().", `ignore_check` = '0' WHERE `threadid` = '$tid'");
flush();
ob_flush();
echo "<a href=$realurl>Checked Topic ID : $tid</a><br />";
}
elseif($count > $y && $count != 0)
{
$per = (($count - $y) * 100)/$count;
if($per < $perd)
{
$uniq = md5(uniqid(rand() . time()));
$qu4 = mysql_query("INSERT INTO `".$prefix."thread` (`title`, `forumid`, `open`, `postusername`, `postuserid`, `dateline`, `notes`, `visible`, `lastpost`, `lastposter`) VALUES ('Post Reported by Bot' , '$reportforumid' , '1' , '$botname' , '$botid' , ".time().", '$uniq' , '1', ".time().", '$botname')");
$qu5 = mysql_query("SELECT `threadid` FROM `".$prefix."thread` WHERE `notes` = '$uniq'");
$re5 = mysql_fetch_assoc($qu5);
$rtid = $re5['threadid'];
$newmessage = "This thread has some dead links and some alive links [url='$realurl']".$realurl.'';
$newmessage = mysql_real_escape_string($newmessage);
$qu6 = mysql_query("INSERT INTO `".$prefix."post` (`threadid`, `username`, `userid`, `dateline`, `pagetext`) VALUES('$rtid' , '$botname', '$botid', ".time().", '$newmessage')");
$qu7 = mysql_query("SELECT `postid` FROM `".$prefix."post` WHERE `threadid` = '$rtid'");
$re7 = mysql_fetch_assoc($qu7);
$npid = $re7['postid'];
$qu8 = mysql_query("UPDATE `".$prefix."thread` SET `time_check` = ".time()." WHERE `threadid` = '$tid'");
$qu9 = mysql_query("UPDATE `".$prefix."thread` SET `firstpostid` = '$npid', `lastpostid` = ".$re7['postid']." WHERE `threadid` = '$rtid'");
$qu10 = mysql_query("UPDATE `".$prefix."forum` SET `threadcount` = `threadcount` + 1, `replycount` = `replycount` + 1 , `lastpost` = ".time()." ,`lastposter` = '$botname', `lastthread` = 'Post Reported By Bot' WHERE `forumid` = '$reportforumid'");
flush();
ob_flush();
echo "<a href=$realurl>Post Reported : $tid</a><br />";
}
if($per >= $perd)
{
$pms = "Hey,I'm the LC Bot. \n Your topic has been moved to trash since the links in it were dead. \n Please check it out.If u suppose the I am wrong, don't PM me, but PM any of the staff members of the site \n";
$pms .= "$realurl" . '';
$pma = "a:1:{s:2:\"cc\";a:1:{i:$uid;s:4:\"$uname\";}}";
$pms = mysql_real_escape_string($pms);
$pma = mysql_real_escape_string($pma);
//Move the topic
$qu4 = mysql_query("UPDATE `".$prefix."thread` SET `forumid` = '$trash' WHERE `threadid` = '$tid'");
//Pm user
$qu6 = mysql_query("INSERT INTO `".$prefix."pmtext` (`fromuserid`, `fromusername` , `title` , `message` , `dateline` , `touserarray`) VALUES ('$botid' , '$botname' , '$pmt' , '$pms', ".time()." , '$pma')");
$qu7 = mysql_query("SELECT `pmtextid` FROM `".$prefix."pmtext` WHERE `message` = '$pms'");
$re7 = mysql_fetch_assoc($qu7);
$pmtextid = $re7['pmtextid'];
$qu8 = mysql_query("INSERT INTO `".$prefix."pm` (`pmtextid`, `userid`, `folderid`, `messageread`) VALUES ('$pmtextid' , '$uid' , '0' , '0')");
$qu9 = mysql_query("UPDATE `".$prefix."user` SET `pmtotal` = `pmtotal` + 1 , `pmunread` = `pmunread` + 1 WHERE `userid` = '$uid'");
//Reply to the topic
$qu9 = mysql_query("INSERT INTO `".$prefix."post` (`threadid` , `parentid` , `username` , `userid` , `dateline` , `pagetext`, `ipaddress` , `visible`) VALUES ('$tid' , '$tid' , '$botname' , '$botid' , ".time()." , '$tr' , '127.0.0.1' , '1')");
$qu10 = mysql_query("UPDATE `".$prefix."thread` SET `replycount` = `replycount` + 1, `lastposter` = '$botname', `lastpost` = ".time()." WHERE `threadid` = '$tid'");
$qu11 = mysql_query("UPDATE `".$prefix."forum` SET `threadcount` = `threadcount` + 1, `replycount` = `replycount` + 1 , `lastpost` = ".time()." ,`lastposter` = '$botname', `lastthread` = '$title' WHERE `forumid` = '$trash'");
$qu12 = mysql_query("UPDATE `".$prefix."user` SET `posts` = `posts` + 1, `lastpost` = ".time()." WHERE `userid` = '$botid'");
$qu13 = mysql_query("UPDATE `".$prefix."forum` SET `replycount` = `replycount` - $replies, `threadcount` = `threadcount` - 1 WHERE `forumid` = '$forum'");
flush();
ob_flush();
echo "<a href=$realurl>Moved to Trash Id : $tid</a><br />";
}
}
elseif($count == 0)
{
//If there are no matching links just add to ignore list.
$qu5 = mysql_query("UPDATE `".$prefix."thread` SET `ignore_check` = '1' WHERE `threadid` = '$tid'");
flush();
ob_flush();
echo "<a href=$realurl>No Relevant Links Found : $tid</a><br />";
}
unset($count);
unset($y);
}
unlink($filename);
//ALTER TABLE `vb_thread` ADD `time_check` INT( 10 ) NOT NULL DEFAULT '0' AFTER `taglist` ;
//ALTER TABLE `vb_thread` ADD `ignore_check` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `time_check` ;
?>