Probuje zalogowac sie na forum phpbb by przemo za pomcoa skryptu:
Kod
<?php
$fp=fsockopen("xxx.pl", 80);
fwrite($fp, "GET /login.php HTTP/1.1
User-Agent: Twoja stara (Windows 666; U; FY)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: identity, *;q=0
Cache-Control: no-cache
Connection: Keep-Alive
");
while(!feof($fp)){
$danesoket.= fread($fp, 1024);}
fclose($fp);
preg_match("/login\.php\?sid=([0-9a-zA-Z]{32})\"/", $danesoket, $matches);
if ($matches[1] == NULL)
{
exit;
}
$danesoket = "";
$fp=fsockopen("xxx.pl", 80);
fwrite($fp, "POST /login.php?sid=".$matches[1]." HTTP/1.1
User-Agent: Twoja stara (Windows 666; U; FY)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: identity, *;q=0
Connection: Keep-Alive
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
username=bubel5&password=123456&redirect=&login=Zaloguj");
while(!feof($fp)){
echo $danesoket.= fread($fp, 1024);}
(...)
?>
$fp=fsockopen("xxx.pl", 80);
fwrite($fp, "GET /login.php HTTP/1.1
User-Agent: Twoja stara (Windows 666; U; FY)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: identity, *;q=0
Cache-Control: no-cache
Connection: Keep-Alive
");
while(!feof($fp)){
$danesoket.= fread($fp, 1024);}
fclose($fp);
preg_match("/login\.php\?sid=([0-9a-zA-Z]{32})\"/", $danesoket, $matches);
if ($matches[1] == NULL)
{
exit;
}
$danesoket = "";
$fp=fsockopen("xxx.pl", 80);
fwrite($fp, "POST /login.php?sid=".$matches[1]." HTTP/1.1
User-Agent: Twoja stara (Windows 666; U; FY)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: identity, *;q=0
Connection: Keep-Alive
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
username=bubel5&password=123456&redirect=&login=Zaloguj");
while(!feof($fp)){
echo $danesoket.= fread($fp, 1024);}
(...)
?>
Co ciekawe nie jest potrzebne cookie, ale to nie wazne, problem polega na tym, ze kiedy loguje sie przez przegladarke komunikacja wyglada nastepujaco:
Kod
[2008-03-17 16:02:23:082]
POST /login.php?sid=af6f2d40a1166aec69718b3467dca091 HTTP/1.1
User-Agent: Opera/9.50 (Windows NT 5.1; U; en)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
username=bubel5&password=123456&redirect=&login=Zaloguj
[2008-03-17 16:02:26:928]
HTTP/1.1 302 Found
X-Powered-By: PHP/4.4.6
Set-Cookie: bb038dfef1_data=a%3A0%3A%7B%7D; expires=Tue, 17 Mar 2009 15:02:38 GMT; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_sid=af6f2d40a1166aec69718b3467dca091; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A5%3A%2220110%22%3B%7D; expires=Tue, 17 Mar 2009 15:02:38 GMT; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_sid=af6f2d40a1166aec69718b3467dca091; path=/; domain=xxx.pl
Location: http://xxx.pl/index.php?sid=af6f2d40a1166aec69718b3467dca091
Content-type: text/html
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 20
Date: Mon, 17 Mar 2008 15:02:41 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
....................
POST /login.php?sid=af6f2d40a1166aec69718b3467dca091 HTTP/1.1
User-Agent: Opera/9.50 (Windows NT 5.1; U; en)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
username=bubel5&password=123456&redirect=&login=Zaloguj
[2008-03-17 16:02:26:928]
HTTP/1.1 302 Found
X-Powered-By: PHP/4.4.6
Set-Cookie: bb038dfef1_data=a%3A0%3A%7B%7D; expires=Tue, 17 Mar 2009 15:02:38 GMT; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_sid=af6f2d40a1166aec69718b3467dca091; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A5%3A%2220110%22%3B%7D; expires=Tue, 17 Mar 2009 15:02:38 GMT; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_sid=af6f2d40a1166aec69718b3467dca091; path=/; domain=xxx.pl
Location: http://xxx.pl/index.php?sid=af6f2d40a1166aec69718b3467dca091
Content-type: text/html
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 20
Date: Mon, 17 Mar 2008 15:02:41 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
....................
Natomiast moj skrypt otrzymuje nieco inna odpowiedz:
Kod
[2008-03-17 16:09:15:746]
POST /login.php?sid=aaf22332cf005b4e05b62232b39cac61 HTTP/1.1
User-Agent: Twoja stara (Windows 666; U; FY)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: identity, *;q=0
Connection: Keep-Alive
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
username=bubel5&password=123456&redirect=&login=Zaloguj
[2008-03-17 16:09:20:382]
HTTP/1.1 302 Found
X-Powered-By: PHP/4.4.6
Set-Cookie: bb038dfef1_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A5%3A%2220110%22%3B%7D; expires=Tue, 17 Mar 2009 15:09:30 GMT; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_sid=aaf22332cf005b4e05b62232b39cac61; path=/; domain=xxx.pl
Location: http://xxx.pl/index.php?sid=aaf22332cf005b4e05b62232b39cac61
Content-type: text/html
Content-Length: 0
Date: Mon, 17 Mar 2008 15:09:35 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
POST /login.php?sid=aaf22332cf005b4e05b62232b39cac61 HTTP/1.1
User-Agent: Twoja stara (Windows 666; U; FY)
Host: xxx.pl
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: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: identity, *;q=0
Connection: Keep-Alive
Content-Length: 55
Content-Type: application/x-www-form-urlencoded
username=bubel5&password=123456&redirect=&login=Zaloguj
[2008-03-17 16:09:20:382]
HTTP/1.1 302 Found
X-Powered-By: PHP/4.4.6
Set-Cookie: bb038dfef1_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A5%3A%2220110%22%3B%7D; expires=Tue, 17 Mar 2009 15:09:30 GMT; path=/; domain=xxx.pl
Set-Cookie: bb038dfef1_sid=aaf22332cf005b4e05b62232b39cac61; path=/; domain=xxx.pl
Location: http://xxx.pl/index.php?sid=aaf22332cf005b4e05b62232b39cac61
Content-type: text/html
Content-Length: 0
Date: Mon, 17 Mar 2008 15:09:35 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Content-Length: 0 kiedy loguje sie skrypt,
Content-Length: 20 (20 kropek) kiedy loguje sie przegladarka, nie wiem czy w tym lezy problem, probowalem na wszelkie mozliwe sposoby i dupa, moze ktos z was przerabial ten temat i wie w czym zlezy problem? HELP.