????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 3.148.227.92
Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f
System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/icad.astacus.se/archive/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/icad.astacus.se/archive/start_extern.php
<?php

	

session_start();

$projectId = $_GET['projectId'];
$CompanyId = 1278;
$_SESSION['ASTACUS_SSO_INFO'][4] = 1278;
$_SESSION['ASTACUS_SSO_INFO'][0] = 2300;
$path_t =  "Ritningar/0531 Stadens Dike 6 Hus D";

$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("vpa");

$sql = "select * from ICADARCHIVEPermissions where SystemUserId = 2300";
	
$result = mysql_query($sql);
$be1 = false;
$be2 = false;
$be3 = false;
$be4 = false;
$be5 = false;
$be6 = false;
$be7 = false;
$be8 = false;
$be9 = false;
$be10 = false;
$be11 = false;
while ($row = mysql_fetch_assoc($result)){ 
	if($row['Permission'] == 1){
		$be1 = true;
	}else if($row['Permission'] == 2){
		$be2 = true;	
	}else if($row['Permission'] == 3){
		$be3 = true;	
	}else if($row['Permission'] == 4){
		$be4 = true;	
	}else if($row['Permission'] == 5){
		$be5 = true;	
	}else if($row['Permission'] == 6){
		$be6 = true;	
	}else if($row['Permission'] == 7){
		$be7 = true;	
	}else if($row['Permission'] == 8){
		$be8 = true;	
	}else if($row['Permission'] == 9){
		$be9 = true;	
	}else if($row['Permission'] == 10){
		$be10 = true;	
	}else if($row['Permission'] == 11){
		$be11 = true;	
	}
}



?>

<link href="../main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="calendar.js"></script>
 <script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
<script type="text/javascript">
var CBoxCount = 10000;   // set to number of checkboxes to evaluate (0...n)

function getRequest() {
		var req = false;
		try{
			// most browsers
			req = new XMLHttpRequest();
		} catch (e){
			// IE
			try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				// try an older version
				try{
					req = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e){
					return false;
				}
			}
		}
		return req;
	}

function checkAll(flag) {
	
  var IDS = '';
  for (i = 0; i<CBoxCount; i++) {
    IDS = 'checkbox'+i;

    document.getElementById(IDS).checked = flag;
  }
}

function MM_openBrWindow2(theURL,winName) { //v2.0

  window.open(theURL,winName,'status=yes, resizable=yes','width='+screen.width,'height='+screen.height);
}


function MM_openBrWindow2(theURL,winName,extra) { //v2.0

  window.open(theURL,winName,extra);
}

	function deleteFile(stuff){
			
			
			
	
	    var retVal = confirm("Vill du verkligen ta bort filen/mappen?");
	  
		   
		if( retVal == true ){
			 document.location.href= stuff;
			 return true;
		}
	
			
			
		}
		
		
	//	var ajax = getRequest();
		
function lock(FileHash){
	  var retVal = confirm("Vill du verkligen checka in/ut den här filen?");
	  
		   
		if( retVal == true ){
		/*	
			var s = "http://www.icad.astacus.se/archive/checkout.php?filehash="+FileHash;
			ajax.open("GET", s, true);
			ajax.onreadystatechange = updatePage;
			ajax.send(null);
			*/
			 return true;
		}
}	

function updatePage() {
 
 /* if (ajax.readyState == 4) {
    var response = ajax.responseText;
    if(response == "1"){
		alert("Filen är utchekad!");
	}else if(response == "2"){
		alert("Filen är incheckad!");
	}else{
		alert("Filen är redan utchekad av någon annan!");
	}
  }
  */
}	
		
		
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
</script>

<script type="text/javascript">
function row_color(action,id)
{
	
	
	if(document.getElementById(id).bgColor != "#00FF00"){
		if(action == 1){
			document.getElementById(id).bgColor = "#EEEEEE";
		}else if(action == 2){
			document.getElementById(id).bgColor = "#FFFFFF";
		}else if(action == 3){
			document.getElementById(id).bgColor = "#00FF00";
		}
	}

}
</script>

<script src="sorttable.js"></script>
<title></title>
<body onLoad="showClockSWE();">
<style type="text/css"> 
.ToolText{position:relative;color: #000000; text-decoration:none } 
.ToolTextHover{position:relative;color: #000000; text-decoration:none} 
.ToolText span{display: none;} 

table{
  
    table-layout: fixed;
  
}

.ToolTextHover span{ 




 
  display:block; 
  position:absolute; 
  border:1px solid black; 
  top:0em; 
  left:50px; 
  background-color:#EEEEEE; color:white; 
  text-align: center; 
  width:250px;
  text-decoration:none;
  color:#000000;
  z-index:100;
  opacity:1.0;
  
} 
</style>

<style type="text/css">
<!--
.style6 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
-->
</style>
<br>

<?php
if($_GET['code'] == "safwefweff-safasfasfas-adq32rfweas-2333"){
	
			    $sql = "SELECT * FROM ICADARCHIVEParameters, ICADARCHIVEGroups WHERE ICADARCHIVEParameters.ParameterGroupId = ICADARCHIVEGroups.GroupId and ICADARCHIVEParameters.ShowAsColumn = 1 and ICADARCHIVEGroups.CompanyId = $CompanyId order by ICADARCHIVEParameters.ParameterId";
	 
	
	 
	
				$result = mysql_query($sql);
				$x = 1;
				while ($row = mysql_fetch_assoc($result)){ 

					$x++;
	
				}
				
				$nbr_para = $x;
				
				$column_width = 100 / $nbr_para;
				$column_width = $column_width;
				$table_width = 1200;
				$chars = ($table_width/$column_width)/4;
				
		
				
				
				$table_width = 1000 + 122*($x-6);
				
				if(	$table_width < 1000){
					$table_width = 1000;	
				}
			$table_width = '99%';	
				
		

?>
<table width="<?php echo($table_width);?>" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="276" valign="top" class="heading2"><hr size="1">
      <form name="form2" method="post" action="?page=delochicad&path=<?php echo($path_t);?>">
        <?php if($_GET['action'] == ""){ ?>
        <?php if($be1 == true){?>
        <p class="textthin"><?php echo($a110);?><br>
          <?php echo($a111);?><?php 
				
				
				
				$path = $path_t;
				
				$count_files = 0;
				echo($path_t);
				
				?>
            <?php 
				
				
				
				// Get parameters
				$Parameter1 = "";
				$Parameter2 = "";
				$Parameter3 = "";
				$Parameter4 = "";
				$Parameter5 = "";
				$Parameter6 = "";
				$Parameter7 = "";
				$Parameter8 = "";
				$Parameter9 = "";
				$Parameter10 = "";
				$Parameter11 = "";
				$Parameter12 = "";
				$Parameter13 = "";
				$Parameter14 = "";
				$Parameter15 = "";
				
			    $sql = "SELECT * FROM ICADARCHIVEParameters, ICADARCHIVEGroups WHERE ICADARCHIVEParameters.ParameterGroupId = ICADARCHIVEGroups.GroupId and ICADARCHIVEParameters.ShowAsColumn = 1 and ICADARCHIVEGroups.CompanyId = $CompanyId order by ICADARCHIVEParameters.ParameterId";
	 
	
	 
	
				$result = mysql_query($sql);
				$x = 1;
					$nbr_par = 0;
				while ($row = mysql_fetch_assoc($result)){ 
					if($x == 1){
						$Parameter1 = $row["ParameterName"];
					}else if($x == 2){
						$Parameter2 = $row["ParameterName"];
					}else if($x == 3){
						$Parameter3 = $row["ParameterName"];
					}
					else if($x == 4){
						$Parameter4 = $row["ParameterName"];
					}
					else if($x == 5){
						$Parameter5 = $row["ParameterName"];
					}
					else if($x == 6){
						$Parameter6 = $row["ParameterName"];
					}
					else if($x == 7){
						$Parameter7 = $row["ParameterName"];
					}
					else if($x == 8){
						$Parameter8 = $row["ParameterName"];
					}
					else if($x == 9){
						$Parameter9 = $row["ParameterName"];
					}
					else if($x == 10){
						$Parameter10 = $row["ParameterName"];
					}else if($x == 11){
						$Parameter11 = $row["ParameterName"];
					}else if($x == 12){
						$Parameter12 = $row["ParameterName"];
					}else if($x == 13){
						$Parameter13 = $row["ParameterName"];
					}else if($x == 14){
						$Parameter14 = $row["ParameterName"];
					}else if($x == 15){
						$Parameter15 = $row["ParameterName"];
					}
					
					$x++;
						$nbr_par++;
					$ParameterGroupId = $row["ParameterGroupId"];
				}
				
			
			
				
				
				
			?>
            </a><br>
        </p>
        <table width="<?php echo($table_width);?>" height="21" border="0" align="center" cellpadding="0" cellspacing="0" class="sortable">
          <tr class="text">
            <td width="180"><?php echo($a2);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter1);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter2);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter3);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter4);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter5);?></td>
            
            <?php
            
			if($Parameter6 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter6);?></td>
            <?php	
				}
			?>
			
            
              <?php
            
			if($Parameter7 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter7);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter8 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter8);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter9 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter9);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter10 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter10);?></td>
            <?php	
				}
			?>
			
               <?php
            
			if($Parameter11 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter11);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter12 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter12);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter13 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter13);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter14 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter14);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter15 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter15);?></td>
            <?php	
				}
			?>
			
            
            
		
            
            
            <td width="22"><input type="checkbox" name="check1" id="check1" onClick="checkAll(this.checked)"></td>
            <td width="100">Markera alla</td>
          </tr>
          <?php 
				  
				  	function AddPath($PathToCreate){
						$iBreak = 0;
						$iBreak = strrpos($PathToCreate, "/");
						if($iBreak !== FALSE){
							$Parent = substr($PathToCreate, 0, $iBreak);
							if(!@chdir($Parent)){
								AddPath($Parent);
							}
						}
					
						if(!@chdir($PathToCreate)){
							mkdir($PathToCreate);
						}
					}
					
					

function count_files_recursive($path) {
 
    // use a normalize_path function here
    // to make sure $path contains an
    // ending slash
    // (-> http://codedump.jonasjohn.de/snippets/normalize_path.htm)
 

    $files = 0;
 
 if(substr($path,strlen($path)-1,1) != "/"){
 $path = $path."/";
 }
    // open dir:
    $dir = opendir($path);
    if (!$dir){return 0;}
 
    while (($file = readdir($dir)) !== false) {
 
        if ($file[0] == '.'){ continue; }
		
 
        if (is_dir($path.$file)){        
            // recursive:
            $files += count_files_recursive($path.$file.DIRECTORY_SEPARATOR);
        }
        else {
            // increase file count
            $files++;
        }
    }    
    // close dir:
    closedir($dir);
 
    return $files;
}
function GetFolderSize($d ="." ) {
    // &copy; kasskooye and patricia benedetto
    $h = @opendir($d);
    if($h==0)return 0;

    while ($f=readdir($h)){
        if ( $f!= "..") {
            $sf+=filesize($nd=$d."/".$f);
            if($f!="."&&is_dir($nd)){
                $sf+=GetFolderSize ($nd);
            }
        }
    }
    closedir($h);
    return $sf ;
} 


					$row_count = 0;
				  
				   $path = "/var/www/icad_files/$CompanyId/archive/".$path_t."/";
				
				   AddPath($path);
				  
				  
				  if($be1 == "true"){
					  $view_viewer_files = "___icad_viewer_files___";
					  }else{
						  $view_viewer_files = "icad_viewer_files";
						  } 
				   
				
				   $dir_handle = @opendir($path);
				   $x = 0;
				   $i = 0;
				   $narray=array();

				   while (false !== ($file = readdir($dir_handle))){
				  
				    if(substr($file,0,1) != "." && $file !=  $view_viewer_files){
					
					 $narray[$i]=$file;
					 $i++;
					}					
				}
				
				sort($narray);
				
				for($i=0; $i<sizeof($narray); $i++){

					$file = $narray[$i];
					
				    $x++;
					$Path = ($path."/".$file);
					$FilePH = str_replace("//","/",$Path);
					$FilePH = str_replace("//","/",$FilePH);
					$FileHash = md5($FilePH);
					
					
					
				
					$isFol = false;
					
				   if(!is_file($path."/".$file)){
				   	//	$size = round(GetFolderSize($path."/".$file)/(1024),2)." Kb";
					//	$nbr = count_files_recursive($path."/".$file);
						$p = $path_t;
						if($p == "/"){
							$p = "";
						}
						$filestr = "?path=".$p."/".$file;
						$ico = "folder.gif";
						$isFol = true;
						
				   }else {
				    //	$size  = round(filesize($file)/(1024),2) . " Kb";
						$nbr = "";
						$filestr  = "view_file.php?hash=$FileHash";
						$filestr  = "download_file.php?hash=$FileHash";
						
					
						
						$ico = "view1.jpg";
				   }
				   
				   	
				    $sql = "SELECT * FROM  ICADARCHIVEParameterData, ICADARCHIVEParameters  WHERE ICADARCHIVEParameters.ParameterId = ICADARCHIVEParameterData.ParameterId and FileHash  = '$FileHash' and ICADARCHIVEParameters.ShowAsColumn = 1 and ParameterGroupId = $ParameterGroupId order by ICADARCHIVEParameters.ParameterId";
					
							$result = mysql_query($sql);
			
					
					$Value1 = "";
					$Value2 = "";
					$Value3 = "";
					$Value4 = "";
					$Value5 = "";
					$Value6 = "";
					$Value7 = "";
					$Value8 = "";
					$Value9 = "";
					$Value10 = "";
					$Value11 = "";
					$Value12 = "";
					$Value13 = "";
					$Value14 = "";
					$Value15 = "";
						$V6 = false;
				$V7 = false;
				$V8 = false;
				$V9 = false;
				$V10 = false;
				$V11 = false;
				$V12 = false;
				$V13 = false;
				$V14 = false;
				$V15 = false;
					
						$x = 1;
					
					while ($row = mysql_fetch_assoc($result)){ 
					if($x == 1){
						$Value1 = $row["Value"];
					}else if($x == 2){
						$Value2 = $row["Value"];
					}else if($x == 3){
						$Value3 = $row["Value"];
					}else if($x == 4){
						$Value4 = $row["Value"];
					
						}else if($x == 5){
						$Value5 = $row["Value"];
					
						}else if($x == 6){
						$Value6 = $row["Value"];
					$V6 = true;
						}else if($x == 7){
						$Value7 = $row["Value"];
					$V7 = true;
						}else if($x == 8){
						$Value8 = $row["Value"];
					$V8 = true;
						}else if($x == 9){
						$Value9 = $row["Value"];
						$V9 = true;
					}else if($x == 10){
						$Value10 = $row["Value"];
						$V10 = true;
					}else if($x == 11){
						$Value11 = $row["Value"];
						$V11 = true;
					}else if($x == 12){
						$Value12 = $row["Value"];
						$V12 = true;
					}else if($x == 13){
						$Value13 = $row["Value"];
						$V13 = true;
					}else if($x == 14){
						$Value14 = $row["Value"];
						$V14 = true;
					}else {
						$Value15 = $row["Value"];
						$V15 = true;
					}
					
					$x++;
					
				}
				
				
				
					
				  ?>
          <tr class="textthin"  onMouseover="row_color(1,'row<?php echo($row_count);?>');" onMouseout="row_color(2,'row<?php echo($row_count);?>');" id="row<?php echo($row_count);?>">
            <td width="<?php echo($column_width);?>%"><?php
						  
						  if($Value1== "Doc" || $Value2 == "Doc"|| $Value3 == "Doc"|| $Value4== "Doc" || $Value5 == "Doc"  || $Value6 == "Doc"  || $Value7 == "Doc"  || $Value8 == "Doc"  || $Value9 == "Doc"  || $Value10 == "Doc" || $Value11 == "Doc" || $Value12 == "Doc" || $Value13 == "Doc" || $Value14 == "Doc" || $Value15 == "Doc"){
						$filestr  = "download_file.php?hash=$FileHash"; ?>
              <a href="<?php echo($filestr);?>">
                <?php
						
						}else{
						?>
                <a href="#<?php echo($file);?>" onClick="MM_openBrWindow2('viewer/?file=<?php echo(str_replace("//","/",($path_t."/".$file)));?>&FileHash=<?php echo($FileHash);?>','viewer','resizable=yes, width=1200, height=800, screenX=20, screenY=10, top=10,left=20');row_color(3,'row<?php echo($row_count);?>');">
                <?php 
					  
						}?>
                <img src="images/<?php echo($ico);?>" alt="" border="0" align="absmiddle"></a>&nbsp;&nbsp;
              <?php if($ico == "view1.jpg"){?>
              <?php
						  
						  if($Value1== "Doc" || $Value2 == "Doc"|| $Value3 == "Doc"|| $Value4== "Doc" || $Value5 == "Doc"  || $Value6 == "Doc"  || $Value7 == "Doc"  || $Value8 == "Doc"  || $Value9 == "Doc"  || $Value10 == "Doc" || $Value11 == "Doc" || $Value12 == "Doc" || $Value13 == "Doc" || $Value14 == "Doc" || $Value15 == "Doc"){
						$filestr  = "download_file.php?hash=$FileHash"; ?>
              <a href="<?php echo($filestr);?>">
                <?php
						
						}else{
						?>
                <a href="#<?php echo($file);?>" onClick="MM_openBrWindow2('viewer/?file=<?php echo(str_replace("//","/",($path_t."/".$file)));?>&FileHash=<?php echo($FileHash);?>','viewer','resizable=yes, width=1200, height=800, screenX=20, screenY=10, top=10,left=20');row_color(3,'row<?php echo($row_count);?>');" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'">
                <?php 
					  
						}
					  
					  }else{?>
                <a href="<?php echo($filestr);?>" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'">
                <?php }?>
                <?php if(strlen($file) > 20){?>
                <?php echo(substr($file,0,20));?>...<span><?php echo($file);?></span>
                <?php }else{echo($file);}?>
              </a></td>
            <td width="<?php echo($column_width);?>%"><?php if(strlen($Value1) > $chars){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value1,0,$chars));?><span><?php echo($Value1);?></span></a>
              <?php }else{echo($Value1);}?></td>
            <td width="<?php echo($column_width);?>%"><?php if(strlen($Value2) > $chars){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value2,0,$chars));?><span><?php echo($Value2);?></span></a>
              <?php }else{echo($Value2);}?></td>
            <td width="<?php echo($column_width);?>%"><?php if(strlen($Value3) > $chars){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value3,0,$chars));?><span><?php echo($Value3);?></span></a>
              <?php }else{echo($Value3);}?></td>
            <td width="<?php echo($column_width);?>%"><?php if(strlen($Value4) > $chars){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value4,0,$chars));?><span><?php echo($Value4);?></span></a>
              <?php }else{echo($Value4);}?></td>
            
            
            
            <td width="<?php echo($column_width);?>%"><?php if(strlen($Value5) > $chars){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value5,0,$chars ));?><span><?php echo($Value5);?></span></a>
              <?php }else{echo($Value5);}?></td>
              
              
              <?php
              
			 if($Value6 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value6) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value6,0,$chars ));?><span><?php echo($Value6);?></span></a>
              <?php }else{echo($Value6);}?></td>
              <?php
			}else if($Value6 == "" && $V6 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
               <?php
              
			 if($Value7 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value7) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value7,0,$chars ));?><span><?php echo($Value7);?></span></a>
              <?php }else{echo($Value7);}?></td>
               <?php
			}else if($Value7 == "" && $V7 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value8 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value8) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value8,0,$chars ));?><span><?php echo($Value8);?></span></a>
              <?php }else{echo($Value8);}?></td>
                <?php
			}else if($Value8 == "" && $V8 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value9 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value9) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value9,0,$chars ));?><span><?php echo($Value9);?></span></a>
              <?php }else{echo($Value9);}?></td>
               <?php
			}else if($Value9 == "" && $V9 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value10 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value10) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value10,0,$chars ));?><span><?php echo($Value10);?></span></a>
              <?php }else{echo($Value10);}?></td>
                <?php
			}else if($Value10 == "" && $V10 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
              
               <?php
              
			 if($Value11 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value11) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value11,0,$chars ));?><span><?php echo($Value11);?></span></a>
              <?php }else{echo($Value11);}?></td>
                <?php
			}else if($Value11 == "" && $V11 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value12 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value12) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value12,0,$chars ));?><span><?php echo($Value12);?></span></a>
              <?php }else{echo($Value12);}?></td>
                <?php
			}else if($Value12 == "" && $V12 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value13 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value13) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value13,0,$chars ));?><span><?php echo($Value13);?></span></a>
              <?php }else{echo($Value13);}?></td>
                <?php
			}else if($Value13 == "" && $V13 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value14 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value14) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value14,0,$chars ));?><span><?php echo($Value14);?></span></a>
              <?php }else{echo($Value14);}?></td>
                <?php
			}else if($Value14 == "" && $V14 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
               <?php
              
			 if($Value15 != ""){
				?>
                <td width="<?php echo($column_width);?>%"><?php if(strlen($Value15) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value15,0,$chars ));?><span><?php echo($Value15);?></span></a>
              <?php }else{echo($Value15);}?></td>
                <?php
			}else if($Value15 == "" && $V15 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
              
              
              
              <?php
              
			  if($isFol == true){
				
		
				  for($r = 0; $r < ($nbr_par-5); $r++){
					echo('<td width="122"></td>'); 
					
				   }
			  }
			  
			  ?>
              
              
              
            <td width="22"><div align="left">
              <input type="checkbox" name="checkbox<?php echo($count_files);?>" id="checkbox<?php echo($count_files);?>" value="<?php echo(str_replace("//","/",($path_t."/".$file)));?>">
              <?php $count_files++;?>
            </div></td>
            <td width="120"><a href="javascript:deleteFile('deletefiles.php?hash=<?php echo($FileHash);?>&FilePath=<?php echo(str_replace("//","/",($path_t."/".$file)));?>&path=<?php echo($path_t);?>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','images/save.jpg',1)">
                <?php if($be4 == true){?>
                </a><a href="download_file.php?hash=<?php echo($FileHash);?>&path=<?php echo($path);?><?php echo($file);?>&filename=<?php echo($file);?>" onMouseOver="MM_swapImage('999','','images/view.jpg',1)" onMouseOut="MM_swapImgRestore()"> <img src="images/save1.jpg" alt="" name="Image4" width="25" height="18" border="0" ></a><a href="javascript:deleteFile('deletefiles.php?hash=<?php echo($FileHash);?>&FilePath=<?php echo(str_replace("//","/",(substr($FilePath,strlen("/var/www/icad_files/$CompanyId/archive/")-1,100))));?>&path=<?php echo($path_t);?>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','images/del1.jpg',1)">
                  <?php }?>
              </a> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','images/add.jpg',1)" onClick="MM_openBrWindow2('arkiv.php?CompanyId=<?php echo($CompanyId);?>&File=<?php echo($file);?>&FileHash=<?php echo($FileHash);?>&FilePath=<?php echo(str_replace("//","/",($path."/".$file)));?>','win','scrollbars=yes,width=400,height=600')"> </a></td>
          </tr>
          <?php 
					$row_count++;
				  	}
				    } 
					?>
        </table>
        <?php
					if($x == 0){
 if($language == 2 || $language == 3){
						echo("<br> <span class='style8'> -- No Files are uploaded yet!</span>");
}else{
						echo("<br> <span class='style8'> -- &Auml;nnu &auml;r inga filer uppladdade i den h&auml;r mappen!</span>");
}
					}
					
				}else{
					?>
        <br>
        S&ouml;kresultat:<br>
        <?php 
				
				
				
			
				
				$cri1 = $_POST['criteria1'];
				$cri2 = $_POST['criteria2'];
				$cri3 = $_POST['criteria3'];
				$cri4 = $_POST['criteria4'];
				
				
				// Get parameters
				$Parameter1 = "";
				$Parameter2 = "";
				$Parameter3 = "";
				$Parameter4 = "";
				$Parameter5 = "";
				$Parameter6 = "";
				$Parameter7 = "";
				$Parameter8 = "";
				$Parameter9 = "";
				$Parameter10 = "";
				$Parameter11 = "";
				$Parameter12 = "";
				$Parameter13 = "";
				$Parameter14 = "";
				$Parameter15 = "";
				
			    $sql = "SELECT * FROM ICADARCHIVEParameters, ICADARCHIVEGroups WHERE ICADARCHIVEParameters.ParameterGroupId = ICADARCHIVEGroups.GroupId and ICADARCHIVEParameters.ShowAsColumn = 1 and ICADARCHIVEGroups.CompanyId = $CompanyId order by ICADARCHIVEParameters.ParameterId";
	 
	 
	 
	
			
				$result = mysql_query($sql);
				$x = 1;
					while ($row = mysql_fetch_assoc($result)){ 
					if($x == 1){
						$Parameter1 = $row["ParameterName"];
					}else if($x == 2){
						$Parameter2 = $row["ParameterName"];
					}else if($x == 3){
						$Parameter3 = $row["ParameterName"];
					}
					else if($x == 4){
						$Parameter4 = $row["ParameterName"];
					}
					else if($x == 5){
						$Parameter5 = $row["ParameterName"];
					}
					else if($x == 6){
						$Parameter6 = $row["ParameterName"];
					}
					else if($x == 7){
						$Parameter7 = $row["ParameterName"];
					}
					else if($x == 8){
						$Parameter8 = $row["ParameterName"];
					}
					else if($x == 9){
						$Parameter9 = $row["ParameterName"];
					}
					else if($x == 10){
						$Parameter10 = $row["ParameterName"];
					}else if($x == 11){
						$Parameter11 = $row["ParameterName"];
					}else if($x == 12){
						$Parameter12 = $row["ParameterName"];
					}else if($x == 13){
						$Parameter13 = $row["ParameterName"];
					}else if($x == 14){
						$Parameter14 = $row["ParameterName"];
					}else if($x == 15){
						$Parameter15 = $row["ParameterName"];
					}
					
					$x++;
						
					$ParameterGroupId = $row["ParameterGroupId"];
				}
				
				
				
				
				echo($path_t);
				
				?>
        <br>
        <table width="<?php echo($table_width);?>" border="0" align="center" cellpadding="0" cellspacing="0" class="sortable">
          <tr class="text">
            <td width="180"><?php echo($a2);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter1);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter2);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter3);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter4);?></td>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter5);?></td>
            
               
            <?php
            
			if($Parameter6 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter6);?></td>
            <?php	
				}
			?>
			
            
              <?php
            
			if($Parameter7 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter7);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter8 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter8);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter9 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter9);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter10 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter10);?></td>
            <?php	
				}
			?>
			
              <?php
            
			if($Parameter11 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter11);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter12 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter12);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter13 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter13);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter14 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter14);?></td>
            <?php	
				}
			?>
			
            
               <?php
            
			if($Parameter15 != ""){?>
            <td width="<?php echo($column_width);?>%"><?php echo($Parameter15);?></td>
            <?php	
				}
			?>
			
            
            
		
            
            
            <td width="20"><input type="checkbox" name="check1" id="check1" onClick="checkAll(this.checked)"></td>
            <td width="<?php echo($column_width);?>%">Markera alla</td>
          </tr>
          <?php 
				  
				  	function AddPath($PathToCreate){
						$iBreak = 0;
						$iBreak = strrpos($PathToCreate, "/");
						if($iBreak !== FALSE){
							$Parent = substr($PathToCreate, 0, $iBreak);
							if(!@chdir($Parent)){
								AddPath($Parent);
							}
						}
					
						if(!@chdir($PathToCreate)){
							mkdir($PathToCreate);
						}
					}
					
					


