<?php
|
|
/**
|
|
* @package Galeria Suczawa 2009
|
|
* @file admin/gallery_view.php
|
|
* @version $Id$
|
|
**/
|
|
|
|
|
|
$sql = "SELECT * FROM `photos` $limit";
|
|
if (!$result = $DB->query($sql))
|
|
{
|
|
blad('Nie mozna pobrac zdjec uzytkownikow!');
|
|
}
|
|
|
|
if (isset($_POST['nick']))
|
|
{
|
|
$_POST['nick'] = addslashes(strip_tags(trim($_POST['nick'])));
|
|
$_POST['email'] = addslashes(strip_tags(trim($_POST['email'])));
|
|
|
|
#sprawdzanie, czy nick nie jest zajety
|
|
$sql = "SELECT `id` FROM `admins` WHERE `nick` ='".$_POST['nick']."';";
|
|
if (!$result = $DB->query($sql))
|
|
{
|
|
blad('Nie mozna sprawdzic, czy nick nie zostal zajety.');
|
|
}
|
|
if ($result->num_rows>0)
|
|
{
|
|
$reserved = true;
|
|
}
|
|
else
|
|
{
|
|
$reserved = false;
|
|
}
|
|
$result->free();
|
|
|
|
if (strlen($_POST['nick']) > 0 && trim($_POST['nick']) != $row['nick'] && ~$reserved)
|
|
{
|
|
$sql = "UPDATE `admins` SET `nick`='".$_POST['nick']."' WHERE `id`='$id'";
|
|
if (!$DB->query($sql))
|
|
{
|
|
blad('Nie mozna zaaktualizowac nicku administratora.');
|
|
}
|
|
}
|
|
|
|
if (strlen($_POST['email']) > 0 && trim($_POST['nick']) != $row['email'])
|
|
{
|
|
if (ereg ("^.+@.+\..+$", $_POST['email']))
|
|
{
|
|
$sql = "UPDATE `admins` SET `email`='".$_POST['email']."' WHERE `id`='$id'";
|
|
if (!$DB->query($sql))
|
|
{
|
|
blad('Nie mozna zaaktualizowac emaila administratora.');
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$msg = 'Adres email jest nieprawidłowy! (przykład: [email protected])';
|
|
}
|
|
}
|
|
|
|
if (strlen(trim($_POST['pass'])) > 0 && md5(trim($_POST['pass'])) != $row['password'])
|
|
{
|
|
$_POST['pass'] = md5(addslashes(strip_tags(trim($_POST['pass']))));
|
|
$sql = "UPDATE `admins` SET `password`='".$_POST['pass']."' WHERE `id`='$id'";
|
|
if (!$DB->query($sql))
|
|
{
|
|
blad('Nie mozna zaaktualizowac hasla administratora.');
|
|
}
|
|
}
|
|
|
|
if ($msg == '')
|
|
{
|
|
Przekieruj('index.php?mode=admin_users', 'Użytkownik został zaaktualizowany! Powrót...');
|
|
}
|
|
}
|
|
|
|
NaglowekPA('Listowanie galerii');
|
|
?>
|
|
<br />
|
|
<br />
|
|
<table width="900" border="1" style="border-color: gray; border-style: solid; border-collapse: collapse">
|
|
<tr>
|
|
<td colspan="6" bgcolor="yellow">Lista zdjęć (strona <?php echo $page; ?>)</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="b">Id</td>
|
|
<td class="b" width="190">Miniatura</td>
|
|
<td class="b" width="150">Autor</td>
|
|
<td class="b">Opis</td>
|
|
<td colspan="2" class="b">Operacje</td>
|
|
|
|
<?php
|
|
while ($row = $result->fetch_assoc())
|
|
{
|
|
?>
|
|
<tr>
|
|
<td><?php echo $row['id']; ?></td>
|
|
<td><img src="../images/upload/<?php echo $row['thumb_name']; ?>" alt="Zdjęcie" /></td>
|
|
<td><?php if ($row['author']!='') { echo $row['author']; } else { echo 'Autor nieznany'; } ?></td>
|
|
<td><?php echo $row['description']; ?></td>
|
|
<td width="50"><a href="index.php?mode=admin_gallery&submode=edit&id=<?php echo $row['id']; ?>">Popraw</td>
|
|
<td width="50"><a href="index.php?mode=admin_gallery&submode=delete&id=<?php echo $row['id']; ?>">Usuń</td>
|
|
</tr>
|
|
<?php } ?>
|
|
</table>
|
|
<div align="left">Strony: <?php GenerujListeStron(); ?></div>
|
|
<div align="right"><a href="index.php?mode=admin_gallery&submode=add">Dodaj nowe zdjęcie...</a></div>
|
|
<?php StopkaPA(); ?>
|
|
|
|
<?
|
|
|
|
?>
|