Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Co jest źle...? Błąd podczas usuwania obrazka z serwera
Ciupaska
post 13.07.2009, 19:23:59
Post #1





Grupa: Zarejestrowani
Postów: 82
Pomógł: 0
Dołączył: 25.05.2009

Ostrzeżenie: (10%)
X----


Witam, co jest źle w tym kodzie? Powinien skasować obraz z serwera, jednak tak się nie dzieje...
  1. <?php
  2. #delete images
  3.                
  4.                $imgs = explode(",",$imgs);
  5.                
  6.                $was_gal=false;
  7.                if($_POST['sgid'] != "" && $_POST['sgid'] != '0') {
  8.                    $was_gal = gallery(_html($_POST['sgid']));
  9.                    if($was_gal && $was_gal['username'] == $logged_user['username']) {
  10.                        $images = explode(",",$was_gal['images']);
  11.                        $temp = Array();
  12.                        foreach($imgs as $d) {
  13.                            $key = array_search($d,$images);
  14.                            if($key !== FALSE) {
  15.                                $temp[]=$images[$key];
  16.                                unset($images[$key]);
  17.                                
  18.                            }
  19.                        }
  20.                        $imgs = $temp;
  21.                        $was_gal['images'] = implode(",",$images);
  22.                        save_temp_file('galleries',$_POST['sgid'],$was_gal);
  23.                    }
  24.                } else {
  25.                    #delete uncategorized images
  26.                    $images = explode(",",$logged_user['images']);
  27.                    $temp = Array();
  28.                    foreach($imgs as $d) {
  29.                        $key = array_search($d,$images);
  30.                        if($key !== FALSE) {
  31.                            $temp[]=$images[$key];
  32.                            unset($images[$key]);
  33.                        }
  34.                    }
  35.                    $imgs = $temp;
  36.                    $logged_user['images'] = implode(",",$images);
  37.                    save_temp_file('users',strtolower($logged_user['username']),$logged_user);
  38.                }
  39.                
  40.            
  41.                foreach($imgs as $image) {
  42.                    list($extra,$idate) = explode("_",$image);
  43.                    $idate = hexdec($idate);
  44.                    unlink(IMAGE_DIR."/images/".date("Y/F/d",$idate)."/$image.jpg");
  45.                    unlink(IMAGE_DIR."/thumbs/".date("Y/F/d",$idate)."/$image.jpg");
  46.                    unlink(IMAGE_DIR."/images/".date("Y/F/d",$idate)."/$image.gif");
  47.                }
  48.                redirect($_SERVER['HTTP_REFERER'],0);    
  49.                #redirect("$root_path/mygalleries.php?id=0&e=".base64_encode("Selected image(s) successfully deleted."),1);
  50.                die();
  51.                
  52.            } else
  53. ?>




EDIT: Temat poprawiłem

Błędy, właściwie to strona zostaje przeładowana, tylko tyle. Nie pojawia się żaden błąd ani komunikat!

Ten post edytował Ciupaska 13.07.2009, 20:16:55
Go to the top of the page
+Quote Post
Spawnm
post 13.07.2009, 19:31:23
Post #2





Grupa: Moderatorzy
Postów: 4 069
Pomógł: 497
Dołączył: 11.05.2007
Skąd: Warszawa




Popraw tytuł na bardziej sensowny.

//edit
Jakieś błędy ?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 12:17