2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								echo ( " Port Stack:  " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$sql  =  " SELECT * FROM `ports_stack` WHERE `device_id` = ' " . $device [ 'device_id' ] . " ' " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$query  =  mysql_query ( $sql );  
						 
					
						
							
								
									
										
										
										
											2011-09-20 14:22:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								while  ( $entry  =  mysql_fetch_assoc ( $query ))  
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $stack_db_array [ $entry [ 'interface_id_high' ]][ $entry [ 'interface_id_low' ]][ 'ifStackStatus' ]  =  $entry [ 'ifStackStatus' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$stack_poll_array  =  snmpwalk_cache_twopart_oid ( $device ,  " ifStackStatus " ,  array ());  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 09:10:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								foreach  ( $stack_poll_array  as  $interface_id_high  =>  $entry_high )  
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-10-04 09:10:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  foreach  ( $entry_high  as  $interface_id_low  =>  $entry_low ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ifStackStatus  =  $entry_low [ 'ifStackStatus' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 14:22:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( isset ( $stack_db_array [ $interface_id_high ][ $interface_id_low ])) 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 14:22:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      if  ( $stack_db_array [ $interface_id_high ][ $interface_id_low ][ 'ifStackStatus' ]  ==  $ifStackStatus ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo ( " . " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mysql_query ( " UPDATE `ports_stack` SET `ifStackStatus` = ' " . $ifStackStatus . " ' WHERE `device_id` = ' " . $device [ 'device_id' ] . " ' AND `interface_id_high` = ' " . $interface_id_high . " ' AND `interface_id_low` = ' " . $interface_id_low . " ' " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo ( " U " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 14:22:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( $debug )  {  echo ( mysql_error ());  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      unset ( $stack_db_array [ $interface_id_high ][ $interface_id_low ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      mysql_query ( " INSERT INTO `ports_stack` (`device_id`,`interface_id_high`,`interface_id_low`,`ifStackStatus`)  VALUES (' " . $device [ 'device_id' ] . " ',' " . $interface_id_high . " ',' " . $interface_id_low . " ',' " . $ifStackStatus . " ') " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      echo ( " + " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 14:22:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      if  ( $debug )  {  echo ( mysql_error ());  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-15 16:52:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								foreach  ( $stack_db_array  AS  $interface_id_high  =>  $array )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  foreach  ( $array  AS  $interface_id_low  =>  $blah ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( $device [ 'device_id' ] . "   " . $interface_id_low . "   " . $interface_id_high .  " \n " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    dbDelete ( 'ports_stack' ,  " `device_id` =  ? AND interface_id_high = ? AND interface_id_low = ? " ,  array ( $device [ 'device_id' ],  $interface_id_high ,  $interface_id_low )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " - " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-03 21:46:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								echo ( " \n " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-27 17:41:35 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								?>