Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $inuser = 'Dekk';
- $incode = '777';
- $inlogin = iconv('CP1251','UTF-8',$inuser);
- function pars($in,$from,$to){
- preg_match('#'.$from.'(.*)'.$to.'#',$in,$out);
- return $out[1];
- };
- function twwkget($url,$isparse,$login,$pass,$hash){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_REFERER, $url);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- if (!empty($isparse)):
- curl_setopt($ch, CURLOPT_POSTFIELDS,'lifm=lifm&lifm:login='.$login.'&lifm:pass='.$pass.'&lifm:j_idt49=Войти&from=&javax.faces.ViewState='.$hash);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt');
- else:
- curl_setopt($ch, CURLOPT_POST, 0);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'/cookie.txt');
- endif;
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4');
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $result=curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- $hash = pars(twwkget('http://twwk.ru/login.xhtml','','','',''),'id="j_id1:javax.faces.ViewState:0" value="','" autocomplete');
- if (!empty($hash)):
- $html = twwkget('http://twwk.ru/login.xhtml',1,$inlogin,$incode,$hash);
- if (!strripos($html,'login-link-exit')):
- echo 'No valid!';
- else:
- echo 'Valid!';
- endif;
- else:
- echo 'Hash is empty.';
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement