Advertisement
plas71k

functions decoded

Nov 16th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.66 KB | None | 0 0
  1. <?php
  2. function array_to_http( $array )
  3. {
  4.     $retvar = "";
  5.     while ( list( $field, $data ) = field )
  6.     {
  7.         $retvar .= empty( "retvar" ) ? "" : "&";
  8.         $retvar .= urlencode( $field )."=".urlencode( $data );
  9.     }
  10.     return $retvar;
  11. }
  12.  
  13. function mk_file( $filename )
  14. {
  15.     if ( !is_file( $filename ) )
  16.     {
  17.         fclose( fopen( $filename, "x" ) );
  18.         return true;
  19.     }
  20.     return false;
  21. }
  22.  
  23. function write2file( $fname, $text )
  24. {
  25.     $fh = fopen( $fname, "a+" );
  26.     fwrite( $fh, $text );
  27.     fclose( $fh );
  28. }
  29.  
  30. function bet( $start, $end, $intext )
  31. {
  32.     $rnum = explode( $start, $intext );
  33.     $rnum = explode( $end, $rnum[1] );
  34.     return $rnum[0];
  35. }
  36.  
  37. function get_text( $url, $cookie = 1 )
  38. {
  39.     $useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) --autoposter-- Gecko/20061204 Firefox/2.0.0.1";
  40.     $ch9 = curl_init( );
  41.     curl_setopt( $ch9, CURLOPT_URL, $url );
  42.     curl_setopt( $ch9, CURLOPT_POST, 1 );
  43.     curl_setopt( $ch9, CURLOPT_USERAGENT, $useragent );
  44.     curl_setopt( $ch9, CURLOPT_SSL_VERIFYPEER, false );
  45.     if ( $cookie )
  46.     {
  47.         curl_setopt( $ch9, CURLOPT_COOKIEJAR, "cache/cookie3.txt" );
  48.     }
  49.     curl_setopt( $ch9, CURLOPT_RETURNTRANSFER, 1 );
  50.     $store = curl_exec( $ch9 );
  51.     curl_close( $ch9 );
  52.     return $store;
  53. }
  54.  
  55. function get_text_get( $url, $cookie = 1 )
  56. {
  57.     $useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) --autoposter-- Gecko/20061204 Firefox/2.0.0.1";
  58.     $cha = curl_init( );
  59.     curl_setopt( $cha, CURLOPT_URL, $url );
  60.     curl_setopt( $cha, CURLOPT_USERAGENT, $useragent );
  61.     curl_setopt( $cha, CURLOPT_SSL_VERIFYPEER, false );
  62.     curl_setopt( $cha, CURLOPT_COOKIEJAR, "cache/cookie4.txt" );
  63.     curl_setopt( $cha, CURLOPT_RETURNTRANSFER, 1 );
  64.     $store = curl_exec( $cha );
  65.     curl_close( $cha );
  66.     return $store;
  67. }
  68.  
  69. function get( $url )
  70. {
  71.     $process = curl_init( $url );
  72.     if ( $GLOBAL['good'] != "good" )
  73.     {
  74.         return;
  75.     }
  76.     $useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
  77.     curl_setopt( $process, CURLOPT_USERAGENT, $useragent );
  78.     curl_setopt( $process, CURLOPT_COOKIEJAR, "cache/cookie5.txt" );
  79.     curl_setopt( $process, CURLOPT_TIMEOUT, 30 );
  80.     curl_setopt( $process, CURLOPT_RETURNTRANSFER, 1 );
  81.     curl_setopt( $process, CURLOPT_FOLLOWLOCATION, 1 );
  82.     $return = curl_exec( $process );
  83.     curl_close( $process );
  84.     return $return;
  85. }
  86.  
  87. function rem_bet( $start, $end, $intext )
  88. {
  89.     $rnum = explode( $start, $intext );
  90.     $string = $rnum[0];
  91.     print_array( $rnum );
  92.     $count = count( $rnum );
  93.     $i = 0;
  94.     while ( $i < $count )
  95.     {
  96.         $rnum = explode( $end, $rnum[$i] );
  97.         $string = "{$string} <br> {$rnum['1']}";
  98.         ++$i;
  99.     }
  100.     return $string;
  101. }
  102.  
  103. function print_array( $array )
  104. {
  105.     $count = count( $array );
  106.     $i = 0;
  107.     while ( $i < $count )
  108.     {
  109.         echo htmlentities( $array[$i] )."<br>";
  110.         ++$i;
  111.     }
  112. }
  113.  
  114. function print_array_html( $array )
  115. {
  116.     $count = count( $array );
  117.     $i = 0;
  118.     while ( $i < $count )
  119.     {
  120.         echo $array[$i]."<br>";
  121.         ++$i;
  122.     }
  123. }
  124.  
  125. function clean( $array )
  126. {
  127.     $remove = array(
  128.         ",",
  129.         "\\",
  130.         ".",
  131.         "!",
  132.         "@",
  133.         "#",
  134.         "\$",
  135.         "%",
  136.         "^",
  137.         "&",
  138.         "(",
  139.         ")"
  140.     );
  141.     $count = count( $array );
  142.     $i = 0;
  143.     while ( $i < $count )
  144.     {
  145.         if ( $array[$i] == "" )
  146.         {
  147.             continue;
  148.         }
  149.         foreach ( $remove as $rev )
  150.         {
  151.             $count1 = substr_count( $array[$i], $rev );
  152.             $pos = strpos( $array[$i], $rev );
  153.             while ( $pos )
  154.             {
  155.                 $array[$i] = substr_replace( $array[$i], "", $pos, strlen( $rev ) );
  156.                 $pos = strpos( $array[$i], $rev );
  157.             }
  158.         }
  159.         ++$i;
  160.     }
  161.     return $array;
  162. }
  163.  
  164. function rec_bet( $start, $end, $intext )
  165. {
  166.     $res = array( );
  167.     $rnum = @explode( $start, $intext );
  168.     $count = @count( $rnum );
  169.     $i = 1;
  170.     while ( $i < $count )
  171.     {
  172.         $temp = @explode( $end, $rnum[$i] );
  173.         $res[] = $temp[0];
  174.         ++$i;
  175.     }
  176.     return $res;
  177. }
  178.  
  179. function breakon( $string )
  180. {
  181.     $brkat = array( " in ", " on ", " and ", " at ", " a ", " are ", " but ", " or ", " so ", " was ", " of ", " as ", ". ", ", ", " the ", " that ", " into " );
  182.     $count = count( $brkat );
  183.     $i = 0;
  184.     while ( $i < $count - 1 )
  185.     {
  186.         $res = explode( $brkat[$i], $string );
  187.         $string = implode( "<>", $res );
  188.         ++$i;
  189.     }
  190.     $string = explode( "<>", $string );
  191.     return $string;
  192. }
  193.  
  194. function seperate( $syn_array )
  195. {
  196.     $sep_words[] = "";
  197.     $count = count( $syn_array );
  198.     echo $count;
  199.     $i = 1;
  200.     while ( $i < $count + 1 )
  201.     {
  202.         $words = explode( ", ", $syn_array[$i] );
  203.         $count2 = count( $words );
  204.         $j = 1;
  205.         while ( $j < $count2 + 1 )
  206.         {
  207.             if ( $words[$j] == "" )
  208.             {
  209.                 continue;
  210.             }
  211.             $sep_words[] = $words[$j];
  212.             ++$j;
  213.         }
  214.         ++$i;
  215.     }
  216.     return $sep_words;
  217. }
  218.  
  219. function just_clean( $string )
  220. {
  221.     $specialCharacters = array( "#" => "", "\$" => "", "%" => "", "&" => "", "@" => "", "." => "", "\x80" => "", "?" => "", "'" => "", "\"" => "", "=" => "", "\xA7" => "", "\\" => "", "/" => "" );
  222.     while ( list( $character, $replacement ) = character )
  223.     {
  224.         $string = str_replace( $character, "-".$replacement."-", $string );
  225.     }
  226.     $string = strtr( $string, "??????? ??????????????????????????????????????????????", "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn" );
  227.     $string = preg_replace( "/[^a-zA-Z0-9\\-]/", "", $string );
  228.     $string = preg_replace( "/^[\\-]+/", "", $string );
  229.     $string = preg_replace( "/[\\-]+\$/", "", $string );
  230.     $string = preg_replace( "/[\\-]{2,}/", "", $string );
  231.     return $string;
  232. }
  233.  
  234. function fix_message( $message, $l )
  235. {
  236.     $message = str_replace( "&039;", "'", $message );
  237.     $message = str_replace( "&#039;", "'", $message );
  238.     $message = str_replace( "&amp;", "&", $message );
  239.     $message = str_replace( "&quot;", "\"", $message );
  240.     if ( $l )
  241.     {
  242.         $message = strtr( $message, array( ":" => "&#58;", "@" => "&#64;", "." => ". ", "http://" => "hxxp: ", "/" => " / " ) );
  243.     }
  244.     return $message;
  245. }
  246.  
  247. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement