View file index.php

File size: 15.09Kb
<?php
/////////////////////////////////////////////////////////////////////////
list($generic_msec,$generic_sec)=explode(chr('32'),microtime());/////////
$generic_time=$generic_sec+$generic_msec;////////////////////////////////
/////////////////////////////////////////////////////////////////////////
session_save_path('___sess___');
error_reporting(0);
/////@include $_SERVER['DOCUMENT_ROOT'].'/stat/log.php';
include 'connect.php';
include 'functions.php';
include 'config.php';
$get_pass=trim(@$_GET['password']);
if ($get_pass==$pass)
{output_add_rewrite_var('password', $get_pass);}
header("Content-type: text/html; charset=utf-8");
header("Cache-Control: no-cache");
$p=valid_number(@$_GET['p']);



echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<title>'.$title.'</title>
'.$css.'
</head><body><div align="center">'.$logo.'</div><div class="rekl">'.$reklama.''.$banner_top.'</div>
<div class="zag" align="center">';
if (isset($_GET['f']))
	{
		$res=mysql_query("SELECT * FROM `category` WHERE `id`='$p' LIMIT 1");
			if (!mysql_num_rows($res))
				{
					echo '<div class="c" align="center">Ошибка! страница не найдена!</div>';
				}
				else
					{
///--------------------------------------------------------------------------------------///
session_id(substr(str_shuffle('12345678900987654321543216789009876123456'),0,11));
session_start();
$_SESSION['ip']=$_SERVER['REMOTE_ADDR'];
$_SESSION['ua']=$_SERVER['HTTP_USER_AGENT'];
///--------------------------------------------------------------------------------------///
						$arr = mysql_fetch_assoc($res);
						$dec=urldecode($arr['array']);
						$dec=unserialize($dec);
						$f=valid_number(@$_GET['f']);
						echo (!isset($dec[$f])) ? exit('Ололо exit();'):'';
						$f_e=pathinfo($dec[$f]);
						$ext=$f_e['extension'];
						$st=@filesize($dec[$f]);
						$com_count=mysql_result(mysql_query("SELECT count(*) FROM `comment`  WHERE `from`='$dec[$f]'"),0);
						$decr=mysql_query("SELECT * FROM `description` WHERE `from`='$dec[$f]' LIMIT 1");
							if (!mysql_num_rows($decr))
								{
									$errf='Описание: Отсутствует.<br/>';
								}
								else
									{
										$err = mysql_fetch_assoc($decr);
										$errf='Описание: '.$err['description'].'<br/>';
									}
									if ($ext=='gif' or $ext=='jpg' or $ext=='png' or $ext=='GIF' or $ext=='JPG' or $ext=='PNG')
										{
											$media_type=1;
											echo 'Изображение';
										}
										elseif ($ext=='3gp')
											{
												$media_type=2;
												echo '3gp видео';
											}
											elseif ($ext=='jar')
												{
													$media_type=3;
													echo 'Java игры';
												}
												elseif ($ext=='mp3')
													{
														$media_type=4;
														echo 'Mузыка mp3';
													}
													elseif ($ext=='txt')
														{
															$media_type=5;
															echo 'Библиотека';
														}
														elseif ($ext=='nth')
															{
																$media_type=6;
																echo 'Темы Nokia';
															}
															elseif ($ext=='thm')
																{
																	$media_type=7;
																	echo 'Темы Sony Ericsson';
																}
																else 
																	{
																		echo 'Другие файлы';
																	}
						echo ' -&gt; '.$arr['name'].' -&gt; '.basename($dec[$f]).'</div>
						<div class="c">Файл &#187; '.basename($dec[$f]).'<br/>
						Размер файла &#187 '.round(($st/1024),2).' Кб<br/>
						'.$errf.'
						';
																	if ($get_pass==$pass)
																		{
																			echo '<b>[!]</b><a href="'.$folder.'/_X_admin_X_/?p=4&amp;c='.$p.'&amp;f='.$f.'">Редактировать</a><b>[!]</b><br/>';
																		}
						switch ($media_type)
						{
							case '1':
///------------------------------------------Изображения-----------------------------------------------------///
$info=getimagesize($dec[$f]);
$w_or=$info[0];
$h_or=$info[1];
echo '<img src="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=101&amp;h=80"/><br/>
Скачать&#187; <a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">Оригинал['.$info[0].'X'.$info[1].']</a><br/>
<a href="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=128&amp;h=128">Другой[128x128]</a><br/>
<a href="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=120&amp;h=160">Другой[120x160]</a><br/>
<a href="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=132&amp;h=176">Другой[132x176]</a><br/>
<a href="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=176&amp;h=220">Другой[176x220]</a><br/>
<a href="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=176&amp;h=144">Другой[176х144]</a><br/>
<a href="imgprev.php?p='.$p.'&amp;f='.$f.'&amp;w=240&amp;h=320">Другой[240x320]</a><br/>
Выбрать свой:
<form method="get" action="imgprev.php">
<input type="hidden" name="p" value="'.$p.'"/>
<input type="hidden" name="f" value="'.$f.'"/>
Ширина (640 max)<br/>
<input type="text" name="w" maxlength="3" size="3" style="-wap-input-format:\'3N\'"/><br/>
Высота (480 max)<br/>
<input type="text" name="h" maxlength="3" size="3" style="-wap-input-format:\'3N\'"/><br/>
<input type="submit" value="Скачать"/>
</form>
';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case '2':
///---------------------------------------------------Видео-----------------------------------------------------///
$screen='screen/'.basename($dec[$f]);
if(!is_file($screen.'.gif'))
{
if(!is_file($screen.'.jpg'))
{
	 if (!class_exists(ffmpeg_movie))
	 {$src='[Нет скриншота]<br/>';}
		else
		{
		$file=$dec[$f];
		$mov = new ffmpeg_movie($file);
		$frame = 2;
		$w = $mov->GetFrameWidth(); 
		$h = $mov->GetFrameHeight();
		$ff_frame = $mov->getFrame($frame);
		$way=$_SERVER['DOCUMENT_ROOT'].$folder.'/screen/'.basename($dec[$f]).'.jpg';
		$gd_image = $ff_frame->toGDImage(); 
		ImageJpeg($gd_image,$way,70);
		$src='<img src="screen/'.basename($dec[$f]).'.jpg" alt="screen"/><br/>';
		}
}
else {$src='<img src="screen/'.basename($dec[$f]).'.jpg" alt="screen"/><br/>';}
}
else
{$src='<img src="screen/'.basename($dec[$f]).'.gif" alt="screen"/><br/>';}


echo ''.$src.'
Скачать&#187; <a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">'.basename($dec[$f]).'</a><br/>
';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case '3':
///---------------------------------------------------java------------------------------------------------------///

$screen='screen/'.basename($dec[$f]);
if(!is_file($screen.'.gif'))
{
if(!is_file($screen.'.jpg'))
{$src='[Нет скриншота]<br/>';}
else {$src='<img src="screen/'.basename($dec[$f]).'.jpg" alt="screen"/><br/>';}
}
else
{$src='<img src="screen/'.basename($dec[$f]).'.gif" alt="screen"/><br/>';}

echo ''.$src.'
Скачать&#187; <a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">'.basename($dec[$f]).'</a><br/>
';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case '4':
///----------------------------------------------------mp3------------------------------------------------------///
include 'Id.php';
$id3 = new MP3_Id();
$result = $id3->read($dec[$f]);
if (PEAR::isError($result) && $result->getCode() !== PEAR_MP3_ID_TNF) { 
die($result->getMessage() . "\n"); 
} 
$result = $id3->study(); 
if (PEAR::isError($result)) { 
die($result->getMessage() . "\n"); 
}
$mp3_n=iconv("windows-1251", "UTF-8", $id3->getTag('name'));
$mp3_i=iconv("windows-1251", "UTF-8", $id3->getTag('artists'));
$mp3_a=iconv("windows-1251", "UTF-8", $id3->getTag('album'));
$mp3_y=iconv("windows-1251", "UTF-8", $id3->getTag('year'));
$mp3_g=iconv("windows-1251", "UTF-8", $id3->getTag('genre'));
$mp3_t=iconv("windows-1251", "UTF-8", $id3->getTag('track'));
echo 'Файл '.@$filename.'<br/>
Битрейт '.@$id3->getTag('bitrate').'kB/s<br/>
Частота '.@$id3->getTag('frequency').' Hz<br/>
'.@$id3->getTag('mode').'<br/>
Длительность '.@$id3->getTag('length').'<br/>
Название: '.$mp3_n.'<br/> 
Исполнитель: '.$mp3_i.'<br/> 
Альбом: '.$mp3_a.'<br/> 
Год: '.$mp3_y.'<br/>
Жанр: '.$mp3_g.'<br/> 
Трэк: '.$mp3_t.'<br/>
Скачать&#187; <a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">'.basename($dec[$f]).'</a><br/>
';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case '5':
///----------------------------------------------------txt------------------------------------------------------///
echo 'Читать&#187;<a href="'.$folder.'/read.php?p='.$p.'&amp;f='.$f.'">'.basename($dec[$f]).'</a><br/>
Скачать&#187; <a href="'.str_replace($_SERVER['DOCUMENT_ROOT'].'/','',$dec[$f]).'">'.basename($dec[$f]).'</a><br/>
Скачать в ZIP&#187;<a href="'.$folder.'/zip.php?p='.$p.'&amp;f='.$f.'">'.basename($dec[$f]).'.zip</a><br/>';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case '6':
///----------------------------------------------Темы Nokia-----------------------------------------------------///
echo '<a href="nthprev.php?p='.$p.'&amp;f='.$f.'"><img src="nthprev.php?p='.$p.'&amp;f='.$f.'" alt="screen"/><br/>Скачать скриншот</a><br/>';
echo 'Скачать&#187; <a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">'.basename($dec[$f]).'</a><br/>
';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case '7':
///----------------------------------------Темы Sony Ericsson---------------------------------------------------///
echo '<a href="thmprev.php?p='.$p.'&amp;f='.$f.'"><img src="thmprev.php?p='.$p.'&amp;f='.$f.'" alt="screen"/><br/>Скачать скриншот</a><br/>';
echo 'Скачать&#187; <a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">'.basename($dec[$f]).'</a><br/>
';
///-------------------------------------------------------------------------------------------------------------///
							break;
							
							case $media_type:
///------------------------------------------defult-------------------------------------------------------------///
echo 'Скачать&#187;<a href="load.php?p='.$p.'&amp;f='.$f.'&amp;z='.session_id().'">'.basename($dec[$f]).'</a><br/>';
///-------------------------------------------------------------------------------------------------------------///
							break;
						}
						echo '<a href="c.php?p='.$p.'&amp;f='.$f.'">Комментарии</a>('.$com_count.')<br/>';
						if (isset($dec[($f-1)])){echo '<a href="'.$folder.'/?p='.$p.'&amp;f='.($f-1).'">&lt;&lt;&lt;Назад|</a>';}
						if (isset($dec[($f+1)])){echo '<a href="'.$folder.'/?p='.$p.'&amp;f='.($f+1).'">|Далее&gt;&gt;&gt;</a><br/>';}
						if (!isset($dec[($f+1)])){echo '<br/>';}
						echo '<a href="'.$folder.'/?p='.$p.'">Назад в '.$arr['name'].'</a>';
					}
	}
	else
		{
			$res2=mysql_query("SELECT * FROM `category` WHERE `id`='$p' LIMIT 1");///выборка категории
			if (!mysql_num_rows($res2) and $_GET['p']<>0)
				{
					echo 'Ошибка! страница не найдена!<br>';
				}
					else
						{
							while ($arr2 = mysql_fetch_assoc($res2))
								{
									if ($arr2['array']==''){$n=$arr2['name'];}
										else
											{
												$dec=urldecode($arr2['array']);
												$dec=unserialize($dec);///массив вложеные файлы
												$n=$arr2['name'];
											}
								}
							$res=mysql_query("SELECT * FROM `category` WHERE `from`='$p'");
								while ($arr = mysql_fetch_assoc($res))
									{
										$wr='&#187; <a href="?p='.$arr['id'].'">'.$arr['name'].'</a>';
										if ($arr['count']==0){}
										else {$wr.='('.$arr['count'].')';}
										$wr.='<br/>';
										$wa[]=$wr;///массив вложеные категории
									}
									if (isset($dec))
										{
											foreach ($dec as $k=>$v)
												{
													$wrn='<a href="'.$folder.'/?p='.$p.'&amp;f='.$k.'">'.basename($v).'</a><br/>';
													$www[]=$wrn;
												}
												if (isset($wa))
													{
														$new_array_print=array_merge($wa,$www);
													}
													else 
														{
															$new_array_print=$www;
														}
										}
										else
											{
												$new_array_print=$wa;
											}
											if ($_GET['p']==0)
												{
													echo 'Загрузки</div><div class="c">';
												}
												else 
													{
														echo 'Загрузки ['.$n.']</div><div class="c">';
													}
///-----------------------------------Постраничная навигация-----------------------------------///
					$s=valid_number(@$_GET['s']);
					$c_arr=@count($new_array_print);
					if ($s>($c_arr-1)){$s=0;}
					$total_p=@ceil($c_arr/$p_c);///количество страниц
					$first_record = $s;
					$last_record = @$first_record+$p_c;
					for ($i=@$first_record;$i<@$last_record;$i++)
					{
						print_r(@$new_array_print[$i]);
					}
						if (!isset($_GET['f']))
							{
								if ($s==0 and $c_arr>$s+$p_c){echo '<a href="'.$folder.'/?p='.$p.'&amp;s='.($s+$p_c).'">|Далее&gt;&gt;&gt;</a>';}
								elseif ($c_arr>$s+$p_c){echo '<a href="'.$folder.'/?p='.$p.'&amp;s='.($s-$p_c).'">&lt;&lt;&lt;Назад|</a><a href="'.$folder.'/?p='.$p.'&amp;s='.($s+$p_c).'">|Далее&gt;&gt;&gt;</a>';}
								elseif (($c_arr-$p_c)<$s and $s<>0){echo '<a href="'.$folder.'/?p='.$p.'&amp;s='.($s-$p_c).'">&lt;&lt;&lt;Назад|</a>';}
							}
///---------------------------------------------------------------------------------------------------///
							$p_id=valid_number($_GET['id']);
							$res=mysql_query("SELECT * FROM `partner` WHERE `id`='$p_id' LIMIT 1");
							$lnk_partner=(!mysql_num_rows($res))?'<a href="partner/" style="color: #ecffff">Сервис вапмастеру</a><br/>':'';
						}
		}
echo '<br/>'.$banner_foot.'</div><div class="kon" align="center">
<a href="'.$folder.'/" style="color: #ecffff">Загруз центр</a><br>
'.$lnk_partner.'
'.$back_link.''.$copy.'</div>
</body></html>';

///////////////////////////////////////////////////////////////////////////////
list($generic_newmsec,$generic_newsec)=explode(chr('32'),microtime());/////////
///////////////////////////////////////////////////////////////////////////////
echo '<!--'.round((($generic_newsec+$generic_newmsec)-$generic_time),'4').'-->';
echo '<!--© САРСУК 2010 LoBoK.ORG-->';
?>