Hi,
I tried a auto-comment bot for wordpress(in my website) and coded it. My plan is that I write names in names.txt file and sample comments in comments.txt file(a name or comment per line) and it will add a random comment with a random name into Wordpress's database in wp_comments table. I also planned to increase comment_count value in wp_posts table, however my code is not working. Here is the code:
<?php
include "wp-config.php";
$asama1=@mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("<h1>Something was wrong.</h1>");
$asama2=@mysql_select_db(DB_NAME,$asama1) or die("<h1>Database could not be found.</h1>");
$isim=file(names.txt);
$yorum=file(comments.txt);
$id="1";
$idarray=explode(",",$id);
$kactaneidvar=count($idarray);
$kactaneidvar--;
$rastgeleidal=rand(0,$kactaneidvar);
$id=$idarray[$rastgeleidal];
$x=$_GET["kactane"];
$kactane=(integer) $x;
$sayilari=count($isim);
$sayilari2=count($yorum);
$sayilari--;
$sayilari2--;
$rastisim=rand(0,$sayilari);
$rastyorum=rand(0,$sayilari2);
$yorumsayi=1;
while($yorumsayi<=$kactane){
// ------------------- random names and comments adding to db is starting.------------
$ekleisim=$isim[$rastisim];
$ekleyorum=$yorum[$rastyorum];
$yorumla=@mysql_query("INSERT INTO wp_comments(comment_post_ID,comment_author,comment_content,comment_approved,comment_parent,user_id) VALUES($id,$ekleisim,$ekleyorum,'1','0','0')");
$yorumsayal=@mysql_query("SELECT comment_count FROM wp_posts WHERE id=$id");
$yorumsayal++;
$sayiart=@mysql_query("INSERT INTO wp_posts(comment_count) VALUES($yorumsayal)");
if($yorumla){
echo $yorumsayi.". yorum eklendi.</br>";
$yorumsayi++;
}
}
// -------------------end of random names and comments adding to db.--------------
?>