$row_count = 0;
				  
				   $path = "/var/www/icad_files/$CompanyId/archive/".$path_t."/";
				  
				   
				   
				
				  
				  
				   if($_GET['action'] == "search"){
					   if($_POST['criteria'] == "1"){
					  		 $sql_extra = "and ICADARCHIVEParameterData.Value like '%".$_POST['keyword']."%'  "; 
					   }else if($_POST['criteria'] == "2"){
						   	 $sql_extra = "and ICADARCHIVEParameterData.Value = '".$_POST['keyword']."' "; 
						 }else if($_POST['criteria'] == "3"){
							  $sql_extra = "and ICADARCHIVEParameterData.Filename like '%".$_POST['keyword']."%'  "; 
						   }
						   
						   
						   //R&auml;ttigheter
						    $sql_extra2 = "";
						    $result2 = mysql_query("SELECT * FROM ICADARCHIVERights WHERE SystemUserID = 2300"."");
						   $x = 0;
						    while ($row2 = mysql_fetch_assoc($result2)){ 
							
							if($x == 0){
								$sql_extra2 .= " and (";
								}else{
									$sql_extra2 .= " or ";
									}
							 $sql_extra2 .= " ICADARCHIVEParameterData.FilePath like '".$row2['Path']."%' ";
							$x++;
							}
							
							if( $sql_extra2 == ""){
								 $sql_extra2 = " and ( ICADARCHIVEParameterData.FilePath = '@' ";
								}
								$sql_extra2 .= ")";
								
			
								
							///////////////////////////
						   
						  // $sql = "SELECT * FROM  ICADARCHIVEParameterData, ICADARCHIVEParameters, ICADARCHIVEGroups  WHERE ICADARCHIVEGroups.GroupId = ICADARCHIVEParameters.ParameterGroupId and ICADARCHIVEParameters.ParameterId = ICADARCHIVEParameterData.ParameterId and ICADARCHIVEGroups.CompanyId = $CompanyId and ( $sql_extra or ICADARCHIVEParameterData.Filename like '%".$_POST['keyword']."%') $sql_extra2 group by ICADARCHIVEParameterData.FileHash order by ICADARCHIVEParameterData.Filename ";
						  
						   
						   $sql = "SELECT * FROM  ICADARCHIVEParameterData, ICADARCHIVEParameters, ICADARCHIVEGroups  WHERE ICADARCHIVEGroups.GroupId = ICADARCHIVEParameters.ParameterGroupId and ICADARCHIVEParameters.ParameterId = ICADARCHIVEParameterData.ParameterId and ICADARCHIVEGroups.CompanyId = $CompanyId $sql_extra $sql_extra2 group by ICADARCHIVEParameterData.FileHash order by ICADARCHIVEParameterData.Filename ";
						   
						
						 
						   
				
						    $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								  $hits .= $FileHash."-";
								 
							  }
							  
							  
						   
				   }else{
					   
				
				$sql_extra = " ";
				
				
					/*  	

					   
					    
					  		 $sql_extra .= " or ICADARCHIVEParameterData.ParameterId = ". $cri2 ." "; 

					   
					   
					  		 $sql_extra .= " or ICADARCHIVEParameterData.ParameterId = ". $cri3." )"; 
*/
					   
					 
					    //R&auml;ttigheter
						    $sql_extra2 = "";
						    $result2 = mysql_query("SELECT * FROM ICADARCHIVERights WHERE SystemUserID = 2300"."");
						   $x = 0;
						    while ($row2 = mysql_fetch_assoc($result2)){ 
							
							if($x == 0){
								$sql_extra2 .= " and (";
								}else{
									$sql_extra2 .= " or ";
									}
							 $sql_extra2 .= " ICADARCHIVEParameterData.FilePath like '".$row2['Path']."%' ";
							$x++;
							}
							
							if( $sql_extra2 == ""){
								 $sql_extra2 = " and (ICADARCHIVEParameterData.FilePath = '@' ";
								}
								$sql_extra2 .= ")";
								///
					  
					
						  $sql = "SELECT * FROM ICADARCHIVEParameterData, ICADARCHIVEParameters, ICADARCHIVEGroups  WHERE ICADARCHIVEGroups.GroupId = ICADARCHIVEParameters.ParameterGroupId and ICADARCHIVEParameters.ParameterId = ICADARCHIVEParameterData.ParameterId and ICADARCHIVEGroups.CompanyId = $CompanyId  and (ICADARCHIVEParameterData.ParameterId = ".$cri1 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword1']."%')  $sql_extra2 group by ICADARCHIVEParameterData.FileHash "; 
						  
						  $hits = "";
						  $hits2 = "";
						  if($cri3 == "0" && $cri2 != "0"  && $cri4 == "0"){
							  $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri2 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword2']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits .= $FileHash3."-";
								  }
							  }
							  
							 
						  }else if($cri3 == "0" && $cri2 == "0" && $cri4 == "0"){
							   $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash2 = $row2['FileHash'];
								  $hits .= $FileHash2."-";
							  }
							 
							  
					       }else if($cri3 != "0" && $cri2 == "0" && $cri4 == "0"){
							   $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri3 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword3']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits .= $FileHash3."-";
								  }
							  }
							  
							  
					       }else if($cri3 == "0" && $cri2 == "0" && $cri4 != "0"){
							   $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri4 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword4']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits .= $FileHash3."-";
								  }
							  }
							  
							  
					      }else if($cri3 != "0" && $cri2 != "0" && $cri4 == "0"){
							 
							 
							  $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri2 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword2']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits2 .= $FileHash3."-";
								  }
							  }
							  
							    $arr = split("-",$hits2);
								$sql = "SELECT * FROM ICADARCHIVEParameterData WHERE (FileHash = '";
								foreach ($arr as &$value) {
									$sql .= $value ."' or FileHash = '";
								}
								$sql .= "') and  ParameterId = ".$cri3 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword3']."%' group by FileHash";
							   
							  
							    $result4 = mysql_query($sql);
								  while ($row4 = mysql_fetch_assoc($result4)){ 
										 $FileHash4 = $row4['FileHash'];
										  $hits .= $FileHash4."-";
								  }
					
						} else if($cri3 != "0" && $cri2 == "0" && $cri4 != "0"){
							 
							 
							  $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri4 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword4']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits2 .= $FileHash3."-";
								  }
							  }
							  
							    $arr = split("-",$hits2);
								$sql = "SELECT * FROM ICADARCHIVEParameterData WHERE (FileHash = '";
								foreach ($arr as &$value) {
									$sql .= $value ."' or FileHash = '";
								}
								$sql .= "') and  ParameterId = ".$cri3 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword3']."%' group by FileHash";
							   
							  
							    $result4 = mysql_query($sql);
								  while ($row4 = mysql_fetch_assoc($result4)){ 
										 $FileHash4 = $row4['FileHash'];
										  $hits .= $FileHash4."-";
								  }
					
						}
	
					  
				    else if($cri3 == "0" && $cri2 != "0" && $cri4 != "0"){
							 
							 
							  $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri4 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword4']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits2 .= $FileHash3."-";
								  }
							  }
							  
							    $arr = split("-",$hits2);
								$sql = "SELECT * FROM ICADARCHIVEParameterData WHERE (FileHash = '";
								foreach ($arr as &$value) {
									$sql .= $value ."' or FileHash = '";
								}
								$sql .= "') and  ParameterId = ".$cri2 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword2']."%' group by FileHash";
							   
							  
							    $result4 = mysql_query($sql);
								  while ($row4 = mysql_fetch_assoc($result4)){ 
										 $FileHash4 = $row4['FileHash'];
										  $hits .= $FileHash4."-";
								  }
					
						}
	
					  
				       else if($cri3 != "0" && $cri2 != "0" && $cri4 != "0"){
							 
							 
							  $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri4 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword4']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits2 .= $FileHash3."-";
								  }
							  }
							  
							    $result2 = mysql_query($sql);
							  while ($row2 = mysql_fetch_assoc($result2)){ 
								 $FileHash = $row2['FileHash'];
								 
								  $sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '". $FileHash ."' and ParameterId = ".$cri3 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword3']."%'";
								  
								 // echo($sql."<br>");
								  $result3 = mysql_query($sql);
								  while ($row3 = mysql_fetch_assoc($result3)){ 
										 $FileHash3 = $row3['FileHash'];
										  $hits2 .= $FileHash3."-";
								  }
							  }
							  
							    $arr = split("-",$hits2);
								$sql = "SELECT * FROM ICADARCHIVEParameterData WHERE (FileHash = '";
								foreach ($arr as &$value) {
									$sql .= $value ."' or FileHash = '";
								}
								$sql .= "') and  ParameterId = ".$cri2 ." and ICADARCHIVEParameterData.Value like '%".$_POST['keyword2']."%' group by FileHash";
							   
							  
							    $result4 = mysql_query($sql);
								  while ($row4 = mysql_fetch_assoc($result4)){ 
										 $FileHash4 = $row4['FileHash'];
										  $hits .= $FileHash4."-";
								  }
					
						}
	
					  
				   }
				   
				   
				  
				  	  
	 			$arr = split("-",$hits);
				$sql = "SELECT * FROM ICADARCHIVEParameterData WHERE FileHash = '";
				foreach ($arr as &$value) {
					if( $value != ''){
   				 	$sql .= $value ."' or FileHash = '";
					}
				}
				$sql .= "' group by FileHash order by Filename";
				
			
		
	
				$result2 = mysql_query($sql);
				 $x = 0;
				   $count_files = 0;
				   	while ($row2 = mysql_fetch_assoc($result2)){ 
				  
				 	$FilePath = $row2['FilePath'];
					$file = $row2['Filename'];
					
					//echo($file);
					//$tmp = "/var/www/icad_files/$CompanyId/archive/";
					
					//$FilePath = substr($FilePath,strlen($tmp),200);
					
				    $x++;
					$FileHash = md5(str_replace("//","/",($FilePath)));
					
					
				   if(!is_file($FilePath)){
				   		
						if(!is_dir($FilePath)){
							continue;
							}
						
					//	$size = round(GetFolderSize($FilePath)/(1024),2)." Kb";
					//	$nbr = count_files_recursive($FilePath);
						
						$filestr = "?path=".$FilePath;
						$ico = "folder.gif";
						
				   }else {
				    	//$size  = round(filesize($file)/(1024),2) . " Kb";
					//	$nbr = "";
						
						$filestr  = "view_file.php?hash=$FileHash";
						
						
						$ico = "view1.jpg";
				   }
				   
				   	
				    $sql = "SELECT * FROM  ICADARCHIVEParameterData, ICADARCHIVEParameters  WHERE ICADARCHIVEParameters.ParameterId = ICADARCHIVEParameterData.ParameterId and FileHash  = '$FileHash' and ICADARCHIVEParameters.ShowAsColumn = 1 and ParameterGroupId = $ParameterGroupId order by ICADARCHIVEParameters.ParameterId";
					
							$result = mysql_query($sql);
					
					
					
					
					$Value1 = "";
					$Value2 = "";
					$Value3 = "";
					$Value4 = "";
					$Value5 = "";
					$Value6 = "";
					$Value7 = "";
					$Value8 = "";
					$Value9 = "";
					$Value10 = "";
					$Value11 = "";
					$Value12 = "";
					$Value13 = "";
					$Value14 = "";
					$Value15 = "";
						$V6 = false;
				$V7 = false;
				$V8 = false;
				$V9 = false;
				$V10 = false;
				$V11 = false;
				$V12 = false;
				$V13 = false;
				$V14 = false;
				$V15 = false;
					
						$x = 1;
					
					while ($row = mysql_fetch_assoc($result)){ 
					if($x == 1){
						$Value1 = $row["Value"];
					}else if($x == 2){
						$Value2 = $row["Value"];
					}else if($x == 3){
						$Value3 = $row["Value"];
					}else if($x == 4){
						$Value4 = $row["Value"];
					
						}else if($x == 5){
						$Value5 = $row["Value"];
					
						}else if($x == 6){
						$Value6 = $row["Value"];
					$V6 = true;
						}else if($x == 7){
						$Value7 = $row["Value"];
					$V7 = true;
						}else if($x == 8){
						$Value8 = $row["Value"];
					$V8 = true;
						}else if($x == 9){
						$Value9 = $row["Value"];
						$V9 = true;
					}else if($x == 10){
						$Value10 = $row["Value"];
						$V10 = true;
					}else if($x == 11){
						$Value11 = $row["Value"];
						$V11 = true;
					}else if($x == 12){
						$Value12 = $row["Value"];
						$V12 = true;
					}else if($x == 13){
						$Value13 = $row["Value"];
						$V13 = true;
					}else if($x == 14){
						$Value14 = $row["Value"];
						$V14 = true;
					}else {
						$Value15 = $row["Value"];
						$V15 = true;
					}
					
				$x++;
					
					$FP = $row["FilePath"];
					$t1 = "/var/www/icad_files/$CompanyId/archive";
					
					$vfile = substr($FP,strlen($t1)+1,1000); 
					
					
				
				}
				
				
				
					
				  ?>
          <tr class="textthin" onMouseover="row_color(1,'row<?php echo($row_count);?>');" onMouseout="row_color(2,'row<?php echo($row_count);?>');" id="row<?php echo($row_count);?>" >
            <td width="179"><?php
						  
					  if($Value1== "Doc" || $Value2 == "Doc"|| $Value3 == "Doc"|| $Value4== "Doc" || $Value5 == "Doc"  || $Value6 == "Doc"  || $Value7 == "Doc"  || $Value8 == "Doc"  || $Value9 == "Doc"  || $Value10 == "Doc" || $Value11 == "Doc" || $Value12 == "Doc" || $Value13 == "Doc" || $Value14 == "Doc" || $Value15 == "Doc"){
						$filestr  = "download_file.php?hash=$FileHash"; ?>
              <a href="<?php echo($filestr);?>">
                <?php
						
						}else{
						?>
                <a href="#<?php echo($file);?>" onClick="MM_openBrWindow2('viewer/?file=<?php echo(str_replace("//","/",($vfile)));?>&FileHash=<?php echo($FileHash);?>','viewer','resizable=yes, width=1200, height=800, screenX=20, screenY=10, top=10,left=20');row_color(3,'row<?php echo($row_count);?>');">
                <?php 
					   
						}?>
                <img src="images/<?php echo($ico);?>" alt="" border="0" align="absmiddle"></a>&nbsp;&nbsp;
              <?php if($ico == "view1.jpg"){?>
              <?php
						  
					  if($Value1== "Doc" || $Value2 == "Doc"|| $Value3 == "Doc"|| $Value4== "Doc" || $Value5 == "Doc"  || $Value6 == "Doc"  || $Value7 == "Doc"  || $Value8 == "Doc"  || $Value9 == "Doc"  || $Value10 == "Doc" || $Value11 == "Doc" || $Value12 == "Doc" || $Value13 == "Doc" || $Value14 == "Doc" || $Value15 == "Doc"){
						$filestr  = "download_file.php?hash=$FileHash"; ?>
              <a href="<?php echo($filestr);?>">
                <?php
						
						}else{
						?>
                <a href="#<?php echo($file);?>" onClick="MM_openBrWindow2('viewer/?file=<?php echo(str_replace("//","/",($vfile)));?>&FileHash=<?php echo($FileHash);?>','viewer','resizable=yes, width=1200, height=800, screenX=20, screenY=10, top=10,left=20');row_color(3,'row<?php echo($row_count);?>');" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'">
                <?php 
					  
						}
					  
					  }else{?>
                <a href="<?php echo($filestr);?>" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'">
                <?php }?>
                <?php if(strlen($file) > 20){?>
                <?php echo(substr($file,0,20));?>...<span><?php echo($file);?></span>
                <?php }else{echo($file);}?>
              </a> &nbsp;&nbsp; </td>
            <td width="88"><?php if(strlen($Value1) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value1,0,$chars )."...");?><span><?php echo($Value1);?></span></a>
              <?php }else{echo($Value1);}?></td>
            <td width="90"><?php if(strlen($Value2) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value2,0,$chars )."...");?><span><?php echo($Value2);?></span></a>
              <?php }else{echo($Value2);}?></td>
            <td width="81"><?php if(strlen($Value3) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value3,0,$chars )."...");?><span><?php echo($Value3);?></span></a>
              <?php }else{echo($Value3);}?></td>
            <td width="82"><?php if(strlen($Value4) > $chars ){?>
              <a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'"><?php echo(substr($Value4,0,$chars )."...");?><span><?php echo($Value4);?></span></a>
              <?php }else{echo($Value4);}?></td>
            <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value5) > $chars ){?>
              <?php echo(substr($Value5,0,$chars )."...");?><span><?php echo($Value5);?></span>
              <?php }else{echo($Value5);}?>
            </a></td>
            
            
            
            
               <?php
              
			 if($Value6 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value6) > $chars ){?>
              <?php echo(substr($Value6,0,$chars )."...");?><span><?php echo($Value6);?></span>
              <?php }else{echo($Value6);}?>
            </a></td>
                
				
				
				<?php
			}else if($Value6 == "" && $V6 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
              
                    
               <?php
              
			 if($Value7 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value7) > $chars ){?>
              <?php echo(substr($Value7,0,$chars )."...");?><span><?php echo($Value7);?></span>
              <?php }else{echo($Value7);}?>
            </a></td>
                
				
				
				<?php
			}else if($Value7 == "" && $V7 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
              
                    
               <?php
              
			 if($Value8 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value8) > $chars ){?>
              <?php echo(substr($Value8,0,$chars )."...");?><span><?php echo($Value8);?></span>
              <?php }else{echo($Value8);}?>
            </a></td>
                
				
				
				<?php
			}else if($Value8 == "" && $V8 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
              
                    
               <?php
              
			 if($Value9 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value9) > $chars ){?>
              <?php echo(substr($Value9,0,$chars )."...");?><span><?php echo($Value9);?></span>
              <?php }else{echo($Value9);}?>
            </a></td>
                
				
				<?php
			}else if($Value9 == "" && $V9 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
            
            
                  
               <?php
              
			 if($Value10 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value10) > $chars ){?>
              <?php echo(substr($Value10,0,$chars )."...");?><span><?php echo($Value10);?></span>
              <?php }else{echo($Value10);}?>
            </a></td>
                
				
				<?php
			}else if($Value10 == "" && $V10 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
              
                 <?php
              
			 if($Value11 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value11) > $chars ){?>
              <?php echo(substr($Value11,0,$chars )."...");?><span><?php echo($Value11);?></span>
              <?php }else{echo($Value11);}?>
            </a></td>
                
				
				<?php
			}else if($Value11 == "" && $V11 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
            
             <?php
              
			 if($Value12 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value12) > $chars ){?>
              <?php echo(substr($Value12,0,$chars )."...");?><span><?php echo($Value12);?></span>
              <?php }else{echo($Value12);}?>
            </a></td>
                
				
				<?php
			}else if($Value12 == "" && $V12 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
            
             <?php
              
			 if($Value13 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value13) > $chars ){?>
              <?php echo(substr($Value13,0,$chars )."...");?><span><?php echo($Value13);?></span>
              <?php }else{echo($Value13);}?>
            </a></td>
                
				
				<?php
			}else if($Value13 == "" && $V13 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
            
             <?php
              
			 if($Value14 != ""){
				?>
                
                 <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value14) > $chars ){?>
              <?php echo(substr($Value14,0,$chars )."...");?><span><?php echo($Value14);?></span>
              <?php }else{echo($Value14);}?>
            </a></td>
                
				
				<?php
			}else if($Value14 == "" && $V14 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
            
             <?php
              
			 if($Value15 != ""){
				?>
                
              <td width="92"><a href="#" class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'" style="text-decoration:none">
              <?php if(strlen($Value15) > $chars ){?>
              <?php echo(substr($Value15,0,$chars )."...");?><span><?php echo($Value15);?></span>
              <?php }else{echo($Value15);}?>
              </a></td>
                
				
				<?php
			}else if($Value15 == "" && $V15 == true){
				echo('<td width="122"></td>');
				}
	
			  ?>
              
            
          
            
          
        
          
        
            
          
        
            
          
        
        
            
          
        
            
            
            
            <td width="20"><div align="left">
              <input type="checkbox" name="checkbox<?php echo($count_files);?>" id="checkbox<?php echo($count_files);?>" value="<?php echo(str_replace("//","/",(substr($FilePath,strlen("/var/www/icad_files/$CompanyId/archive/")-1,100))));?>">
              <?php $count_files++; ?>
            </div></td>
            <td width="91"><a href="javascript:deleteFile('deletefiles.php?hash=<?php echo($FileHash);?>&FilePath=<?php echo(str_replace("//","/",(substr($FilePath,strlen("/var/www/icad_files/$CompanyId/archive/")-1,100))));?>&path=<?php echo($path_t);?>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','images/del1.jpg',1)"> </a><a href="download_file.php?hash=<?php echo($FileHash);?>" onMouseOver="MM_swapImage('999','','images/view.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="images/save1.jpg" alt="" name="Image4" width="25" height="18" border="0" ></a><a href="javascript:deleteFile('deletefiles.php?hash=<?php echo($FileHash);?>&FilePath=<?php echo(str_replace("//","/",(substr($FilePath,strlen("/var/www/icad_files/$CompanyId/archive/")-1,100))));?>&path=<?php echo($path_t);?>');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','images/del1.jpg',1)"> </a><a href="javascript:lock('<?php echo($FileHash);?>');"></a></td>
          </tr>
          <?php 
		 $row_count++;
		  }
				    } 
					
	
					
				
					?>
        </table>
        <input name="count_files" type="hidden" value="<?php echo($count_files);?>">
        <br>
        <br>
      </form>
      <br></td>
  </tr>
</table>
<p>&nbsp;</p><?php }?>

Youez - 2016 - github.com/yon3zu
LinuXploit