RieqyNS13 icon

simple shoutbox bot

RieqyNS13 | PRO | 04/04/13 03:49:24 PM UTC | 0 ⭐ | 460 👁️ | Never ⏰ | []
PHP |

2.7 KB

|

None

|

0 👍

/

0 👎

<?php
date_default_timezone_set("Asia/Jakarta");
//identity
$user = "test_bot";
$pass = "test123";
//general data
$ua = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31";
$url_login = "http://devilzc0de.org/forum/index.php";
$url_post = "http://devilzc0de.org/forum/xmlhttp.php";
$url_smiles = "http://devilzc0de.org/forum/misc.php?action=smilies&popup=true&editor=clickableEditor";
//data to be sent
$data = array(":logodc", ":sungkem", ":metal", ":cambuk", ":garing", ":hah", ":army");
$smiles = smiles($url_smiles, $ua);
$post = $data[rand(0, count($data)-1)]." ".$smiles[rand(0, count($smiles)-1)];
//call function of login and send data
login($url_login, $user, $pass, $ua);
$send = post($url_post, $post, $ua);
//write logs
$logs = $user.": ".date("H:i:s d-m-Y")."-->".$post."-->".$send."\n";
$fp = fopen("logs.txt", "a");
fwrite($fp, $logs);
echo $logs;
 
function login($url_login, $user, $pass, $ua){
    $data = array("action" => "do_login", "username" => $user, "password" => $pass, "loginsubmit" => "Login!");
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url_login);
    curl_setopt($ch, CURLOPT_USERAGENT, $ua);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/kookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/kookie.txt");
    $exec = curl_exec($ch);
    curl_close($ch);
    return $exec;
}
 
function smiles($url_smiles, $ua){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url_smiles);
    curl_setopt($ch, CURLOPT_USERAGENT, $ua);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/kookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/kookie.txt");
    $exec = curl_exec($ch);
    $remove_html = strip_tags($exec);
    $pecah = explode("Click a smilie to insert it into your message", $remove_html);
    $hapus =  str_replace(array("[", "]", "close window", "\n", "\r", "\r\n"), " ", $pecah[1]);
    $hapus2 = preg_replace("/\s+/", " ", $hapus);
    $smiles = explode(" ",trim($hapus2));
    curl_close($ch);
    return $smiles;
    
}
 
function post($url_post, $post, $ua){
    $data = array("action" => "add_shout", "shout_data" => $post);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url_post);
    curl_setopt($ch, CURLOPT_USERAGENT, $ua);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/kookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/kookie.txt");
    $exec = curl_exec($ch);
    curl_close($ch);
    return $exec;
}
?>

Comments