tutorials.de Buch-Aktion 05/2012
Seite 2 von 2 ErsteErste 12
ERLEDIGT
NEIN
ANTWORTEN
23
ZUGRIFFE
1163
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #16
    Avatar von Dennis Wronka
    Dennis Wronka Dennis Wronka ist offline Soulcollector
    Registriert seit
    Apr 2002
    Ort
    Hong Kong
    Beiträge
    12.296
    Blog-Einträge
    231
    Ist der Safe Mode vielleicht an?
     
    PHP Class Collection - PHP-Klassen fuer PHP 5 (und Teilweise auch fuer PHP 4)
    Updates: Catcher 1.1, FTPConnection 1.2, MultiSQL 1.1, RSS2 1.1, SMTPConnection 1.4
    __________________
    EasyLFS - Hintergrundinformationen, Installationsanleitung, Softwareliste und Download
    EasyLFS Projektthread - Informationen, Status und Diskussion zu meiner Linux-Distribution
    __________________
    Ich bin die Schildkroete, mein Sohn. Ich habe das Universum erschaffen, aber bitte mach mir daraus keinen Vorwurf; ich hatte Bauchschmerzen.
    __________________
    Zitat Zitat von Friedrich Nietzsche
    Man muss noch Chaos in sich haben, um einen tanzenden Stern gebaeren zu koennen.

  2. #17
    borgelite borgelite ist offline Mitglied
    Registriert seit
    Jun 2004
    Ort
    o-feld
    Beiträge
    12
    juppi danke jetzt gehts
    habe es erstmal so gelöst.
    Ich werde noch den kommpletten code uppen fals noch jemand das prob. hat:
    THXTHX ersmal.
     
    http://www.borgelite.de
    http://www.zivi.de.am

  3. #18
    borgelite borgelite ist offline Mitglied
    Registriert seit
    Jun 2004
    Ort
    o-feld
    Beiträge
    12
    so bitte:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    
    <?
    require('config.php'); // ist der apsolute pfad drin $abpath = /opt/lampp/htdocs/...
    if ($button=="upp")
    {
      if($_FILES["datei"]["name"] == "")
       {
         echo "keine Datei";
       }
      else
       {
         if($_FILES["datei"]["tmp_name"] == "")
          {
            echo "Fehler bei der Übertragung. (Eventuell Datei zu groß.. max. 2 MB)";
          }
         else
          {
    //Datei hochladen entpacken und zip datei wider löschen
            if (move_uploaded_file($_FILES["datei"]["tmp_name"],$abpath."/".$select."/".$_FILES["datei"]["name"]))   
             {
              $file = $abpath."/".$select."/".$_FILES["datei"]["name"];
          $ordner = $abpath."/".$select."/";
              exec("unzip -d $ordner $file");
          exec("rm $file");
              echo "fertig";
             }
         else
             {
              echo "doch ein fehler";
             }    
          }
       }
    }
    else
    {
      ?>
      <table width="100%" border="0" cellpadding="1" cellspacing="1" style="border-collapse: collapse">
      <tr>
      <td colspan="2" height="25"><center>Datei Upload</center></td>
      </tr>
      <tr>
      <td width="100%" align="left"><br>
      <center>
      <form action="upload1.php" method="post" enctype="multipart/form-data">
      <table>
          <tr>
          <?
    //scanne verzeichnisse / auswahl des Verzeichnisses 
          $dh = opendir($dir);
      while($file = readdir($dh))
       {
        if ($file != "." && $file != ".." && is_dir($file))   
         {
          $dname[] = $file;
          sort($dname);
          reset ($dname);
         }
       }
      print "<hr align='left' width='400'><br>";
      print "<b>Upload to:</b> <select name=\"select\">";
      print "<option value=\"#\">Choose. . .</option><br>\n";
      $u=0;
      foreach($dname as $key=>$val)
       {
        if($dname[$u])   
         {
          print "<option value=\"$dname[$u]\">$dname[$u]</option>\n";
          $u++;
         }
       }
      print "</select>";
      ?>
      <td>Datei auswählen: (max. 2 MB) <input name="datei" size="50" type="file">
      <input type="submit" value="upp" name="button"></td>
      </tr>
      </table>
      <?
    }
    ?>
     
    http://www.borgelite.de
    http://www.zivi.de.am

  4. #19
    borgelite borgelite ist offline Mitglied
    Registriert seit
    Jun 2004
    Ort
    o-feld
    Beiträge
    12
    ok hier nochmal volständig (is von der Slide gallery)
    upload.php
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    
    <?php
     
    require('config.php');
     
    function error ($error_message) {
        echo $error_message."<BR>";
        exit;
    }
     
    if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == "$PASSWORD" )) ) {
        header("WWW-Authenticate: Basic entrer=\"Form2txt admin\"");
        header("HTTP/1.0 401 Unauthorized");
        error("Unauthorized access...");
    }
     
     
    if ($_REQUEST['submitted2'])
    {
    umask (0);
     
    mkdir ("$abpath/$newdir", 0755);
    chmod ("$abpath/$newdir",0777);
    $file = fopen("$abpath/$newdir/album.txt","w");
    chmod ("$abpath/$newdir/album.txt",0777);
    fwrite($file,"$album");
    fclose($file);
    }
     
    if ($_REQUEST['submitted']){ // Begin processing portion of script
     
     
    $log = "";
     
    for ($i=0; $i<$number_of_uploads; $i++) {
    $j=$i + 1;
     
     
    if($select =="Choose. . ."){
    $log .= "Please Choose Upload Directory<br>";
    } else {
     
        //checks if file exists
        if ($img_name[$i] == "") {
            $log .= "No file selected for upload $j<br>";
        }
     
        if ($img_name[$i] != "") {
            //checks if file exists
            if (file_exists("$abpath/$select/$img_name[$i]")) {
                $log .= "File $j already existed<br>";
            } else {
     
                //checks if files to big
                if (($sizelim == "yes") && ($img_size[$i] > $size)) {
                    $log .= "File $j was too big<br>";
                } else {
     
     
                    //Checks if file is an image
                    if( (substr($img_name[$i],-3)=="gif") || (substr($img_name[$i],-3)=="jpg")  || (substr($img_name[$i],-3)=="JPG") || (substr($img_name[$i],-3)=="txt") || (substr($img_name[$i],-3)=="TXT") || (substr($img_name[$i],-3)=="GIF") || (substr($img_name[$i],-3)=="zip") ) {
                    
                        @copy($img[$i], "$abpath/$select/$img_name[$i]") or $log .= "Couldn't copy image 1 to server<br>";
                        //Angepaster code für ZIP ARCHIVE
    if(substr($img_name[$i],-3)=="zip")
    {
     $file = $abpath."/".$select."/".$img_name[$i];
          $ordner = $abpath."/".$select."/";
          exec("unzip -d $ordner $file");
    exec("rm $file");
    $log .= "Zip hochgeladen und entpackt! Juppi<br>"; 
    }
    $file = fopen("$abpath/$select/$img_name[$i].txt","w");
    chmod ("$abpath/$select/$img_name[$i].txt",0777);
    fwrite($file,"$comnt[$i]");
    fclose($file);
     
     
                        if (file_exists("$abpath/$select/$img_name[$i]")) {
                            $log .= "File $j was uploaded<br>";
                            
                        }
                        } else {
                            $log .= "File $j is not an image or text file<br>";
                        }
                    }
                }
            }
     
    }
        
    }
     
    ?>
     
    <html>
    <head>
    <title>Image Report</title>
    </head>
    <body>
    <p>Log:<br>
    <?
     
    echo "$log";
     
    ?>
    </p>
    <a href="upload.php">back</a>
    <body>
    </html>
    <? 
    exit;
    } // End processing portion of script
    ?>
     
    <html>
    <head>
           <title>35mm Slide Gallery - Upload Module Aber nich Original mit zip funktion</title>
    <link rel="stylesheet" type="text/css" href="gallery.css">
    </head>
    <body>
    <div align="right"><font size="1">powered by <a href="http://www.andymack.com/freescripts/">35mm 
      Slide Gallery</a></font></div>
    <form method=POST action=upload.php enctype=multipart/form-data>
    <input type="hidden" name="submitted2" value="true">
    <b>Create New Album: </b><input type="text" name="newdir">
    <br><b>Album Description: </b> <input type="text" name=album size=20>
    <input type="submit" name="submit" value="Create"> 
    </form>
    <form method=POST action=upload.php enctype=multipart/form-data>
    <?php
    $dh = opendir($dir);
     while($file = readdir($dh))
     {
    if ($file != "." && $file != ".." && is_dir($file))   
    {$dname[] = $file;
    sort($dname);
    reset ($dname);
     }
    }
    print "<hr align='left' width='400'><br>";
    print "<b>Upload to:</b> <select name=\"select\">";
    print "<option value=\"#\">Choose. . .</option><br>\n";
    $u=0;
     foreach($dname as $key=>$val)
      {  if($dname[$u])   
    { print "<option value=\"$dname[$u]\">$dname[$u]</option>\n";
    $u++;
    }
    }
    print "</select>";
     
    ?>
    <p><b>Files to upload: (Einfach 1 Zip Archiv oder mehrere Bilder hier auswählen)</b><br>
    <blockquote>
    <?php
     
    for ($j=0; $j<$number_of_uploads; $j++) {
    ?>
    <input type=file name=img[] size=30> <br><b>Caption</b> <input type="text" name=comnt[] size=30><p>
    <?
    }
    ?>
    <br> 
    <input type="hidden" name="submitted" value="true">
    <input type="submit" name="submit" value="Upload"> 
    </form>
    </blockquote>
    go to <a href="index.php">gallery</a>
    </body>
    </html>

    config.php

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    <?php
     
    //Slide gallery variables
    $place = "."; //directory of the slide mount images, no need to change
    $col = 5; //no. of columns in a page
    $maxrow = 10; //no. of rows in a page
    $dir="."; //directory for this script, no need to change
    $thumb = true ; //setting it to TRUE will generate real thumbnails on-the-fly, supports jpg file only and requires GD library. Setting it to FALSE will resize the original file to fit the thumbnail size, long download time. Turn it off if thumbnails don't show properly.
    $croptofit = true ; //TRUE will crop the thumbnail to fit the aspect ratio of the slide mount if they aren't the same. False won't crop the thumbnail but it will be distorted if both aspect ratios are not the same.
    $rollover = true ;  //thumbnail rollover effect for IE only
     
    //Upload/Delete Module variables
    $LOGIN = "admin";
    $PASSWORD = "admin";
    $abpath = "/opt/lampp/htdocs/test2"; //Absolute path to where images are uploaded. No trailing slash
    $sizelim = "no"; //Size limit, yes or no
    $size = "2500000"; //Size limit if there is one
    $number_of_uploads = 5;  //Maximum number of uploads in one time
     
    ?>
     
    http://www.borgelite.de
    http://www.zivi.de.am

  5. #20
    cheergirly1984 cheergirly1984 ist offline Mitglied
    Registriert seit
    May 2005
    Beiträge
    23
    Hallo und guten Morgen,

    Sorry dass ich hier nochmals was schreiben aber ich denke das ist besser, wie wenn ich wieder einen neuen Thread auf mache.

    Hab mir das ganze mal angesehen und auch nachgemacht. Ein Teil geht auch schon aber leider noch nicht alles.

    Ich schreibe hier einfach mal die Felher was da kommen:

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    Warning: exec,system,passthru,shell_exec,popen,escapeshellcmd,proc_open,proc_nice() has been disabled for security reasons in /www/htdocs/v148718/impressum/upload.php on line 68
     
    Warning: exec,system,passthru,shell_exec,popen,escapeshellcmd,proc_open,proc_nice() has been disabled for security reasons in /www/htdocs/v148718/impressum/upload.php on line 69
     
    Warning: fopen(/www/htdocs/v148718/impressum/test/test/7318.02c27682b80b462437ba4efc71267562.thumb.zip.txt) [function.fopen]: failed to create stream: No such file or directory in /www/htdocs/v148718/impressum/upload.php on line 72
     
    Warning: chmod() [function.chmod]: No such file or directory in /www/htdocs/v148718/impressum/upload.php on line 73
     
    Warning: fwrite(): supplied argument is not a valid stream resource in /www/htdocs/v148718/impressum/upload.php on line 74
     
    Warning: fclose(): supplied argument is not a valid stream resource in /www/htdocs/v148718/impressum/upload.php on line 75
     
    Log:
    Couldn't copy image 1 to server
    Zip hochgeladen und entpackt! Juppi
    No file selected for upload 2
    No file selected for upload 3
    No file selected for upload 4
    No file selected for upload 5

    In der Zeile 68 steht:

    PHP-Code:
    exec("unzip -d $ordner $file"); 
    In der Zeile 69 steht:

    PHP-Code:
    exec("rm $file"); 
    In der Zeile 72 - 75 steht:

    PHP-Code:
    $file fopen("$abpath/$select/$img_name[$i].txt","w");
    chmod ("$abpath/$select/$img_name[$i].txt",0777);
    fwrite($file,"$comnt[$i]");
    fclose($file); 
    Ich kann leider mit dem nicht wirklich was anfangen. Kann mir da jemand weiter helfen?
     
    LaLeLu nur der Mann im Mond schaut zu.......

  6. #21
    borgelite borgelite ist offline Mitglied
    Registriert seit
    Jun 2004
    Ort
    o-feld
    Beiträge
    12
    nun das sieht mir ganz so aus als hätte der admin die rechte begrentzt das funktioniert dann so leider nicht.
     
    http://www.borgelite.de
    http://www.zivi.de.am

  7. #22
    cheergirly1984 cheergirly1984 ist offline Mitglied
    Registriert seit
    May 2005
    Beiträge
    23
    Hallo,

    nun ja ich bin auf der WebSeite Admin
     
    LaLeLu nur der Mann im Mond schaut zu.......

  8. #23
    Kerwin Kerwin ist offline Mitglied Brokat
    Registriert seit
    Feb 2004
    Beiträge
    436
    borgelite wollte damit sagen, das der Admin des Servers diese Rechte gesperrt hast da dieser den Verwaltet. Du hingegen bist nur der "Admin" von deiner Website, nicht von der Technick des Servers.
     

  9. #24
    Dominik Br Dominik Br ist offline Grünschnabel
    Registriert seit
    Jul 2004
    Beiträge
    2
    Wie schon gesagt wurde auf deinem Server unter anderem die PHP Funktion exec gesperrt. Steht ja auch gut verständlich in der Fehlermeldung!?


    Um Zip Dateien per PHP zu entpacken gibt es aber auch PHP eigene Funktionen:
    Hier der Link zu php.net
    Beachte aber die Vorrausetzungen für deinen Server!
     

Ähnliche Themen

  1. .gz entpacken
    Von Raven280438 im Forum PHP
    Antworten: 5
    Letzter Beitrag: 25.10.08, 14:04
  2. Jar entpacken
    Von Leroux im Forum Microsoft Windows
    Antworten: 2
    Letzter Beitrag: 08.10.08, 11:32
  3. Antworten: 10
    Letzter Beitrag: 15.11.04, 19:58
  4. *.gz entpacken
    Von ChuloGT im Forum PHP
    Antworten: 2
    Letzter Beitrag: 02.11.04, 13:53
  5. Entpacken von .zip
    Von rauchmelder im Forum PHP
    Antworten: 1
    Letzter Beitrag: 05.09.04, 19:31