error_reporting(E_ALL);
ini_set('display_errors', '0');
//-----------------Switch back to Postgres-----------------//
include('pg_connect.php');
$autozaps=0;
$kookie='No cookie';
$admin=false;
$admin_version=$admin;
$showspam=$admin;
$debug=false;
$spamzaps=0;
$num_comments=0;
$sname="";
$favkw="";
$favcnt="";
$ADD='';
$comments='';
$sprivate='';
$dumpspam='';
$totez=1;
foreach ($_REQUEST as $key => $value){
$$key = $value;
if($debug)
echo $key . " " . $value . " ";
//exit;
}
//include('../incspamScum.php');
if($admin_version){
$pagename="O Club Admin";
}else{
$pagename="The O Club version 3.4";
}
$LogoSource = "http://rantburg.com/images2/WheelusWelcome.jpg";
$_ip='';
$ipnum = $_SERVER['REMOTE_ADDR'];
if($debug)
echo "$ipnum ";
//---------Dump annoying Club spam---------------------//
$ssql="select french_clubspam()";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$ssql="select spam_merchants()";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
echo "Spam killer run. ";
//---------Finish annoying French Club spam---------------------//
function spamtoiptables($x)
{
return;
$fn="spam" . $x . ".sh";
$F = "/opt/$fn";
$fh = fopen($F, 'w') or die("can't open file");
$stringData = "echo \"iptables -A INPUT -s $x -j LOG --log-prefix 'Club_spam: '\" > tmp\n";
fwrite($fh, $stringData);
$stringData = "echo \"iptables -A INPUT -s $x -j DROP\" >> tmp\n";
fwrite($fh, $stringData);
$stringData = "sh tmp\n";
fwrite($fh, $stringData);
$stringData = "cat tmp >> ipt\n";
fwrite($fh, $stringData);
$stringData = "rm tmp\n";
fwrite($fh, $stringData);
$stringData = "rm $F\n";
fwrite($fh, $stringData);
fclose($fh);
}
//-----------------------Handle the cookie to see who's posting------------------------*/
if ($sname == ''){
if ($_COOKIE["OCLUB"] != ''||$sname=='Visitor'){
$sname=$_COOKIE["OCLUB"];
}else if ($_COOKIE["rbname"] != ''){
$sname=$_COOKIE["rbname"];
}
}
if($sname==''){
$sname='Visitor';
}
$kookie=$sname;
//echo "totez=$totez ";
$ssql="select count(*) as t from tblbulletinboard where sname='$sname'";
//echo $ssql . " ";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$row=pg_fetch_object($result);
if($row)
$totez=$row->t;
//echo "totez=$totez ";
if($debug)
echo "User: $sname ";
/*-------------------------Check to see if it's an editor------------------------------*/
$ssql = "select count(*) as t from tbleditors where upper(cookie) = '" . strtoupper($sname) . "'";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$row=pg_fetch_object($result);
if($row->t != 0){
$A="YES";
$admin_version=true;
} else {
$A="NO";
}
/*
$ssql="select ncomments from bb_user where sname='$sname'";
$res=pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$r=pg_fetch_object($res);
if($r){
$num_comments=$r->ncomments;
}
*/
if($debug)
echo "Editor: $A ";
if($dumpspam != ''){
$ssql="update tblbulletinboard
set _deleted='t',_spam='t',updated='$kookie',comments='[Spam]' where id=$dumpspam";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
}
$ssql="delete from tblbulletinboard where _spam='t'";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
/*
function totAutozaps()
{
$a=0;
$d=date("m/d/Y") . ' 00:00';
$ssql="select count(*) as t from tblbulletinboard where dtstamp > '$d' and _spam='t'";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$row=pg_fetch_object($result);
return $row->t;
}
*/
$_deleted='f';
$_spam='f';
if($ADD != ''){
if($debug)
echo "Add is set... ";
//if($A != 'YES'){
//$morespam=0;
//if($debug)
//echo "Counter is $morespam ";
/*
if(spamScum($sname)){
$morespam++;
}
echo "Name reviewed for spam ";
if(spamScum($comments)){
$morespam++;
}
echo "Spam score is $morespam ";
if($morespam > 0){
$_deleted='t';
$_spam='t';
$comments='';
spamtoiptables($ipnum);
}
//}
*/
# badanov's section start
#$perl = new Perl();
#$perl->require("/var/www/o-club/cgi-bin/altclubspam.pl");
#badanov's section ends
//if($debug)
echo "Checking for Suckers ";
$sux=substr_count($comments,"http");
//$sscum=spamScum($comments);
//if($debug)
echo "sux value is $sscum ";
//if($num_comments > 7)
//$sscum=0;
if($comments != ""){
$ssql = "insert into tblbulletinboard (sprivate,dtstamp,sname,comments, ipv4, _deleted,_spam,updated)
VALUES ('$sprivate',current_timestamp,'$sname',
'" . str_replace("'","''",$comments) . "', '$ipnum','$_deleted','$_spam','$kookie')";
if($debug)
echo $ssql . " ";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$num_comments++;
if($num_comments > 0){
$ssql="update bb_user set ncomments=$num_comments";
$result = pg_query($ssql) or die ("Error in update: $ssql. " . pg_last_error());
}else{
$ssql="insert into bb_user (ncomments,sname) values ($num_comments,$sname)";
$result = pg_query($ssql) or die ("Error in insert: $ssql. " . pg_last_error());
}
$comments="";
$sprivate="NO";
if(!$debug){
pg_close($pg_connection);
header( "Location: ?sname=$sname" ) ;
}
}
if($debug)
echo "Insert complete. ";
}
if(isset($UPD)){
$ssql = "update tblbulletinboard set comments='" . str_replace("'","''",$comments) . "',sprivate='$sprivate',updated='$kookie' where id=$UPD";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$comments="";
$sprivate="NO";
if(!debug){
pg_close($pg_connection);
header( "Location: ?sname=$sname" ) ;
}
}
if(isset($E)){
$ssql="select id,comments,sprivate from tblbulletinboard where id=$E";
$result = pg_query($ssql) or die ("Error in query: $ssql. " . pg_last_error());
$row=pg_fetch_object($result);
$id=$row->id;
$comments=$row->comments;
$sprivate=$row->sprivate;
//setcookie('OCLUB',$sname,time() + 24 * 3600 * 365,'/');
}
//echo $sname . " ";
?>
$bgcolor="White";
if($totez <= 1){
$bgcolor="Yellow";
echo "The spam is strong on this one. ";
} ?>
//echo "Totez $totez "; ?>
/*
* Use Javascript to set the user's cookie.
* Used to use PHP, but the routine broke between versions...
*
*/ ?>