wolvox kayıtları
Gönderilme zamanı: Sal Ara 09, 2025 6:50 am
wolvox kayıtları için oluşturuldu
learning
https://mrt.muratca61.keenetic.link/phpbb/
https://mrt.muratca61.keenetic.link/phpbb/viewtopic.php?t=120
Kod:Tümünü seç
bana bir script yap , aşağıdaki örnek log.php yi örnek alarak kayıt yapacak. kayıt için yine aynı veritabanında "wolvox" veritabanı adı ve "musteri_kayitlari" tablosunun verilerini çekerek forumda 120 topic_id ye kaydedecek. "musteri_kayitlari" sütun değerlerini virgülle ayırarak tek mesajda kayıt yapacak. sütunlar 'telefon' => (string)$telefon,
'baslama' => $baslama,
'hizmet_no' => (string)$hizmet_no,
'operator' => (string)$operator,
'ad_soyad' => (string)$ad_soyad,
'tc_kimlik' => (string)$tc_kimlik,
'aciklama' => (string)$aciklama,
'dogum' => (string)$dogum,
'tipi' => (string)$tipi,
'id' (aynı id ler kayıt yapılmayacak) boş olan değerler (sütunlarda) olabilir bunlar için bir değer yazılmayacak.
scripte başla tuşu olacak. saniyede 5 kayıt (değer değiştirilebilir olacak) kontrol ve kayıt edecek. stop tuşu olacak.
örnek kayıt dosyası ;
<?php
header("Content-Type: application/json; charset=UTF-8");
// phpBB DATABASE B?LG?LER?
$db_host = "localhost";
$db_name = "phpbb";
$db_user = "root";
$db_pass = "103005ms";
try {
$pdo = new PDO(
"mysql:host=$db_host;dbname=$db_name;charset=utf8mb4",
$db_user,
$db_pass,
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);
} catch (PDOException $e) {
echo json_encode(["error" => "DB Error: " . $e->getMessage()]);
exit;
}
// JSON INPUT
$data = json_decode(file_get_contents("php://input"), true);
if (!isset($data["value"]) || trim($data["value"]) === "") {
echo json_encode(["error" => "Bo? mesaj kaydedilemez."]);
exit;
}
// ---------------------------
// ? G?ZL? SATIR SONU TEM?ZLEME
// ---------------------------
$post_text = $data["value"];
// Tüm CRLF ve encoded sat?r sonu karakterlerini kald?r
$post_text = str_replace(["\r\n", "\r", "_x000D_"], "\n", $post_text);
// Birden fazla bo? sat?r? düzenle (opsiyonel ama temiz görünüyor)
$post_text = preg_replace("/\n{3,}/", "\n\n", $post_text);
// Ba?taki ve sondaki bo?luklar
$post_text = trim($post_text);
// E?er bo? kald?ysa kay?t yapma
if ($post_text === "") {
echo json_encode(["error" => "Mesaj yaln?zca sat?r sonu içeremez."]);
exit;
}
// PHPBB VER?LER?
$forum_id = 1;
$topic_id = 118;
$poster_id = 1;
$poster_name = "System";
$post_time = time();
$poster_ip = $_SERVER["REMOTE_ADDR"] ?? "127.0.0.1";
$bbcode_uid = substr(md5(uniqid()), 0, 8);
$post_checksum = md5($post_text);
// -----------------------------------------
// 1) YEN? post_id AL (phpBB otomatik art?rmaz!)
// -----------------------------------------
$new_post_id = $pdo->query("SELECT MAX(post_id) + 1 FROM phpbb_posts")->fetchColumn();
if (!$new_post_id) $new_post_id = 1;
// -----------------------------------------
// 2) POST EKLE
// -----------------------------------------
$sql = "
INSERT INTO phpbb_posts
(post_id, topic_id, forum_id, poster_id, poster_ip, post_time,
enable_bbcode, enable_smilies, enable_magic_url, enable_sig,
post_username, post_subject, post_text, post_checksum,
post_attachment, bbcode_bitfield, bbcode_uid, post_postcount,
post_visibility, post_reported)
VALUES
(:post_id, :topic_id, :forum_id, :poster_id, :poster_ip, :post_time,
1, 1, 1, 1,
:poster_name, :post_subject, :post_text, :post_checksum,
0, '', :bbcode_uid, 1,
1, 0)
";
$stmt = $pdo->prepare($sql);
$stmt->execute([
":post_id" => $new_post_id,
":topic_id" => $topic_id,
":forum_id" => $forum_id,
":poster_id" => $poster_id,
":poster_ip" => $poster_ip,
":post_time" => $post_time,
":poster_name" => $poster_name,
":post_subject" => "Otomatik Log",
":post_text" => $post_text,
":post_checksum" => $post_checksum,
":bbcode_uid" => $bbcode_uid
]);
// -----------------------------------------
// 3) TOPIC TABLOSUNU GÜNCELLE
// -----------------------------------------
$pdo->prepare("
UPDATE phpbb_topics
SET topic_last_post_id = :pid,
topic_last_post_time = :ptime,
topic_last_poster_id = :poster_id,
topic_last_poster_name = :pname,
topic_posts_approved = topic_posts_approved + 1
WHERE topic_id = :tid
")->execute([
":pid" => $new_post_id,
":ptime" => $post_time,
":poster_id" => $poster_id,
":pname" => $poster_name,
":tid" => $topic_id
]);
// -----------------------------------------
// 4) FORUM TABLOSUNU GÜNCELLE
// -----------------------------------------
$pdo->prepare("
UPDATE phpbb_forums
SET forum_posts_approved = forum_posts_approved + 1,
forum_last_post_id = :pid,
forum_last_post_time = :ptime,
forum_last_poster_id = :poster_id,
forum_last_poster_name = :pname
WHERE forum_id = :fid
")->execute([
":pid" => $new_post_id,
":ptime" => $post_time,
":poster_id" => $poster_id,
":pname" => $poster_name,
":fid" => $forum_id
]);
// -----------------------------------------
// 5) KULLANICI MESAJ SAYISI (+1)
// -----------------------------------------
$pdo->prepare("
UPDATE phpbb_users
SET user_posts = user_posts + 1
WHERE user_id = :uid
")->execute([
":uid" => $poster_id
]);
// -----------------------------------------
// SONUÇ
// -----------------------------------------
echo json_encode([
"status" => "success",
"post_id" => $new_post_id,
"topic_id" => $topic_id
]);