Viewing File: /people/testlab/www/testlab.com.pl/script/s781.php

<?
$tresc=$row['tresc'];

$db=new DBConnect();
$sql="select * from ustawienia where typ='s".$_GET['page']."'";
$db->query($sql);
$row=$db->fetchrow();
$params=explode(";",$row['text']);
if ($params[5]=='') $params[5]='false'; 
if ($params[5]=='false') echo "".$tresc."<BR>";
?>

<div id=pliki >
<?
if ($params[0]>1) echo "<table id=polozenie_plikow ><tr><td></td>";
else echo "<table style='text-align:left;'><tr>";

  	$directory_handler = opendir("s".$_GET['page']);
										$pattern = "([0-9a-zA-Z]{1,})";
										while (($filename = readdir($directory_handler)) != false)
										{
											if (preg_match($pattern,$filename))
												$files[]=basename($filename);
											
										}
										
										$quantity = count($files);
										if ($quantity>0) sort($files);

										$sql="select max(pozycja) as max from `files` where `skrypt_id`='".$_GET['page']."';";
										$db->query($sql);
										$row=$db->fetchrow();
										$pozycja = $row['max'];
										
										for ($i=0; $i<$quantity;$i++)
										{
										$pozycja++;
										
										$sql="INSERT INTO `files` (`id`, `plik`, `nazwa`, `opis`, `miniaturka`, `pozycja`, `skrypt_id`) VALUES (NULL, '".$files[$i]."', '', '', '', '$pozycja', '".$_GET['page']."');";
										$db->query($sql);
										}
										
										
										$sql="select * from `files` where `skrypt_id`='".$_GET['page']."' order by pozycja;";
										$db->query($sql);
										if ($db->numrows()==0) echo "<td></td>";
										
										
										$j=0;
										while ($row=$db->fetchrow())
										{
										$j++;
                                        
											$dest_file = "s".$_GET['page']."/".$row['plik'];
											$typ = end(explode(".",$dest_file));
											if ($row['nazwa']!='') $nazwa=$row['nazwa']; else $nazwa='Plik '.strtoupper($typ);
                                            
											if ($row['miniaturka']=='') //standartowe miniatury
											{
											$image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=file.png";
											if (($typ=='gif')||($typ=='jpg')||($typ=='png')) $image_path="?page=".$_GET['page']."&amp;dir=s".$_GET['page']."&amp;img=".$row['plik'];
											if (($typ=='flv')||($typ=='wmv')||($typ=='rmvb')||($typ=='mov')) $image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=movie.png";
											if (($typ=='mp3')||($typ=='wav')) $image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=sound.png";
											if (($typ=='rar')||($typ=='zip')) $image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=archive.png";
											if (($typ=='csv')||($typ=='xls')) $image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=excel.png";
											if (($typ=='doc')) $image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=word.png";
											if (($typ=='pdf')) $image_path="?page=".$_GET['page']."&amp;dir=img&amp;img=pdf.png";
											}
											else //miniatury usera
											{
											$image_path="?page=".$_GET['page']."&amp;dir=upload&amp;img=".$row['miniaturka'];
											}
											
											if ($row['opis']!='') $opis=$row['opis']."<br>"; else $opis="";
											
											if (($typ=='gif')||($typ=='jpg')||($typ=='png')||($typ=='flv')||($typ=='wmv')||($typ=='rmvb')||($typ=='mov')||($typ=='mp3')||($typ=='wav'))
											{$player = "id=\"mb".$j."\" class=\"mb\""; }
											else $player="target=blank";
											
											
											//$size=round(filesize("../".$dest_file)/1024);
											if ($params[0]>1)
											{
											echo "<td style='text-align:center;padding:5px;width:".$params[1]."px' valign=top>";
											if ($params[2]=='true') if ($params[4]=='true') echo "$nazwa<br>"; else echo "<a href=\"".$dest_file."\" $player title=\"$nazwa\">$nazwa</a><br>";
											if ($params[4]=='true') echo"<a href=\"".$dest_file."\" $player title=\"$nazwa\"><img src=\"panel/image.php$image_path\" border=0 alt='".str_replace("'","",$row['nazwa'])."'></a> <br>";
											if ($params[3]=='true') echo "$opis";
											
										    echo "<div class=\"multiBoxDesc mb".$j."\">$opis</div></td>";	
											}
											else
											{
											if ($params[4]=='true') 
											if ($params[2]=='true')
											echo"<td style='text-align:center'><img src=\"panel/image.php$image_path\" border=0 alt='".str_replace("'","",$row['nazwa'])."'></td>";
											else
											echo"<td style='text-align:center'><a href=\"".$dest_file."\" $player title=\"$nazwa\"><img src=\"panel/image.php$image_path\" border=0 style='margin-right:10px;' alt='".str_replace("'","",$row['nazwa'])."'></a></td>";
											
											echo "<td style='text-align:justify'>";
											if ($params[2]=='true') echo "<a href=\"".$dest_file."\" $player title=\"$nazwa\">$nazwa</a><br>";
											if ($params[3]=='true') echo "$opis";
											
										    echo "<div class=\"multiBoxDesc mb".$j."\">$opis</div></td>";	
											}
										  
										if ($j%$params[0]==0) 
										{
										if ($params[0]>1) echo "</tr><tr><td></td>";
										else  echo "</tr><tr>";
										}								
										}			
  
  ?>
  </tr>
 </table>
</div>

<?if ($params[5]=='true') echo "$tresc";?>
Back to Directory File Manager