View file libs/index.php

File size: 2.08Kb
<?php
/*
=============================================
 Движок:  SHCMS Engine
=============================================
 Название файла: Библиотека
=============================================
 Official website: http://shcms.ru
=============================================
 Данный код защищен авторскими правами
=============================================
*/
define('SHCMS', true);
include_once'../system/inc/basic_settings.php';
$shcmsengine['title'] = 'Библиотека';
include_once'../template/head.php';

$libs = mysql_query("SELECT * FROM `libs`");
while($lib = mysql_fetch_array($libs))
{
echo '<div class="posts">
<img src="../template/icon/dir.png"/>';
echo '
 <a href="list.php?id='.$lib['id'].'">'.$lib['name'].'</a> <br/>
<div style="text-align:right">'.$timedate->when($lib['time']).'</div></div>';
}

if(isset($user_id) and $user4['team'] == 6)
{
echo '<div class="user_foot">Навигация</div>';
echo '<div class="posts"><a href="?act=dir">Создать папку</a></div>';

switch($act)
{
case'dir':

if($_POST['submit'])
{$submit = $_POST['submit'];}

if(isset($submit))
{
if($_POST['name'])
{$name = $_POST['name'];}

if(empty($name))
{
echo '<div class="errors">Введите имя папки</div>';
header("Refresh: 1; url=?act=dir");
include_once'../template/foot.php';
exit;
}

$ok_lib = mysql_query("INSERT INTO `libs` (name,time) VALUES ('$name','".time()."')");
if($ok_lib == true){echo '<div class="actshcms">Папка успешно создана</div>';
header("Refresh: 1; url=/libs/");
include_once'../template/foot.php';
exit;
}
else
{echo '<div class="actshcms">Ошибка создании папки</div>';
header("Refresh: 1; url=?act=dir");
include_once'../template/foot.php';
exit;}
}




echo '<br/><form action="?act=dir" method="post">';
echo '<input type="text" name="name"><br/>';
echo '<input type="submit" name="submit" value="Создать">';
echo '</form>';
break;
}
}



include_once'../template/foot.php';
?>