ICQ - форум. Всё про ICQ.  

Вернуться   ICQ - форум. Всё про ICQ. > Мастерская > Программирование > Web-программирование > Уроки Perl/PHP

 
 
Опции темы Оценить тему
Старый 11.11.2010, 10:28   #1
Участник
 
Аватар для Boolean
 
Регистрация: 20.10.2010
Сообщений: 2

ICQ: 543929

Репутация: 7
По умолчанию Приглашаем всех пользоваталей форума в друзья

Давненько написал скрипт для приглашения всех пользователей форума в друзья.
На себе не тестировать. Всю лс засрут вопросами "Ты кто?" , "Цель дружбы? "
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($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_URL$url);
        
curl_setopt ($chCURLOPT_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($chCURLOPT_HTTPHEADER,$headers);
        
curl_setopt($chCURLOPT_HEADER0);
        
curl_setopt($chCURLOPT_REFERER$forum);
    
curl_setopt($chCURLOPT_COOKIEJAR$cfile);
    
curl_setopt($chCURLOPT_COOKIEFILE$cfile);
    
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    
$result curl_exec($ch);
    
curl_close($ch);
  return 
$result;
}

function 
curlpost($url,$post)
{
    
$cfile 'cookies.txt';
    
$ch curl_init();
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_URL$url);
        
curl_setopt ($chCURLOPT_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($chCURLOPT_HTTPHEADER,$headers);
    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_POSTFIELDS$post);
    
curl_setopt($chCURLOPT_COOKIEJAR$cfile);
    
curl_setopt($chCURLOPT_COOKIEFILE$cfile);
    
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    
curl_setopt($chCURLOPT_POST1);
    
$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>'
;
}
?>

Последний раз редактировалось Boolean; 11.11.2010 в 11:38.
Boolean вне форума  
Плюсанули Boolean — 5 :
Старый 11.11.2010, 11:33   #2
Участник
 
Аватар для YurSem
 
Регистрация: 03.09.2007
Сообщений: 634

Репутация: 1182
По умолчанию

Походу на одном из форумов ты это протестировал, я твой ник запомнил :( Самое главное то, что пользы от этого никакой, только у остальных время отнимешь.
__________________
[ Продаю аськи, BBAAA - 2500 wmz, XYXYX - 1250 wmz, и другие 5d, 6d на любой вкус ] [ Продаю короткую почту 1d, 2d на маилру ]
YurSem вне форума  
Старый 11.11.2010, 12:57   #3
Участник
 
Аватар для X-Venom
 
Регистрация: 24.07.2008
Сообщений: 416

Репутация: 1136
Twitter
По умолчанию

как юзать то )
__________________
..жёлтый потолок, я на утро слоупок, я человек паук, ты человек песок.
X-Venom вне форума  
 

Опции темы
Оценка этой теме
Оценка этой теме:

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


Часовой пояс GMT +3, время: 12:08.


Перевод: zCarot
Форум Асечников © Asechka.RU

Новости Сочи Коротко обо всем