Kod için teşekkürler
<?php
/*
* R10 - YUNUSOZEN
*/
ob_start();
set_time_limit(0);
ini_set('max_execution_time', 0);
class wp_comment {
private static function basic_cURL($address) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $address);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$redirect_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return array("response" => $response, "http_status" => $http_status, "redirect" => $redirect_url);
}
public static function sendComment($postaddress, $variables = array()) {
$gir = self::basic_cURL($postaddress);
preg_match_all("@name=\"comment_post_ID\" value=\"(.*?)\"@si", $gir["response"], $post_id);
$post_id = isset($post_id[1][0]) ? $post_id[1][0] : "";
if(empty(trim($post_id))) {
preg_match_all("@name='comment_post_ID' value='(.*?)'@si", $gir["response"], $post_id);
$post_id = isset($post_id[1][0]) ? $post_id[1][0] : "";
}
preg_match_all("@name=\"akismet_comment_nonce\" value=\"(.*?)\"@si", $gir["response"], $akismet);
$akismet = isset($akismet[1][0]) ? $akismet[1][0] : "";
preg_match_all("@action=\"(.*?)\"@si", $gir["response"], $post_adress);
$postaddress_curl = 0;
if(isset($post_adress[1][0]) && strstr($post_adress[1][0], 'wp-comments-post.php')){
$postaddress_curl = $post_adress[1][0];
} elseif(isset($post_adress[1][1]) && strstr($post_adress[1][1], 'wp-comments-post.php')){
$postaddress_curl = $post_adress[1][1];
} elseif(isset($post_adress[1][2]) && strstr($post_adress[1][2], 'wp-comments-post.php')){
$postaddress_curl = $post_adress[1][2];
}
if(!$postaddress_curl) {
$msg = parse_url($postaddress)["host"]." adresinde wp-comments-post.php bulunamadı.";
return [
"status" => 0,
"comment_address" => htmlspecialchars($gir["redirect"]),
"message" => $msg
];
} else {
if(empty(trim($post_id))) {
$msg = parse_url($postaddress)["host"]." adresinde post_id bilgisi bulunamadı.";
return [
"status" => 0,
"comment_address" => htmlspecialchars($gir["redirect"]),
"message" => $msg
];
} else {
$postfields = [];
$postfields["comment"] = $variables["comment"];
$postfields["author"] = $variables["author"];
$postfields["email"] = $variables["email"];
$postfields["url"] = $variables["site_address"];
$postfields["comment_post_ID"] = $post_id;
$postfields["comment_parent"] = 0;
$postfields["wp-comment-cookies-consent"] = "yes";
if(!empty(trim($akismet))) {
$postfields["akismet_comment_nonce"] = $akismet;
$postfields["ak_hp_textarea"] = "";
$postfields["ak_js"] = time();
}
$ch = curl_init($postaddress_curl);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36");
curl_setopt($ch, CURLOPT_REFERER, $postaddress);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0);
$index = curl_exec($ch);
curl_close($ch);
if(strpos($index, "error-page") !== false) {
$msg = "Aynı yorum daha önce gönderilmiş veya site tarafından engellendiniz. Yorum gönderilemedi.";
return [
"status" => 0,
"comment_address" => htmlspecialchars($gir["redirect"]),
"message" => $msg
];
} else {
if(strpos($index, "comment-awaiting-moderation") !== false) {
$msg = "Yorum onay sürecine girmiş olabilir.";
return [
"status" => 1,
"comment_address" => htmlspecialchars($gir["redirect"]),
"message" => $msg
];
} else {
$msg = "Yorum başarıyla gönderildi.";
return [
"status" => 1,
"comment_address" => htmlspecialchars($gir["redirect"]),
"message" => $msg
];
}
}
}
}
}
}
$resultOutput = "";
if (isset($_POST['submit'])) {
// Formdan gelen veriler
$comments_input = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$author = isset($_POST['author']) ? trim($_POST['author']) : '';
$email = isset($_POST['email']) ? trim($_POST['email']) : '';
$site_address = isset($_POST['site_address']) ? trim($_POST['site_address']) : '';
$urls_input = isset($_POST['urls']) ? trim($_POST['urls']) : '';
if (empty($comments_input) || empty($author) || empty($email) || empty($site_address) || empty($urls_input)) {
$resultOutput .= "<p class='error'>Lütfen tüm alanları doldurun.</p>";
} else {
$commentsArray = explode("\n", $comments_input);
$commentsArray = array_filter(array_map('trim', $commentsArray));
if(empty($commentsArray)){
$resultOutput .= "<p class='error'>Yorum metninde geçerli yorum bulunamadı.</p>";
}
$urls = explode("\n", $urls_input);
$urls = array_filter(array_unique(array_map('trim', $urls)));
$totalTasks = count($urls);
$resultOutput .= "<h2>Toplam görev sayısı: {$totalTasks}</h2><hr>";
flush();
ob_flush();
$batchSize = 50;
$batches = array_chunk($urls, $batchSize);
$totalBatches = count($batches);
$batchIndex = 1;
$resultOutput .= "<h3>Gönderim Sonuçları</h3>";
foreach ($batches as $batch) {
$resultOutput .= "<div class='batch'>Batch {$batchIndex} / {$totalBatches} işlendi.</div>";
flush();
ob_flush();
foreach ($batch as $url) {
$randomComment = $commentsArray[array_rand($commentsArray)];
$commentData = array(
"comment" => $randomComment,
"author" => $author,
"email" => $email,
"site_address" => $site_address
);
$res = wp_comment::sendComment($url, $commentData);
$resultOutput .= "<div class='result-item'>" . htmlspecialchars($url) . " » " . $res['message'] . "</div>";
flush();
ob_flush();
}
$batchIndex++;
sleep(1);
}
}
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Yorum Gönder</title>
<style>
/* Google Fonts: Roboto */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: linear-gradient(135deg, #74ABE2, #5563DE);
font-family: 'Roboto', sans-serif;
color: #333;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 40px auto;
background: #fff;
padding: 30px 40px;
border-radius: 10px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
h1, h2, h3 {
text-align: center;
margin-bottom: 20px;
color: #5563DE;
}
/* Form layout: Üç sütun */
.form-container {
display: flex;
justify-content: space-between;
gap: 20px;
flex-wrap: wrap;
}
.form-column {
flex: 1;
min-width: 250px;
}
.form-column label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #444;
}
.form-column input[type="text"],
.form-column input[type="email"],
.form-column textarea {
width: 100%;
padding: 12px 15px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 16px;
transition: border-color 0.3s ease;
margin-bottom: 15px;
}
.form-column input[type="text"]:focus,
.form-column input[type="email"]:focus,
.form-column textarea:focus {
border-color: #5563DE;
outline: none;
}
textarea {
resize: vertical;
}
.submit-btn {
background: #5563DE;
color: #fff;
border: none;
padding: 12px 25px;
font-size: 18px;
border-radius: 5px;
cursor: pointer;
transition: background 0.3s ease;
display: block;
margin: 20px auto;
}
.submit-btn:hover {
background: #444bb8;
}
.result {
background: #f5f7fa;
border: 1px solid #ddd;
padding: 20px;
border-radius: 8px;
margin-top: 20px;
max-height: 400px;
overflow-y: auto;
}
.result-item {
padding: 8px;
border-bottom: 1px solid #eee;
}
.result-item:last-child {
border-bottom: none;
}
.batch {
margin-top: 15px;
font-weight: bold;
color: #28a745;
text-align: center;
margin-bottom: 10px;
}
.error {
color: #d9534f;
font-weight: bold;
text-align: center;
margin-bottom: 15px;
}
</style>
</head>
<body>
<div class="container">
<h1>Yorum Gönderici Arayüzü</h1>
<form method="post" action="">
<div class="form-container">
<div class="form-column">
<label for="comment">Yorum Metni (Her satıra bir yorum ekleyin):</label>
<textarea style="height: 218px;" id="comment" name="comment" placeholder="Yorum 1
Yorum 2
Yorum 3"><?php if(isset($_POST['comment'])) echo htmlspecialchars($_POST['comment']); ?></textarea>
</div>
<div class="form-column">
<label for="author">İsim:</label>
<input type="text" id="author" name="author" placeholder="Adınız" value="<?php if(isset($_POST['author'])) echo htmlspecialchars($_POST['author']); ?>">
<label for="email">E-posta:</label>
<input type="email" id="email" name="email" placeholder="E-posta adresiniz" value="<?php if(isset($_POST['email'])) echo htmlspecialchars($_POST['email']); ?>">
<label for="site_address">Gönderen Site URL:</label>
<input type="text" id="site_address" name="site_address" placeholder="https://www.orneksite.com" value="<?php if(isset($_POST['site_address'])) echo htmlspecialchars($_POST['site_address']); ?>">
</div>
<div class="form-column">
<label for="urls">Gönderilecek URL'ler (Her satıra bir URL):</label>
<textarea style="height: 218px;" id="urls" name="urls" placeholder="https://site1.com/yazi/
https://site2.com/post/"><?php if(isset($_POST['urls'])) echo htmlspecialchars($_POST['urls']); ?></textarea>
</div>
</div>
<input type="submit" name="submit" value="Gönder" class="submit-btn">
</form>
<?php if(!empty($resultOutput)): ?>
<div class="result">
<?php echo $resultOutput; ?>
</div>
<?php endif; ?>
</div>
</body>
</html>