<?php 

  $allid=allchatid($_SESSION['guestid']);	
   $nums=0;
  $filename="http://data.etwservice.com/etw_xml/".$_SESSION['guestid'].".xml";
  if(remote_file_exists($filename)){
      $xml = ""; 
      $f = fopen( $filename, 'r' ); 
      while( $data = fread( $f, 4096 ) ) { $xml .= $data; } 
      fclose( $f ); 
	  preg_match_all( "/\<item\>(.*?)\<\/item\>/s",$xml, $items ); 
     $k=1;
	
	  foreach( $items[1] as $item ){
	       $flat=1; 
		   preg_match_all( "/\<id\>(.*?)\<\/id\>/", $item, $chatid ); 
		   for($i=0;$i<count($allid);$i++){
		     if($chatid[1][0]==$allid[$i]){
			    $flat=0;
				break;
			   }
			 }
			 if($flat==1){ $nums=$nums+1; }
		}	 
 }
 echo $nums;
?>