Vārdsakot jums ir pašiem sava lapa iekš dr.lv un jums ir slinkums kaut ko rakstīt runā sadaļā tad tagad ir pavisam viegli nospert citu idejas viss, kas nepieciešams mapīte iekš /www mapes un 3 script faili.
index.php
<?
/*
LOAD CONFIG FILE
*/
require('config.php');
/*
DO NOT TOUCH THE CODE BELOW
*/
$draugi->get_lapas();
shuffle($draugi->lapas);
foreach($draugi->lapas as $lapa)
{
if($lapa != '/caks-bass/')
$draugi->get_ieraksti($lapa);
}
?>
config.php
<?php
/*
REQUIRE
*/
require 'class.drlv.php';
/*
SITE SETTINGS
*/
$user = array('e-pasts', 'parole');
$page_id = 13339110;
$page_url = '/caks-bass/';
if(!defined('STOP_LOGIN'))
$draugi = new drlv($user, $page_id, $page_url);
?>
class.drlv.php
<?php
class drlv
{
private $cookie = '';
public $header;
private $user = array();
private $lpp = 2;
public $lapas = array();
public $page_id = 0 ;
private $posted = 0;
public $page_url;
public $user_id = 0;
private $ref = '';
public $check_login = true;
public $logged_in = false;
function __construct($user, $page_id, $page_url, $check = true)
{
define(DIR, dirname(__FILE__));
$this->check_login = $check;
$this->user = $user;
$this->page_id = $page_id;
$this->page_url = $page_url;
$this->logged_in = $this->login();
if(!$this->logged_in && $this->check_login)
die('Nepareizi lietotāja dati.');
}
function return_user_ids($data, $use_idx = true)
{
$friends = array();
preg_match_all('/sm_([0-9]+)\./', $data, $id);
foreach($id[1] as $juzer)
{
if(!in_array($juzer, $friends) AND $juzer != $this->user_id)
{
if($use_idx)
$friends[$juzer] = $juzer;
else
$friends[] = $juzer;
}
}
return $friends;
}
function get_hash($data = false)
{
if(!$data)
$data = $this->get('http://www.draugiem.lv');
preg_match_all('/nm_([^\"]+)\" value\=\"([^\"]+)\"/is', $data, $hash);
return array('nm_' . $hash[1][0], $hash[2][0]);
}
function get_lapas()
{
for($i=1;$i<=$this->lpp;$i++)
{
$url = sprintf('http://www.draugiem.lv/lapas/?action=favorites&pg=%d', $i);
$data = $this->get($url);
preg_match_all('/\<div class\=\"userBox\"\> \<a class\=\"userPicture\" href\=\"([^\"]+)\"/', $data, $matches);
foreach($matches[1] as $nr => $index)
{
if($index != $this->page_url)
$this->lapas[] = $index;
}
sleep(2);
}
}
function write_runa_teksts($url, $id, $text)
{
list($h, $v)= $this->get_hash($this->get('http://www.draugiem.lv'));
$data = array(
'say[add][reply]'=>'',
'action'=>'add_comment',
'say[add][text]'=>$text,
'addCommentUid'=>$id,
$h=>$v
);
return $this->post($url, $data);
}
function post_teksts($text, $id)
{
if($this->posted > 50)
{
die('DONE');
sleep(10);
}
$url = 'http://www.draugiem.lv'.$this->page_url.'say/';
$this->write_runa_teksts($url, $this->page_id, $text);
$this->posted++;
}
function get_ieraksti($lapa)
{
$skaits = rand(10, 100);
$cur = 0;
for($i=1;$i<=4; $i++)
{
$url = sprintf('http://www.draugiem.lv%ssay/index?pg=%d', $lapa, $i);
$data = $this->get($url);
preg_match_all('/id\=\"sayPost([0-9]+)\"\>((?:(?!\"body).)*)\"body\"\>((?:(?!\<\/div\>).)*)/is', $data, $ieraksts);
foreach($ieraksts[1] as $nr => $posta_id)
{
$teksts = $this->parse_text($ieraksts[3][$nr]);
if(!preg_match('/\</', $teksts))
{
$cur++;
$teksts = trim(htmlspecialchars_decode(urldecode($teksts)));
//$teksts = utf8_encode($teksts);
$this->post_teksts($teksts, $posta_id);
sleep(2);
}
}
sleep(2);
}
}
function parse_text($text)
{
$text = preg_replace('/\<img src\=\"([^\"]+)\" class\=\"smiley\" alt\=\"([^\"]+)\" \/\>/is', '$2', $text);
$text = preg_replace('/\<a href\=\"\/say\/click\.php\?url\=((?:(?!\&uid).)*)&uid\=([0-9]+)&pid\=([0-9]+)\" target\=\"_blank\" class\=\"externalUrl\"\>([^\<]+)\<\/a\>/is', '$1', $text);
return $text;
}
function login() // notiek logins
{
list($username, $password) = $this->user;
$open = $this->get('http://iphone.draugiem.lv/');
$cookie_segments = explode(';', str_ireplace('Set-Cookie: ', '', $this->header['5']));
$this->cookie = $cookie_segments[0];
preg_match_all('/hash\" value\=\"([^\"]*)\"/', $open, $matches);
$hash = $matches[1][0];
$data = array('email'=>$username,
'password'=>$password,
'domain'=>'iphone.draugiem.lv',
'login'=>'Ienākt',
'hash'=>$hash,
'redir'=>'/',
'lang'=>'lv',
);
$data = $this->post('http://secure.draugiem.lv/login/', $data);
$cookie_segments = explode(';', str_ireplace('Set-Cookie: ', '', $this->header['9']));
$this->cookie = $cookie_segments[0];
$data = $this->get('http://www.draugiem.lv/');
$ids = $this->return_user_ids($data, false);
$this->user_id = $ids[0];
return $this->user_id > 10000 ? true:false;
}
function post($url, $data = array())
{
$options = array('http' => array(
'method' => 'POST',
'header'=>"Accept-language: en\r\n" .
'Referer: ' . $this->ref . "\r\n" .
'Cookie: ' . $this->cookie,
'content' => http_build_query($data)
));
$context = stream_context_create($options);
$res = @file_get_contents($url, false, $context);
$this->header = $http_response_header;
$this->ref = $url;
return $res;
}
function get($url, $data = array())
{
$options = array('http' => array(
'method' => 'GET',
'header'=>"Accept-language: en\r\n" .
'Referer: ' . $this->ref . "\r\n" .
'Cookie: ' . $this->cookie,
'content' => http_build_query($data)
));
$context = stream_context_create($options);
$res = @file_get_contents($url, false, $context);
$this->header = $http_response_header;
$this->ref = $url;
return $res;
}
function logout()
{
$this->get('http://iphone.draugiem.lv/logout.php');
$this->cookie = '';
}
function __destruct()
{
$this->logout();
}
}
?>
Ja jūs zinat vēl kādu noderīgu script priekš dr.lv tad lūdzu padalaties ar mani iekš šī paša topika sākam kodēt dažādākās lietas priekš draugiem[dot]lv