<?php

include('includes/hlava.php');
title('Klub priateľov fotografie', '');

if ($link) {
  if ($db_selected) {
    if (isset($_GET['id']) && ($_GET['id'] != '') && isset($_GET['aid']) && ($_GET['aid'] != '') && (isset($_GET['zmen'])) && (($_GET['zmen'] == '0') || ($_GET['zmen'] == '1')) && ($_GET['aid'] == $_SESSION['aid'])) {
      $sql = "UPDATE kpf_photos P SET P.index = '" . $_GET['zmen'] . "'
              WHERE P.id = '" . $_GET['id'] . "';";
      $result = mysql_query($sql, $link);
          		if ($result) {
                  header("Location: author.php?id=". $_GET['aid'] ."");
              }            
    }
    else echo 'nastala chyba.';
  }
}
?>
