Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $old_id = $_GET['id'];
- if(!empty($_FILES['soubor1']['name'])) { $file1 = $_FILES['soubor1']; $mini = $_FILES['soubor1']['name']; }
- if(!empty($_FILES['soubor2']['name'])) { $file2 = $_FILES['soubor2']; $full = $_FILES['soubor2']['name']; }
- if(!empty($_POST['popisek'])) { $note = $_POST['popisek']; }
- if($file1 || $file2 || $note) { // pokud aspon jedna existuje
- //prvni fotka
- if(isset($file1)) {
- if(in_array( $_FILES['soubor1']['type'], array('image/png', 'image/jpg', 'image/jpeg', 'image/pjpeg'))) {
- if( @move_uploaded_file($_FILES['soubor1']['tmp_name'], "images/gallery/" . $folder . "/mini/" . $_FILES['soubor1']['name'])) {
- unlink("images/gallery/" . $folder . "/mini/" . );
- } else {
- $error[0] = "minitura nelze nahrát, zkuste to znovu";
- }
- } else {
- $error[0] = "špatný formátu miniatury, očekává se png, jpg*";
- }
- }
- //druha fotka
- if(isset($file2)) {
- if(in_array( $_FILES['soubor2']['type'], array('image/png', 'image/jpg', 'image/jpeg', 'image/pjpeg'))) {
- if( @move_uploaded_file($_FILES['soubor2']['tmp_name'], "images/gallery/" . $folder . "/" . $_FILES['soubor2']['name'])) {
- unlink("images/gallery/" . $folder . "/" . );
- } else {
- $error[0] = "velká fotografie nelze nahrát, zkuste to znovu";
- }
- } else {
- $error[1] = "špatný formátu celé fotky, očekává se png, jpg*";
- }
- }
- if(empty($error)) {
- $sql = "UPDATE foto SET ";
- if(isset($file1)) { $sql .= "mini = '$mini'"; }
- if(isset($file2) && !isset($file1)) { $sql .= "full = '$full'"; } else if(isset($file2)) { $sql .= ", full = '$full'"; }
- if(isset($note) && !isset($file1) && !isset($file2)) { $sql .= "nazev = '$note'"; } else if(isset($note)) { $sql .= ", nazev = '$note'"; }
- $sql .= " WHERE id = '$old_id'";
- // $query = mysql_query($sql, $con);
- if($query) {
- }
- } else {
- echo $error[0];
- echo $error[1];
- }
- } else {
- echo "žádná editace není vybrána";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement