View file katrinka.ru/admin/files.php

File size: 3.46Kb
<?php
	header("Content-type: text/html");;
?>
<html>
<head><title>хРТБЧМЕОЙЕ MIDI ЖБКМБНЙ</title></head>
<body>
<?php
  include '../wap/config.php';

  if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
    echo ("пЫЙВЛБ РПДЛМАЮЕОЙС Л вд!\n");
  };
	$res=pg_query($conn, "SET CLIENT_ENCODING TO 'KOI8';");
	$res=pg_query($conn, "select id,name_eng,name_rus from cat order by id;");
	$rows=pg_numrows($res);
	$enabled=1;
	if ($sortby=='') $sortby=4;

?>
<center><b>дПВБЧЙФШ НЕМПДЙА</b></center>
<form action="file_add.php" method=post>
<table bgcolor="f0f0f0">
<?php
print "<tr><td>бОЗМЙКУЛПЕ ОБЪЧБОЙЕ: </td><td><input type=text name=\"name_eng\" value=\"".$name_eng."\" size=60></td></tr>\n";
print "<tr><td>тХУУЛПЕ ОБЪЧБОЙЕ: </td><td><input type=text name=\"name_rus\" value=\"".$name_rus."\" size=60>&nbsp;<font size=1 face=arial>(оЕ ПВСЪБФЕМШОП)</font></td></tr>\n";
print "<tr><td>лБФЕЗПТЙС: </td><td><select name=\"category\" size=1>\n";
	for ($i=0; $i<$rows; $i++) {
		$catname=pg_result($res,$i,2);
		if ($catname=='') $catname=pg_result($res,$i,1);
		print "<option value=\"".pg_result($res,$i,0)."\">".$catname."</option>\n";
	}
print "</select></td></tr>\n";
print "<tr><td>рХФШ Л ЖБКМХ: </td><td><input type=text name=\"path\" value=\"".$path."\" size=60></td></tr>\n";
print "<tr><td></td><td><input type=checkbox name=\"enabled\" value=\"".$enabled."\" checked>&nbsp;рХВМЙЛПЧБФШ ЖБКМ</td></tr>\n";
?>
</table>
<input type=submit value="дПВБЧЙФШ">
&nbsp;&nbsp;
<input type=reset value="пЮЙУФЙФШ">
</form>
<center><b>уРЙУПЛ НЕМПДЙК Ч ВБЪЕ</b></center>
<table width="100%">
<tr align=center bgcolor="e0e0e0"><td>N</td><td>бОЗМЙКУЛПЕ ОБЪЧБОЙЕ</td><td>тХУУЛПЕ ОБЪЧБОЙЕ</td><td><a href="files.php" title="уПТФЙТПЧЛБ">лБФЕЗПТЙС</a></td><td>рХФШ</td><td><a href="files.php?sortby=6" title="уПТФЙТПЧЛБ">дПВБЧМЕО</a></td><td>рХВМЙЛХЕФУС</td><td><a href="files.php?sortby=8" title="уПТФЙТПЧЛБ">уЛБЮЙЧБОЙК</a></td></tr>

<?php
	$enab[0]='оЕФ';
	$enab[1]='дБ';
	switch ($sortby)
	{
		case 6:
			$res=pg_query($conn, "select midi.id,midi.name_eng,midi.name_rus,cat.name_eng,cat.name_rus,midi.path,midi.enabled,midi.adate,midi.dlcount from midi,cat where cat.id=midi.category order by midi.adate desc;");
			break;
		case 8:
			$res=pg_query($conn, "select midi.id,midi.name_eng,midi.name_rus,cat.name_eng,cat.name_rus,midi.path,midi.enabled,midi.adate,midi.dlcount from midi,cat where cat.id=midi.category order by midi.dlcount desc;");
			break;
		case 4:
		default:
			$res=pg_query($conn, "select midi.id,midi.name_eng,midi.name_rus,cat.name_eng,cat.name_rus,midi.path,midi.enabled,midi.adate,midi.dlcount from midi,cat where cat.id=midi.category order by midi.category,midi.name_eng;");
			break;
	}
	$rows=pg_numrows($res);
	for ($i=0; $i<$rows; $i++) {
		$catname=pg_result($res,$i,4);
		$path=pg_result($res,$i,5);
		if (stat('../WWW/'.$path)) {
			if (pg_result($res,$i,6)) $trcolor='f0f0f0';
			else $trcolor='c0c0ff';
		} else { 
			$trcolor='ffc0c0';
		}
		if ($catname=='') $catname=pg_result($res,$i,3);
		print "<tr align=center bgcolor=\"".$trcolor."\">".
			"<td><a title=\"тЕДБЛФЙТПЧБФШ ЙОЖПТНБГЙА ПВ ЬФПК НЕМПДЙЙ\" href=\"file_edit.php?id=".pg_result($res,$i,0)."\">".$i."</a></td><td>".
			pg_result($res,$i,1)."</td><td>".
			pg_result($res,$i,2)."</td><td>".$catname."</td><td>".
			$path."</td><td>".pg_result($res,$i,7)."</td><td>".
			$enab[pg_result($res,$i,6)]."</td><td>".pg_result($res,$i,8).
			"</td></tr>\n";
	}	
	pg_close($conn);
?>

</table>

</body>
</html>