|
|
@ -5,4 +5,79 @@ |
|
|
|
* @version $Id$ |
|
|
|
**/ |
|
|
|
|
|
|
|
?>
|
|
|
|
if (!isset($_GET['id']) || !is_numeric(trim($_GET['id']))) |
|
|
|
{ |
|
|
|
Przekieruj('index.php?mode=admin_gallery', 'Nieprawidłowe ID zdjęcia'); |
|
|
|
} |
|
|
|
|
|
|
|
$id = intval($_GET['id']); |
|
|
|
|
|
|
|
#a teraz czy wogole zdjecie istnieje w bazie ;)
|
|
|
|
$sql = "SELECT * FROM `photos` WHERE `id`='$id';"; |
|
|
|
if (!$result = $DB->query($sql)) |
|
|
|
{ |
|
|
|
blad('Nie mozna pobrac info o zdjeciu!'); |
|
|
|
} |
|
|
|
if ($result->num_rows == 0) |
|
|
|
{ |
|
|
|
Przekieruj('index.php?mode=admin_gallery', 'Zdjęcie nie istnieje!'); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
$row = $result->fetch_assoc(); |
|
|
|
} |
|
|
|
#edycja w bazie - caly "mechanizm"
|
|
|
|
if (isset($_POST['author'])) |
|
|
|
{ |
|
|
|
|
|
|
|
$_POST['author'] = addslashes(strip_tags(trim($_POST['author']))); |
|
|
|
$_POST['desc'] = addslashes(strip_tags(trim($_POST['desc']))); |
|
|
|
$sql = "UPDATE `photos` SET `author`='".$_POST['author']."', `description`='".$_POST['desc']."' WHERE `id`='$id'"; |
|
|
|
if (!$DB->query($sql)) |
|
|
|
{ |
|
|
|
blad('Nie mozna zaaktualizowac zdjecia.'); |
|
|
|
} |
|
|
|
|
|
|
|
Przekieruj('index.php?mode=admin_gallery', 'Zdjęcie zostało zaaktualizowane! Powrót...'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
NaglowekPA('Edycja zdjęcia'); |
|
|
|
?>
|
|
|
|
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST"> |
|
|
|
<table width="600" border="1" style="border-color: gray; border-style: solid; border-collapse: collapse"> |
|
|
|
<tr> |
|
|
|
<td colspan="2" bgcolor="yellow">Edycja zdjęcia nr <?php echo $row['id']; ?></td>
|
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td align="right" width="50%"> |
|
|
|
Podgląd zdjęcia: |
|
|
|
</td> |
|
|
|
<td align="left"> |
|
|
|
<img src="../images/upload/<?php echo $row['thumb_name']; ?>" alt="preview" /> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td align="right">Autor:</td> |
|
|
|
<td align="left"> |
|
|
|
<select name="author" style="width: 280px"> |
|
|
|
<option name="" <?php if ($row['author']=='') { echo 'selected="selected"';}?>>Autor nieznany</option>
|
|
|
|
<option name="Autor Drugi" <?php if ($row['author']=='Autor Drugi') { echo 'selected="selected"';}?>>Autor Drugi</option>
|
|
|
|
<option name="Autor Pierwszy" <?php if ($row['author']=='Autor Pierwszy') { echo 'selected="selected"';}?>>Autor Pierwszy</option>
|
|
|
|
</select> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td align="right">Opis:</td> |
|
|
|
<td align="left"><textarea name="desc" style="width: 280px; height: 50px"><?php echo $row['description']; ?></textarea></td>
|
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td colspan="2"> |
|
|
|
<input type="submit" value="Zapisz" /> |
|
|
|
<input type="reset" value="Wyczyść" /> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
</form> |
|
|
|
<br /> |
|
|
|
<?php StopkaPA(); ?>
|