Вход Регистрация
Файл: billing/_rootinc/todaynic/xmlbase.inc.php
Строк: 44
<? function cltrid( ) {     list( $usec, $sec ) = explode( " ", microtime( ) );     $cltrid = $usec * 10000 + $sec * 10000;     return $cltrid; } function getencid( $cltrid, $password ) {     return md5( "{$cltrid}-{$password}" ); } function getvalue( $value, $CutXml ) {     $key = $value;     if ( strpos( $value, "-" ) ) {         $value = substr( $value, 0, strpos( $value, "-" ) );     }     $str1 = "<".$value;     $str2 = "</".$value;     $start_pos = strpos( $CutXml, $str1 );     if ( 0 < $start_pos ) {         $start_pos += strlen( $str1 );         $CutXml = substr( $CutXml, $start_pos );         $end_pos = strpos( $CutXml, $str2 );         $resValue = substr( $CutXml, strpos( $CutXml, ">" ) + 1, $end_pos - strpos( $CutXml, ">" ) - 1 );     }     return $resValue; } function parsemol( $mvalues, $mretype = 0 ) {     if ( $mvalues[0]['type'] == "open" ) {         $i = 1;         for ( ; $i < count( $mvalues ); ++$i ) {             $key = $mvalues[$i]['tag'];             if ( !$mretype ) {                 $mol[$key][] = $mvalues[$i]['value'];             }             else {                 $arr = array();                 $arr['value'] = $mvalues[$i]['value'];                 if ( isset( $mvalues[$i]['attributes'] ) ) {                     $arr['attributes'] = $mvalues[$i]['attributes'];                 }                 $mol[$key][] = $arr;             }         }     }     return $mol; } function xmltoarray( $values, $tags, $item, $parsetype = 0 ) {     foreach ( $tags as $key => $val ) {         if ( $key == $item ) {             $molranges = $val;             $offset = $molranges[0];             $len = $molranges[1] - $offset;             $data = parsemol( array_slice( $values, $offset, $len ), $parsetype );         }     }     return $data; } function xmlgetvalue( $values, $tags, $item ) {     foreach ( $tags as $key => $molranges ) {         if ( $key == $item ) {             $i = 0;             for ( ; $i < $num; ++$i ) {                 $data[] = $values[$molranges[$i]]['value'];             }         }     }     return $data; } function toarray( $xml, $content = "response", $parsetype = 0 ) {     $parser = xml_parser_create( );     xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );     xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );     xml_parse_into_struct( $parser, $xml, $values, $tags );     xml_parser_free( $parser );     $dbxml = xmltoarray( $values, $tags, $content, $parsetype );     return $dbxml; } ?>
Онлайн: 2
Реклама