Давненько написал скрипт для приглашения всех пользователей форума в друзья.
На себе не тестировать. Всю лс засрут вопросами "Ты кто?" , "Цель дружбы? "
PHP код:
<?php
if ( (!empty($_POST['forum'])) && (!empty($_POST['login'])) && (!empty($_POST['pass'])) && (!empty($_POST['with'])) && (!empty($_POST['to'])) )
{
$forum=$_POST['forum'];
$login=$_POST['login'];
$pass=$_POST['pass'];
$with=intval($_POST['with']);
$to=intval($_POST['to']);
function parsit($_s,$src,$s_)
{
$a1=explode($_s,$src);
$a2=explode($s_,$a1[1]);
return $a2[0];
}
function curlget($url)
{
$cfile = 'cookies.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Opera/9.64 (Windows NT 5.1; U; ru) Presto/2.1.1");
$headers = array
(
'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1',
'Accept-Language: ru-RU,ru;q=0.9,en;q=0.8',
'Content-Type: application/x-www-form-urlencoded',
'Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1',
'Accept-Encoding: deflate',
'Cookie2: $Version=1',
'Connection: Keep-Alive, TE',
'TE: deflate, gzip, chunked, identity, trailers'
);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER, $forum);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cfile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function curlpost($url,$post)
{
$cfile = 'cookies.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Opera/9.64 (Windows NT 5.1; U; ru) Presto/2.1.1");
$headers = array
(
'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1',
'Accept-Language: ru-RU,ru;q=0.9,en;q=0.8',
'Content-Type: application/x-www-form-urlencoded',
'Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1',
'Accept-Encoding: deflate',
'Cookie2: $Version=1',
'Connection: Keep-Alive, TE',
'TE: deflate, gzip, chunked, identity, trailers'
);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cfile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$md5pass=md5($pass);
print "Authorization...\r\n";
$auth=curlpost($forum."login.php","vb_login_username=$login&cookieuser=1&vb_login_password=$pass&s=&securitytoken=guest&do=login&vb_login_md5password=$md5pass&vb_login_md5password_utf==$md5pass");
if (strpos($auth,$login)!=FALSE)
{
print "Authorized!\r\n";
print "Started!\r\n";
for ($u=$with;$u<=$to;$u++)
{
$src=curlget($forum."profile.php?do=addlist&list=&userid=$u");
$sectoken=parsit('<input type="hidden" name="securitytoken" value="',$src,'"');
$addfriend=curlpost($forum."profile.php","s=&securitytoken=$sectoken&do=doaddlist&userlist=friend&userid=$u&friend=1");
print "Send: $u\r\n";
}
print "The End.\r\n";
}
else
{
echo 'Authentification failed!\r\n';
}
}
else
{
$cpr='(c) Boolean. CODINGWORLD.RU ';
header("Content-Type: text/html; charset=windows-1251");
echo '
<html>
<head>
<title>vBFriender</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
</head>
<body>
<form method="POST">
<table align="center" border="0" cellpadding="0" style="font: 9pt Verdana;">
<tr>
<td width="100">Forum:</td><td width="100"><input type="text" name="forum" value=""></td>
</tr>
<tr>
<td width="100">Login:</td><td width="100"> <input type="text" name="login" value=""></td>
</tr>
<tr>
<td width="100">Password:</td><td width="100"> <input type="password" name="pass" value=""></td>
</tr>
<tr>
<td width="100">Begin with:</td><td width="100"> <input type="text" name="with" value=""></td>
</tr>
<tr>
<td width="100">To:</td><td width="100"> <input type="text" name="to" value=""></td>
</tr><tr><td><input type="submit" value="Go!"></td></tr>
<tr>
<td>
'.$cpr.'
</td>
</tr>
</table>
</form>
</body>
</html>';
}
?>