PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Hilfe bei Dropbox PHP Script
Beitrag
<blockquote data-quote="Foos" data-source="post: 1575414" data-attributes="member: 72189"><p><strong>AW: Hilfe bei Dropbox PHP Script</strong></p><p></p><p>Naja immer noch die gleiche. </p><p>Habe eine andere Version von einem anderen genommen. Und jetzt is der Fehler halt in Line 85. ^^ Ich kotz gleich...</p><p></p><p></p><p>[PHP]<!--</p><p> # Dropbox-Upload-Script, v6</p><p> # Initial version from: http://www.ampercent.com/dropbox-uploader-allow-users-upload-files-dropbox-account/</p><p> # And taken from: http://jaka.kubje.org/projects/dropbox-uploader/example/</p><p> # Graphics from: http://www.addictivetips.com/internet-tips/allow-anyone-to-upload-files-to-your-dropbox-folder/</p><p> # Modified by kingofcomedy, 2010-08/09</p><p> # http://dropbox.kingofcomedy.de</p><p>//--></p><p><?php</p><p></p><p>$passw = "default"; //change this to a password of your choice.</p><p>$only_some_extensions_are_allowed = 1; // set to 0 if you want to allow every extension</p><p>$filesize_limit = "100"; // max. filesize in kybte</p><p></p><p>// enter dropbox credentials below</p><p>$data = array(</p><p> "email" => "dx@freenet.de",</p><p> "password" => "xxx",</p><p> "directories" => array(</p><p> # real-folder => a name which will be shown in the dropdown</p><p> "shared" => "kunde",</p><p> "shared/test" => "my test folder inside my shared folder"</p><p> )</p><p>);</p><p></p><p>// which file-extensions are allowed for an upload</p><p>$ext_upload = array(</p><p> "exe",</p><p> "zip",</p><p> "pdf",</p><p> "rar",</p><p> "7z"</p><p>);</p><p></p><p>// which file-extensions are allowed for a link</p><p>$ext_link = array(</p><p> "exe",</p><p> "zip",</p><p> "gz",</p><p> "jpg"</p><p>);</p><p></p><p>function CleanArray($OldArray){</p><p> $i = 0;</p><p> $NewArray = array();</p><p> foreach($OldArray as $value){</p><p> if($value != "" && strpos($value, "Copy a link into this field!") === false){</p><p> $NewArray[$i] = $value;</p><p> $i++;</p><p> }</p><p> }</p><p> return $NewArray;</p><p>}</p><p></p><p>?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></p><p></p><p><html xmlns="http://www.w3.org/1999/xhtml"></p><p> <head></p><p> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></p><p> <title>Dropbox Uploader v0.6</title></p><p> <link rel="stylesheet" type="text/css" href="style.css" /></p><p> <script language="javascript" type="text/javascript"></p><p> <!--</p><p> function show(what){</p><p> if(what == "link"){</p><p> document.getElementById("file").style.display = "none";</p><p> document.getElementById("link").style.display = "";</p><p> }else if(what == "file"){</p><p> document.getElementById("link").style.display = "none";</p><p> document.getElementById("file").style.display = "";</p><p> }</p><p> }</p><p> //--></p><p> </script></p><p> </head></p><p></p><p><body></p><p></p><p><?php</p><p></p><p>if ($_POST) {</p><p></p><p> require 'DropboxUploader.php';</p><p></p><p> try {</p><p></p><p> $keys = array_keys($data["directories"]);</p><p> $directory = $keys[$_POST["folder"]];</p><p></p><p> if ($_POST['txtPassword'] != $passw)</p><p> throw new Exception('Wrong Password');</p><p></p><p> $tmpDir = uniqid('/tmp/DropboxUploader-');</p><p> if (!mkdir($tmpDir))</p><p> throw new Exception('Cannot create temporary directory!');</p><p></p><p> $_LINK = CleanArray($_POST["link"]);</p><p></p><p> if($_POST["choice"] == "file"){</p><p> for($c=0; $c<4; $c++){</p><p> if($_FILES["file"]['name'][$c] != ''){</p><p> $filename = $_FILES["file"]['name'][$c];</p><p> $info = pathinfo($filename);</p><p> $ext = $info['extension'];</p><p></p><p> if(!in_array($ext,$ext_upload) && $only_some_extensions_are_allowed == 1)</p><p> throw new Exception('This file-extension (*.'.$ext.') is not allowed.');</p><p></p><p> // Rename uploaded file to reflect original name</p><p> if ($_FILES["file"]['error'][$c] !== UPLOAD_ERR_OK)</p><p> throw new Exception('File was not successfully uploaded from your computer.');</p><p></p><p> if ($_FILES["file"]['name'][$c] === "")</p><p> throw new Exception('File name not supplied by the browser.');</p><p></p><p> $tmpFile = $tmpDir.'/'.str_replace("/\0", '_', $_FILES["file"]['name'][$c]);</p><p></p><p> if (!move_uploaded_file($_FILES["file"]['tmp_name'][$c], $tmpFile))</p><p> throw new Exception('Cannot rename uploaded file!');</p><p></p><p> $tmpFilesize = filesize($tmpFile);</p><p> if($tmpFilesize > ($filesize_limit*1024)){</p><p> // Clean up</p><p> if (isset($tmpFile) && file_exists($tmpFile))</p><p> unlink($tmpFile);</p><p> throw new Exception('File ('.$_FILES["file"]['name'][$c].') too big! ('.$tmpFilesize.' > '.($filesize_limit*1024).')');</p><p> }</p><p></p><p> $uploader = new DropboxUploader($data["email"], $data["password"]);</p><p> $uploader->upload($tmpFile, $directory);</p><p> // Clean up</p><p> if (isset($tmpFile) && file_exists($tmpFile))</p><p> unlink($tmpFile);</p><p> }</p><p> }</p><p> }elseif($_POST["choice"] == "link"){</p><p> for($c=0; $c<count($_LINK); $c++){</p><p> $filename = $_LINK[$c];</p><p> $info = pathinfo($filename);</p><p> $ext = $info['extension'];</p><p></p><p> if(!in_array($ext,$ext_link) && $only_some_extensions_are_allowed == 1)</p><p> throw new Exception('This file-extension is not allowed.');</p><p></p><p> copy($filename, $tmpDir ."/". end(explode("/", $filename)));</p><p> $tmpFile = $tmpDir.'/'.str_replace("/\0", '_', end(explode("/", $filename)));</p><p></p><p> $tmpFilesize = filesize($tmpFile);</p><p> if($tmpFilesize > ($filesize_limit*1024)){</p><p> // Clean up</p><p> if (isset($tmpFile) && file_exists($tmpFile))</p><p> unlink($tmpFile);</p><p> throw new Exception('File ('.$filename.') too big! ('.$tmpFilesize.' > '.($filesize_limit*1024).')');</p><p> }</p><p></p><p> $uploader = new DropboxUploader($data["email"], $data["password"]);</p><p> $uploader->upload($tmpFile, $directory);</p><p> // Clean up</p><p> if (isset($tmpFile) && file_exists($tmpFile))</p><p> unlink($tmpFile);</p><p> }</p><p> }</p><p></p><p> $error = '<span style="color:#00ff00; font-weight:bold;">File(s) successfully uploaded to your dropbox ('.$directory.')!</span>';</p><p> } catch(Exception $e) {</p><p> $error = '<span style="color:#ff0000; font-weight:bold;">Error: ' . htmlspecialchars($e->getMessage()) . '</span>';</p><p> }</p><p></p><p></p><p></p><p> if (isset($tmpDir) && file_exists($tmpDir))</p><p> rmdir($tmpDir);</p><p>}</p><p></p><p># echo ini_get('post_max_size');</p><p># echo ini_get('upload_max_filesize');</p><p></p><p>?></p><p></p><p><div class="blue-box"></p><p> <div style="height:384px;"></p><p> <div style="padding-top:40px; text-align:center;"></p><p> <h1>Dropbox Uploader</h1></p><p> <form action="index.php" method="post" enctype="multipart/form-data" style="display:inline;"></p><p> <strong>Source:</strong> <input type="radio" name="choice" value="file" onclick="javascript:show('file');" checked />file or</p><p> <input type="radio" name="choice" value="link" onclick="javascript:show('link');" />link</p><p> <br /><br /></p><p> <div style="width:650px; height:140px; margin:auto;"></p><p> <div style="float:left;"></p><p> <div id="file"></p><p> <input type="file" name="file[]" /><br /></p><p> <input type="file" name="file[]" /><br /></p><p> <input type="file" name="file[]" /><br /></p><p> <input type="file" name="file[]" /><br /><br /></p><p> <?php</p><p> if($only_some_extensions_are_allowed == 1) echo "<strong>Allowed extensions:</strong> " . implode(", ", $ext_upload) . "<br /><br />";</p><p> ?></p><p> </div></p><p> <div id="link" style="display:none;"></p><p> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /></p><p> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /></p><p> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /></p><p> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /><br /></p><p> <?php</p><p> if($only_some_extensions_are_allowed == 1) echo "<strong>Allowed extensions:</strong> " . implode(", ", $ext_link) . "<br /><br />";</p><p> ?></p><p> </div></p><p> </div></p><p> <div style="float:right; padding-left:20px; text-align:left;"></p><p> <strong>Destination:</strong> <select name="folder"></p><p> <?php</p><p> $i = 0;</p><p> foreach($data["directories"] AS $output){</p><p> echo '<option value="'.$i.'">'.$output.'</option>';</p><p> $i++;</p><p> }</p><p> ?></p><p> </select></p><p> <br /><br /></p><p> <strong>Password:</strong> <input type="password" title="Enter your password" name="txtPassword" /></p><p> <br /><br /></p><p> </div></p><p> <div style="clear:both;"></div></p><p> </div></p><p> <input type="submit" value="Upload the file to my Dropbox!" /></p><p> </form></p><p> <br /><br /></p><p> <?php if(isset($error)) echo $error; ?></p><p> </div></p><p> </div></p><p></div></p><p></p><p></body></p><p></html>[/PHP]</p></blockquote><p></p>
[QUOTE="Foos, post: 1575414, member: 72189"] [b]AW: Hilfe bei Dropbox PHP Script[/b] Naja immer noch die gleiche. Habe eine andere Version von einem anderen genommen. Und jetzt is der Fehler halt in Line 85. ^^ Ich kotz gleich... [PHP]<!-- # Dropbox-Upload-Script, v6 # Initial version from: http://www.ampercent.com/dropbox-uploader-allow-users-upload-files-dropbox-account/ # And taken from: http://jaka.kubje.org/projects/dropbox-uploader/example/ # Graphics from: http://www.addictivetips.com/internet-tips/allow-anyone-to-upload-files-to-your-dropbox-folder/ # Modified by kingofcomedy, 2010-08/09 # http://dropbox.kingofcomedy.de //--> <?php $passw = "default"; //change this to a password of your choice. $only_some_extensions_are_allowed = 1; // set to 0 if you want to allow every extension $filesize_limit = "100"; // max. filesize in kybte // enter dropbox credentials below $data = array( "email" => "dx@freenet.de", "password" => "xxx", "directories" => array( # real-folder => a name which will be shown in the dropdown "shared" => "kunde", "shared/test" => "my test folder inside my shared folder" ) ); // which file-extensions are allowed for an upload $ext_upload = array( "exe", "zip", "pdf", "rar", "7z" ); // which file-extensions are allowed for a link $ext_link = array( "exe", "zip", "gz", "jpg" ); function CleanArray($OldArray){ $i = 0; $NewArray = array(); foreach($OldArray as $value){ if($value != "" && strpos($value, "Copy a link into this field!") === false){ $NewArray[$i] = $value; $i++; } } return $NewArray; } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dropbox Uploader v0.6</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script language="javascript" type="text/javascript"> <!-- function show(what){ if(what == "link"){ document.getElementById("file").style.display = "none"; document.getElementById("link").style.display = ""; }else if(what == "file"){ document.getElementById("link").style.display = "none"; document.getElementById("file").style.display = ""; } } //--> </script> </head> <body> <?php if ($_POST) { require 'DropboxUploader.php'; try { $keys = array_keys($data["directories"]); $directory = $keys[$_POST["folder"]]; if ($_POST['txtPassword'] != $passw) throw new Exception('Wrong Password'); $tmpDir = uniqid('/tmp/DropboxUploader-'); if (!mkdir($tmpDir)) throw new Exception('Cannot create temporary directory!'); $_LINK = CleanArray($_POST["link"]); if($_POST["choice"] == "file"){ for($c=0; $c<4; $c++){ if($_FILES["file"]['name'][$c] != ''){ $filename = $_FILES["file"]['name'][$c]; $info = pathinfo($filename); $ext = $info['extension']; if(!in_array($ext,$ext_upload) && $only_some_extensions_are_allowed == 1) throw new Exception('This file-extension (*.'.$ext.') is not allowed.'); // Rename uploaded file to reflect original name if ($_FILES["file"]['error'][$c] !== UPLOAD_ERR_OK) throw new Exception('File was not successfully uploaded from your computer.'); if ($_FILES["file"]['name'][$c] === "") throw new Exception('File name not supplied by the browser.'); $tmpFile = $tmpDir.'/'.str_replace("/\0", '_', $_FILES["file"]['name'][$c]); if (!move_uploaded_file($_FILES["file"]['tmp_name'][$c], $tmpFile)) throw new Exception('Cannot rename uploaded file!'); $tmpFilesize = filesize($tmpFile); if($tmpFilesize > ($filesize_limit*1024)){ // Clean up if (isset($tmpFile) && file_exists($tmpFile)) unlink($tmpFile); throw new Exception('File ('.$_FILES["file"]['name'][$c].') too big! ('.$tmpFilesize.' > '.($filesize_limit*1024).')'); } $uploader = new DropboxUploader($data["email"], $data["password"]); $uploader->upload($tmpFile, $directory); // Clean up if (isset($tmpFile) && file_exists($tmpFile)) unlink($tmpFile); } } }elseif($_POST["choice"] == "link"){ for($c=0; $c<count($_LINK); $c++){ $filename = $_LINK[$c]; $info = pathinfo($filename); $ext = $info['extension']; if(!in_array($ext,$ext_link) && $only_some_extensions_are_allowed == 1) throw new Exception('This file-extension is not allowed.'); copy($filename, $tmpDir ."/". end(explode("/", $filename))); $tmpFile = $tmpDir.'/'.str_replace("/\0", '_', end(explode("/", $filename))); $tmpFilesize = filesize($tmpFile); if($tmpFilesize > ($filesize_limit*1024)){ // Clean up if (isset($tmpFile) && file_exists($tmpFile)) unlink($tmpFile); throw new Exception('File ('.$filename.') too big! ('.$tmpFilesize.' > '.($filesize_limit*1024).')'); } $uploader = new DropboxUploader($data["email"], $data["password"]); $uploader->upload($tmpFile, $directory); // Clean up if (isset($tmpFile) && file_exists($tmpFile)) unlink($tmpFile); } } $error = '<span style="color:#00ff00; font-weight:bold;">File(s) successfully uploaded to your dropbox ('.$directory.')!</span>'; } catch(Exception $e) { $error = '<span style="color:#ff0000; font-weight:bold;">Error: ' . htmlspecialchars($e->getMessage()) . '</span>'; } if (isset($tmpDir) && file_exists($tmpDir)) rmdir($tmpDir); } # echo ini_get('post_max_size'); # echo ini_get('upload_max_filesize'); ?> <div class="blue-box"> <div style="height:384px;"> <div style="padding-top:40px; text-align:center;"> <h1>Dropbox Uploader</h1> <form action="index.php" method="post" enctype="multipart/form-data" style="display:inline;"> <strong>Source:</strong> <input type="radio" name="choice" value="file" onclick="javascript:show('file');" checked />file or <input type="radio" name="choice" value="link" onclick="javascript:show('link');" />link <br /><br /> <div style="width:650px; height:140px; margin:auto;"> <div style="float:left;"> <div id="file"> <input type="file" name="file[]" /><br /> <input type="file" name="file[]" /><br /> <input type="file" name="file[]" /><br /> <input type="file" name="file[]" /><br /><br /> <?php if($only_some_extensions_are_allowed == 1) echo "<strong>Allowed extensions:</strong> " . implode(", ", $ext_upload) . "<br /><br />"; ?> </div> <div id="link" style="display:none;"> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /> <input type="text" name="link[]" size="40" value="Copy a link into this field!" onfocus='this.value = "";' /><br /><br /> <?php if($only_some_extensions_are_allowed == 1) echo "<strong>Allowed extensions:</strong> " . implode(", ", $ext_link) . "<br /><br />"; ?> </div> </div> <div style="float:right; padding-left:20px; text-align:left;"> <strong>Destination:</strong> <select name="folder"> <?php $i = 0; foreach($data["directories"] AS $output){ echo '<option value="'.$i.'">'.$output.'</option>'; $i++; } ?> </select> <br /><br /> <strong>Password:</strong> <input type="password" title="Enter your password" name="txtPassword" /> <br /><br /> </div> <div style="clear:both;"></div> </div> <input type="submit" value="Upload the file to my Dropbox!" /> </form> <br /><br /> <?php if(isset($error)) echo $error; ?> </div> </div> </div> </body> </html>[/PHP] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Hilfe bei Dropbox PHP Script
Oben