ich habe im netz ein ftp uploadskript in php gefunden was man kostenlos nutzen darf. es geht auch alles besten, nur ein problem habe ich wenn ich datein die größer als 1,2 mb sind uploade geht es nicht. kleinere datein gehen ohne probleme. ihr könnt euch mal den quelltext anschauen vielleicht habt ihr nee idee.
-------------------------------------------------------------------------------------------------------------------------------
// This is Ali's FTP Interface, PHP sessions edition
// Script created by Savas Ali Tokmen -
http://ali.tokmen.com
// STARTUP PARAMETERS
// You can call Ali's FTP Interface with the following paramaters
// [filename].php?host=HOST&user=USER&pass=PASS&port=PORT&folder=FOLDER&passive=PASSIVE&lang=LANG
//
// WHERE:
// HOST is the host name
// USER is the user name
// PASS is the password
// PORT is the port number
// FOLDER is the folder name
// LANG is the language code
// PASSIVE is whether to use passive mode FTP (0 for "no" and 1 for "yes")
//
// Of course, all those items are optional. The first option should be called
// preceeded by a "?" sign and the others by a "&" sign.
// This way, you can launch without much pain the FTP Interface with the parameters
// you want. The user would then only have to press "connect"
// USER-SIDE VARIABLES USED BY THE FTP INTERFACE
//
// $sessID is SESSION ID
// $usePassive is whether to use PASSIVE FTP
// $hostname is HOSTNAME
// $username is USERNAME
// $password is PASSWORD
// $port is PORT
// $curFold is CURRENT FOLDER
// $newFold is NEW FOLDER (FOR THE MKDIR COMMAND)
// $newName is NEW NAME (FOR UPLOADED FILES)
// $_FILES["uplfile"] is UPLOADED FILE CONTENT
// $orgName is ORIGINAL NAME (WHEN RENAMING FILE / FOLDER OR CHANGEDIR / GETFILE)
// $rnName is NEW NAME (WHEN RENAMING / CHANGING PERMISSONS OF FILE / FOLDER)
// $doAction is WHAT TO DO WITH FILE / FOLDER (go, rn, rm, ch)
// $actionType is WITH WHAT TO DO IT (file, folder)
// PHP SHOULD ONLY REPORT *BIG* PROBLEMS
error_reporting(E_ERROR);
// MAXIMUM SIZE OF UPLOADS AND DOWNLOADS, IN MB
$ulLimit=5;
$dlLimit=5;
// DEFINE HERE THE LOCATION OF THE ZIP2FTP INTERFACE
// THIS IS USED WHEN USER WANTS TO UPLOAD MULTIPLE FILES
define("zip2ftp","zip2ftp");
// DEFINE HERE THE NAME OF THE BIG AND SMALL IMAGES USED FOR FOLDERS AND FILES
// SOME CAN BE DOWNLOADED FROM
http://myftp.alishomepage.com/images.zip
define("ftp_folder_image_src","folder.gif");
define("ftp_folder_small_image_src","folder_small.gif");
define("ftp_file_image_src","file.gif");
define("ftp_file_small_image_src","file_small.gif");
// IMPORT EXTERNAL VARIABLES
import_request_variables("gp");
// LANGUAGE CODES THAT MAY BE USED, AND THEIR NAMES
$langs=array("en","fr","tr");
//$langExps=array("View this page in english","Voir cette page en français","Bu sayfayı türkçe olarak göster");
// HTML CLEANER & INVERSE
function filterHTML($what){
return str_replace(array("&","<",">","\""),array("&","<",">","""),$what);}
function unfilterHTML($what){
return str_replace(array("<",">",""","&"),array("<",">","\"","&"),$what);}
// PHP < 4.1.0 DIDN'T HAVE $_* BUT $HTTP_*_VARS
if(version_compare(phpversion(),"4.1.0")==-1){
$_SERVER = $HTTP_SERVER_VARS;
$_SESSION = $HTTP_SESSION_VARS;
$_FILES = $HTTP_POST_FILES;}
// SCRIPT NAME
$scriptName=basename($_SERVER["SCRIPT_NAME"]);
$scriptName=filterHTML($scriptName);
// CONTENT FOR EVERY LANGUAGE
$content=array();
$content["en"]["title"]="Ftp Zugang für den Server";
//$content["fr"]["title"]="L'interface FTP d'Ali";
//$content["tr"]["title"]="Ali'nin FTP arayüzü";
$content["en"]["formdata"]=array("Hostname","Username","Password","Port (standard is 21)","Folder to list (optional)","Display mode","Big icons","Detailed","Use passive mode FTP","No","Yes","Go");
$content["fr"]["formdata"]=array("Adresse du serveur","Nom d'utilisateur","Mot de passe","Port (le standard est 21)","Classeur à lister (optionnel)","Mode d'affichage","Grandes icônes","Détaillé","Utiliser le mode FTP passif","Non","Oui","Allons-y");
$content["tr"]["formdata"]=array("Server adresi","Kullanıcı adı","Parola","Port (standart değer 21)","Listelenecek klasör (opsiyonel)","Görünüm şekli","Büyük ikonlar","Detaylı","Bağlantı pasif modda yapılsın mı","Hayır","Evet","Bağlan");
//$content["en"]["explain"]="The usage of the FTP interface is simple: to switch to a folder or download a file, just click its icon. To rename an item, juste write a new as name and press ENTER (just like you would in your normal file manager utility) ... NOTE that when you click to start a file download, my server first needs to download it; so sometimes you may have to wait a bit before the download starts at your machine.
And, to ERASE all the information about your connection (mostly your PASSWORD), don't forget to click the DISCONNECT button!
Limits: sizelimit is $dlLimit MB per file for file downloads, and $ulLimit MB per file for file uploads.
\n
HINT: if you want to upload a large number of files directly to an FTP server, you may find
Ali's ZIP 2 FTP Interface quite useful! ;)
\n
HINT II: a version of the same FTP Interface that uses MySQL (and that stays free and open source) is also available.
Click here to reach it.";
//$content["fr"]["explain"]="L'usage de l'interface FTP est simple: pour aller à un classeur ou télécharger un fichier, cliquez son icone. Pour renommer un fichier ou classeur, changez son nom et appuyez sur ENTREE (comme vous feriez dans votre utilitaire de gestion de fichiers normal) ... NOTEZ que quand vous cliquez sur un fichier pour commencer son téléchargement, mon serveur doit en premier le télécharger donc des fois le démarrage de votre coté du téléchargement peut prendre un peu de temps.
Aussi, pour être sur d'avoir DETRUIT vos informations de connexion (SURTOUT votre mot de passe) n'oubliez pas de cliquer sur DECONNECTER quand vous aurez terminé!
Limites: vous êtes limités à $dlLimit MO par fichier en download, et à $ulLimit MO par fichier pour les uploads.
\n
ASTUCE: si vous désirez uploader un grand nombre de fichiers à un serveur FTP, vous trouverez qu'
Ali's ZIP 2 FTP Interface vous est assez utile! ;)
\n
ASTUCE II: une version de la même interface FTP qui utilise MySQL (et qui reste gratuit et à sources ouvertes) est aussi disponible.
Cliquez ici pour vous y rendre...";
//$content["tr"]["explain"]="FTP arayüzünün kullanımı son derece basittir: bir klasöre gitmek veya dosya indirmek için ikonuna tıklayın. Bir klasör veya dosyanın adını değiştirmek için yeni bir ad girin ve ENTER tuşuna basın (aynı normal dosya yönetim programınızda yaptığınız gibi) ... BİR DE, unutmayın ki bir şeyi download etmek istediğinizde ilk önce o şeyin FTP sunucusundan benim sunucuma download edilmesi gerekmektedir, dolayısıyla download'un sizin tarafınızda başlaması bazen zaman alabilir.
Bir de, sizinle ilgili bilgilerin (hele de PAROLAnızın) YOK EDİLDİĞİNDEN emin olmak için işiniz bittiğinde BAĞLANTIYI BİTİR düğmesine tıklamayı unutmayın!
Limitler: dosya boy limiti downloadlar için dosya başına $dlLimit MB, uploadlar için de dosya başına $ulLimit MB'dir.
\n
İPUCU: eğer amacınız bir FTP sunucusuna bol miktarda dosya yollamak ise,
Ali's ZIP 2 FTP Interface'i bayağı faydalı bulabilirsiniz! ;)
\n
İPUCU II: bu FTP arayüzünün MySQL kullanan bir sürümü de mevcuttur (ve aynı bu sürüm gibi ücretsiz ve açık kaynaklıdır). Görmek için
buraya tıklayın...";
$content["en"]["reconnect"]="
\nClick to
restart connection with the FTP server";
$content["fr"]["reconnect"]="
\nCliquez pour
redémarrer la connexion avec le serveur FTP";
$content["tr"]["reconnect"]="
\nFTP sunucusuna
tekrar bağlanmak için tıklayın";
$content["en"]["sessionDEL"]="
\n(session has been DESTROYED, pressing the BACK button of your browser will not help)";
$content["fr"]["sessionDEL"]="
\n(la session a été DETRUITE, donc utiliser le bouton EN ARRIERE de votre browseur est inutile)";
$content["tr"]["sessionDEL"]="
\n(session YOK EDİLMİŞTİR, dolayısıyla browser'ınızın GERİ düğmesini tıklamak boşuna olacaktır)";
$content["en"]["emptysession"]="
HUGE ERROR: session data empty".$content["en"]["reconnect"].$content["en"]["sessionDEL"];
$content["fr"]["emptysession"]="
ERREUR GIGANTESQUE: données de session vides".$content["fr"]["reconnect"].$content["fr"]["sessionDEL"];
$content["tr"]["emptysession"]="
KOCAMAN HATA: session bilgileri boş".$content["tr"]["reconnect"].$content["tr"]["sessionDEL"];
$content["en"]["nosession"]="
HUGE ERROR: session data mismatch".$content["en"]["reconnect"].$content["en"]["sessionDEL"];
$content["fr"]["nosession"]="
ERREUR GIGANTESQUE: données de session différentes".$content["fr"]["reconnect"].$content["fr"]["sessionDEL"];
$content["tr"]["nosession"]="
KOCAMAN HATA: session bilgileri uyumsuz".$content["tr"]["reconnect"].$content["tr"]["sessionDEL"];
$content["en"]["ftpfail1"]="
HUGE ERROR: FTP connection to
";
$content["en"]["ftpfail2"]=" on port
";
$content["en"]["ftpfail3"]=" as
";
$content["en"]["ftpfail4"]=" failed
\nError was: nonexistent server or wrong or unsupported settings (user name, password, use passive mode, ...)".$content["en"]["reconnect"].$content["en"]["sessionDEL"];
$content["fr"]["ftpfail1"]="
ERREUR GIGANTESQUE: connexion FTP vers
";
$content["fr"]["ftpfail2"]=" sur le port
";
$content["fr"]["ftpfail3"]=" en tant que
";
$content["fr"]["ftpfail4"]=" impossible
\nCause: serveur nonexistant ou réglages invalides ou non-supportés (login, mot de passe, mode passif, ...)".$content["fr"]["reconnect"].$content["fr"]["sessionDEL"];
$content["tr"]["ftpfail1"]="
KOCAMAN HATA:
";
$content["tr"]["ftpfail2"]=" adlı sunucunun
";
$content["tr"]["ftpfail3"]=" numaralı portundan
";
$content["tr"]["ftpfail4"]=" olarak FTP bağlantısı kurulamadı
\nNedeni: sonucu yok veya ayarlar yalnış veya desteklenmiyor (kullanıcı adı, parola, pasif mod, ...)".$content["tr"]["reconnect"].$content["tr"]["sessionDEL"];
$content["en"]["logoutOK"]="Disconnect OK";
$content["fr"]["logoutOK"]="Déconnection OK";
$content["tr"]["logoutOK"]="Bağlantı başarıyla sonlandırıldı";
$content["en"]["connectedTo"]="Connected to";
$content["fr"]["connectedTo"]="Connecté à";
$content["tr"]["connectedTo"]="Şu anki bağlantı";
$content["en"]["disconnect"]="Disconnect";
$content["fr"]["disconnect"]="Déconnecter";
$content["tr"]["disconnect"]="Bağlantıyı kes";
$content["en"]["currentFold"]="Der Aktuelle Ordner";
$content["fr"]["currentFold"]="Le classeur courant est";
$content["tr"]["currentFold"]="Şu anki klasör";
$content["en"]["multipleUpl"]="Upload multiple files";
$content["fr"]["multipleUpl"]="Uploader plusieurs fichiers";
$content["tr"]["multipleUpl"]="Bir çok dosya yolla";
$content["en"]["alertPwd"]="Note that your FTP password will not be transmitted to the ZIP2FTP interface, you will therefore have to re-enter it";
$content["fr"]["alertPwd"]="Notez que votre mot de passe ne sera pas transmis à l'interface ZIP2FTP, vous devrez donc le re-rentrer";
$content["tr"]["alertPwd"]="NOT: parolanız ZIP2FTP arayüzüne yollanmayacaktır, dolayısıyla onu tekrar girmeniz gerekmektedir";
$content["en"][".."]="Einen Ordner nach oben";
$content["fr"][".."]="Aller au classeur parent";
$content["tr"][".."]="Bir üst klasöre git";
$content["en"]["changeMode1"]="";
$content["fr"]["changeMode1"]="Voir en ";
$content["tr"]["changeMode1"]="";
$content["en"]["changeMode2"]=" viewing mode";
$content["fr"]["changeMode2"]="";
$content["tr"]["changeMode2"]=" görünümü";
$content["en"]["createFold"]="Neuen Ordner erstellen";
$content["fr"]["createFold"]="Créer un nouveau classeur";
$content["tr"]["createFold"]="Yeni klasör yarat";
$content["en"]["create"]="Create";
$content["fr"]["create"]="Créer";
$content["tr"]["create"]="Yarat";
$content["en"]["upl1"]="Datei hochladen";
$content["fr"]["upl1"]="Uploader le fichier";
$content["tr"]["upl1"]="Bu dosyayı yolla";
$content["en"]["upl2"]="und specihern als";
$content["fr"]["upl2"]="et sauvegarder en";
$content["tr"]["upl2"]="ve bu ad ile kaydet";
$content["en"]["upl3"]="Hochladen";
$content["fr"]["upl3"]="Uploader";
$content["tr"]["upl3"]="Upload et";
$content["en"]["upl4"]="Dateinamen eingeben";
$content["fr"]["upl4"]="entrer un nom de fichier";
$content["tr"]["upl4"]="dosya adı girin";
$content["en"]["empty"]="folder is empty";
$content["fr"]["empty"]="le classeur est vide";
$content["tr"]["empty"]="klasör boş";
$content["en"]["clickFold"]="Click to go to folder";
$content["fr"]["clickFold"]="Cliquez pour aller au classeur";
$content["tr"]["clickFold"]="Klasöre gitmek için tıklayın";
$content["en"]["renFold"]="Type a new name and press ENTER to rename this folder";
$content["fr"]["renFold"]="Tapez un nouveau nom et appuyez sur ENTREE pour renommer ce classeur";
$content["tr"]["renFold"]="Bu klasörün adını değiştirmek için yeni bir ad girin ve ENTERa basın";
$content["en"]["rmFold"]="Ordner löschen";
$content["fr"]["rmFold"]="Effacer le classeur";
$content["tr"]["rmFold"]="Klasörü sil";
$content["en"]["changePerm"]="Change the text and press ENTER to change permissions";
$content["fr"]["changePerm"]="Changez le texte et appuyez sur ENTREE pour changer les permissions";
$content["tr"]["changePerm"]="Hakları değiştirmek için yazıyı değiştirip ENTERa basın";
$content["en"]["changePermPHP5"]="
Error: changing permissions requires at least PHP 5!
Click here for Ali's FTP Interface run using a PHP 5 server...";
$content["fr"]["changePermPHP5"]="
Erreur: pour changer les permissions, il faut au moins PHP5!
Cliquez ici pour une version de l'Interface FTP d'Ali fonctionnant sur un serveur PHP 5...";
$content["tr"]["changePermPHP5"]="
Hata: hakları değiştirmek için PHP 5 gerekli! Ali'nin FTP Arayüzü'nün PHP 5 kullanan bir sunucudaki sürümü için
buraya tıklayın...";
$content["en"]["KB"]="KB";
$content["fr"]["KB"]="KO";
$content["tr"]["KB"]="KB";
$content["en"]["MB"]="MB";
$content["fr"]["MB"]="MO";
$content["tr"]["MB"]="MB";
$content["en"]["GB"]="GB";
$content["fr"]["GB"]="GO";
$content["tr"]["GB"]="GB";
$content["en"]["noDL"]="You probably will not be able to download this file";
$content["fr"]["noDL"]="Vous ne pourrez probablement pas télécharger ce fichier";
$content["tr"]["noDL"]="Bu dosyayı büyük ihtimalle indiremeyeceksiniz";
$content["en"]["noSize"]=$content["en"]["noDL"].": its size is unknown";
$content["fr"]["noSize"]=$content["fr"]["noDL"].": sa taille est inconnue";
$content["tr"]["noSize"]=$content["tr"]["noDL"].": dosya boyu bilinmiyor";
$content["en"]["tooBig"]=$content["en"]["noDL"].": its size is too big";
$content["fr"]["tooBig"]=$content["fr"]["noDL"].": c'est trop gros";
$content["tr"]["tooBig"]=$content["tr"]["noDL"].": çok büyük";
$content["en"]["dlFail"]="Download failed! :(";
$content["fr"]["dlFail"]="Echec lors du téléchargement! :(";
$content["tr"]["dlFail"]="Dosya indirilemedi! :(";
$content["en"]["dlFile"]="Click to download file";
$content["fr"]["dlFile"]="Cliquez pour télécharger le fichier";
$content["tr"]["dlFile"]="Dosyayı indirmek için tıklayın";
$content["en"]["renFile"]="Type a new name and press ENTER to rename this file";
$content["fr"]["renFile"]="Tapez un nouveau nom et appuyez sur ENTREE pour renommer ce fichier";
$content["tr"]["renFile"]="Bu dosyanın adını değiştirmek için yeni bir ad girin ve ENTERa basın";
$content["en"]["rmFile"]="Datei löschen";
$content["fr"]["rmFile"]="Effacer le fichier";
$content["tr"]["rmFile"]="Dosyayı sil";
$content["en"]["rmFoldAlert"]="Are you sure you want to delete this folder and all its contents";
$content["fr"]["rmFoldAlert"]="Etes-vous sur de vouloir effacer ce classeur et tout son contenu";
$content["tr"]["rmFoldAlert"]="Bu klasörü ve tüm içeriğini silmek istediğinize emin misiniz";
$content["en"]["rmFileAlert"]="Are you sure you want to delete this file";
$content["fr"]["rmFileAlert"]="Etes-vous sur de vouloir effacer ce fichier";
$content["tr"]["rmFileAlert"]="Bu dosyayı silmek istediğinize emin misiniz";
$content["en"]["fileName"]="Name";
$content["fr"]["fileName"]="Nom";
$content["tr"]["fileName"]="Ad";
$content["en"]["owner"]="Owner";
$content["fr"]["owner"]="Propriétaire";
$content["tr"]["owner"]="Sahibi";
$content["en"]["perm"]="Permissions";
$content["fr"]["perm"]="Permissions";
$content["tr"]["perm"]="İzinler";
$content["en"]["fileLastMod"]="Last modified";
$content["fr"]["fileLastMod"]="Dernière modification";
$content["tr"]["fileLastMod"]="En son değiştirilme";
$content["en"]["fileSize"]="Size";
$content["fr"]["fileSize"]="Taille";
$content["tr"]["fileSize"]="Boyut";
//$content["en"]["end"]="This page has been optimized for a minimal resolution of 800x600 pixels\n
\nThis is a multilingual, completely free and Open Source (or OpenSource) software / script. Please click here to get its source code [written in PHP].\n
\nAli's HTTP to FTP interface (PHP session edition) created by Savas Ali Tokmen";
//$content["fr"]["end"]="Cette page a été optimisée pour une résolution minimale de 800x600 pixels\n
\nCeci est un programme / logiciel / script qui est multi-langues, complètement gratuit et à sources ouvertes (Open Source). Vous pouvez cliquer ici pour télécharger le code source, écrit en PHP.\n
\nL'interface HTTP vers FTP d'Ali (édition avec les sessions PHP) crée par Savas Ali Tokmen";
//$content["tr"]["end"]="Bu sayfa en az 800x600'lük bir çözünürlük için tasarlanmıştır\n
\nBu yazılım / program / script çok dilli, tamamen bedava ve açık kaynaklıdır (Open Source). PHP'de yazılmış kaynak kodunu indirmek için lütfen buraya tıklayın.\n
\nAli'nin HTTP üzerinden FTP arayüzü (PHP session sürümü) Savaş Ali Tokmen tarafından yaratılmıştır";
$content["en"]["genTime1"]="Page generated in ";
$content["fr"]["genTime1"]="Page générée en ";
$content["tr"]["genTime1"]="Bu sayfa ";
$content["en"]["genTime2"]=" seconds";
$content["fr"]["genTime2"]=" secondes";
$content["tr"]["genTime2"]=" saniyede yaratıl";
//$content["en"]["zipped"]=" and sent using ZIP compression";
//$content["fr"]["zipped"]=" et envoyée en utilisant la compression ZIP";
//$content["tr"]["zipped"]="ıp ZIP sıkıştırma ile yollanmıştır";
$content["en"]["notZipped"]="";
$content["fr"]["notZipped"]="";
$content["tr"]["notZipped"]="mıştır";
if($do=="getSource"){
$scriptName=unfilterHTML($scriptName);
$user_agent=strtolower($_SERVER["HTTP_USER_AGENT"]);
header("Content-type: application/force-download");
if((is_integer(strpos($user_agent,"msie")))&&(is_integer(strpos($user_agent,"win")))){
header("Content-Disposition: filename=\"$scriptName\"");
}else{
header("Content-Disposition: attachment; filename=\"$scriptName\"");}
header("Content-Description: File Transfert");
readfile($scriptName);
//if(strpos($user_agent,"bot")===false && strpos($_SERVER["SERVER_NAME"],"alishomepage.com")===false){
//mail("opensource@alishomepage.com","FTP Interface (PHP session edition): another one downloaded ","This part will be referred to when the browser sends out no referrer information\n\nServer name: ".$_SERVER["SERVER_NAME"]."\nScript name: ".$_SERVER["SCRIPT_NAME"]."\nTranslated path: ".$_SERVER["PATH_TRANSLATED"]."\n\nDownloader's info (the referrer is most useful, user agent is to detect bots)\n\nUser agent: ".$_SERVER["HTTP_USER_AGENT"]."\nReferrer: ".$_SERVER["HTTP_REFERER"]."\nRequest URL: ".$_SERVER["REQUEST_URI"],"From: \"Ali's Open Source Initiative\" <opensource@alishomepage.com>");}
die();}
// CLEAN VARIABLES
if($curFold){$curFold=str_replace(array("\\\"","\'","\\\\"),array("\"","'","\\"),$curFold);}
if($orgName){$orgName=stripslashes($orgName);}
if($rnName){$rnName=stripslashes($rnName);}
if($newName){$newName=stripslashes($newName);}
if($newFold){$newFold=stripslashes($newFold);}
if($sessID){$sessID=addslashes(stripslashes($sessID));}
$port=intval($port);if(!$port || $port<1 || $port>65535){$port=21;}
// CHOOSE DEFAULT LANGUAGE
if(!in_array($lang,$langs)){$lang=$langs[0];}
// THIS FUNCTION GETS MICROTIME... TO DISPLAY IT AT THE END OF THE PAGE
function getmicrotime(){
list($usec,$sec)=explode(" ",microtime());
return ((float)$usec+(float)$sec);}
define('PAGE_START_TIME', getmicrotime());
// THIS FUNCTION WILL LOWERCASE ARRAY AND ALSO REPLACE SOME CHARS
// SO THAT SORTING WORKS NORMALLY FOR NAMES CONTAININS THOSE CHARS
function arraytolowercase_standard($array){
$return=array();
for($i=0;$i
$return[$i]=strtolower(strtr($array[$i],"ÉÈÊÀÁÂÇĞİÖŞÜéèêàáâçğıöşü","eeeaaacgiosueeeaaacgiosu"));}
return $return;}
// PHP VERSIONS < 4.2.0 DID NOT HAVE TIMEOUT IN CONNECT
if(version_compare(phpversion(),"4.2.0")==-1){
function start_ftp_connection($host,$port){
return ftp_connect($host,$port);}
}else{
function start_ftp_connection($host,$port){
return ftp_connect($host,$port,30);}}
// FILE DOWNLOAD...
if($actionType=="file" && $doAction=="go"){
// session_name("sessID");
session_id($sessID);
session_start();
$sessInfo=array(
"ip" => $_SESSION["ip"],
"hostname" => $_SESSION["hostname"],
"username" => $_SESSION["username"],
"password" => $_SESSION["password"],
"port" => $_SESSION["port"],
"passive" => $_SESSION["passive"]);
session_write_close();
if($sessInfo["ip"]==$_SERVER["REMOTE_ADDR"]){
$tempName=strtolower(base_convert(rand(0,46656),10,36));
while(file_exists("_$tempName.tmp")){
$tempName=strtolower(base_convert(rand(0,46656),10,36));}
$hostname=$sessInfo["hostname"];
$username=$sessInfo["username"];
$password=$sessInfo["password"];
$port=$sessInfo["port"];
$usePassive=$sessInfo["passive"];
if($usePassive==1){$usePassive=true;}else{$usePassive=false;}
$conn_id=start_ftp_connection($hostname,$port);
if($conn_id && ftp_login($conn_id,$username,$password) && ftp_chdir($conn_id,$curFold) && ftp_size($conn_id,$orgName)<$dlLimit*1048576 && ftp_pasv($conn_id,$usePassive) && ftp_get($conn_id,"_$tempName.tmp",$orgName,FTP_BINARY) && ftp_quit($conn_id)){
$user_agent=strtolower($_SERVER["HTTP_USER_AGENT"]);
header("Content-type: application/force-download");
if((is_integer(strpos($user_agent,"msie")))&&(is_integer(strpos($user_agent,"win")))){
header("Content-Disposition: filename=\"$orgName\"");
}else{
header("Content-Disposition: attachment; filename=\"$orgName\"");}
header("Content-Description: File Transfert");
readfile("_$tempName.tmp");
unlink("_$tempName.tmp");
die();}}
unlink("_$tempName.tmp");
echo "";
die();}
// END OF "FILE DOWNLOAD" SECTION...
// SEND PAGE USING ZIP COMPRESSION...
ob_implicit_flush(0);
ob_start();
define('ZIP_IT',(extension_loaded('zlib') && (strstr($_SERVER["HTTP_ACCEPT_ENCODING"],'gzip') || strstr($useragent,'compatible') || strstr($useragent,'Gecko'))));
function cutLeadingSpaces($str){
while(substr($str,0,1)==" "){$str=substr($str,1);}
return $str;}
// RECURSIVE DIRECTORY REMOVER
function ftp_rec_rmdir($conn_id,$folder){
ftp_chdir($conn_id,$folder);
$folders=array();
$files=array();
$list=ftp_rawlist($conn_id,"");
for($i=0;$i
list($permissions,$next)=split(" ",$list[$i],2);
list($num,$next)=split(" ",cutLeadingSpaces($next),2);
list($owner,$next)=split(" ",cutLeadingSpaces($next),2);
list($group,$next)=split(" ",cutLeadingSpaces($next),2);
list($size,$next)=split(" ",cutLeadingSpaces($next),2);
list($month,$next)=split(" ",cutLeadingSpaces($next),2);
list($day,$next)=split(" ",cutLeadingSpaces($next),2);
list($year_time,$filename)=split(" ",cutLeadingSpaces($next),2);
if(strlen($filename)>0 && $filename!="." && $filename!=".."){
if(substr($permissions,0,1)=="d"){
$folders[]=$filename;
} else {
$files[]=$filename;}}}
for($i=0;$i
ftp_rec_rmdir($conn_id,$folders[$i]);}
for($i=0;$i
ftp_delete($conn_id,$files[$i]);}
ftp_cdup($conn_id);
ftp_rmdir($conn_id,$folder);}
echo "\n\n".$content[$lang]["title"]."\n\n".$content[$lang]["title"]."
\n";
if(($sessID && $sessID!="connect") || ($sessID=="connect" && $host && $user)){
// THERE'S A SESSION ID... SO THE USER IS/WILL BE LOGGED IN
if($do=="logout"){
session_name("sessID");
// session_id($sessID);
session_start();
session_unset();
session_write_close();
session_start();
session_destroy();
setcookie(session_name(),"",0,"/");
echo $content[$lang]["logoutOK"];
echo $content[$lang]["reconnect"];
}else{
if($sessID=="connect"){
// session_name("sessID");
// session_start();
// session_regenerate_id();
session_start();
$sessID=session_id();
function antiXSS($what){
return str_replace(array("&slash;","&"),array("\\","&"),stripslashes(str_replace(array("&","\\\\"),array("&","&slash;"),$what)));}
$_SESSION["ip"]=$_SERVER["REMOTE_ADDR"];
$_SESSION["hostname"]=antiXSS($host);
$_SESSION["username"]=antiXSS($user);
$_SESSION["password"]=antiXSS($pass);
$_SESSION["port"]=$port;
$_SESSION["passive"]=intval($usePassive);
session_write_close();}
session_name("sessID");
// session_id($sessID);
session_start();
$sessInfo=array(
"ip" => $_SESSION["ip"],
"hostname" => $_SESSION["hostname"],
"username" => $_SESSION["username"],
"password" => $_SESSION["password"],
"port" => $_SESSION["port"],
"passive" => $_SESSION["passive"]);
session_write_close();
if($sessInfo["ip"]==$_SERVER["REMOTE_ADDR"]){
$hostname=$sessInfo["hostname"];
$username=$sessInfo["username"];
$password=$sessInfo["password"];
$port=$sessInfo["port"];
$usePassive=$sessInfo["passive"];
if($usePassive==1){$usePassive=true;}else{$usePassive=false;}
$conn_id=start_ftp_connection($hostname,$port);
if($conn_id && ftp_login($conn_id,$username,$password)){
// CHANGE FOLDER, PERMISSIONS, RENAME, DELETE, CREATE FOLDER AND UPLOAD AS NEEDED + GET FILELIST
if($curFold){ftp_chdir($conn_id,$curFold);}
$curFold=filterHTML(ftp_pwd($conn_id));
if($actionType=="folder" && $doAction=="go"){
if($orgName==".."){
$result=ftp_cdup($conn_id);
}else{
$result=ftp_chdir($conn_id,$orgName);}
if($result){
$curFold=filterHTML(ftp_pwd($conn_id));}}
if($doAction=="ch" && strlen($rnName)>8){
if(version_compare(phpversion(),"5.0.0")==-1){
// PHP VERSION < 5 DON'T HAVE FTP_CHMOD OR FTP_RAW OR STRIPOS
echo $content[$lang]["changePermPHP5"]."
";
}else{
$possPerms="rwx";
$cPerms=0;
for($i=3;$i>0;$i--){
$current=substr($rnName,strlen($rnName)-3);
for($j=0;$j<3;$j++){
if(false!==stripos($current,$possPerms[$j])){
$cPerms+=pow(2,$j)*pow(10,abs($i-3));}}
$rnName=substr($rnName,0,strlen($rnName)-3);}
ftp_chmod($conn_id,$cPerms,$orgName);}}
if($doAction=="rn"){ftp_rename($conn_id,$orgName,$rnName);}
if($actionType=="folder" && $doAction=="rm"){ftp_rec_rmdir($conn_id,$orgName);}
if($actionType=="file" && $doAction=="rm"){ftp_delete($conn_id,$orgName);}
if($newFold){ftp_mkdir($conn_id,$newFold);}
ftp_pasv($conn_id,$usePassive);
if($_FILES["uplFile"] && $newName){ftp_put($conn_id,$newName,$_FILES["uplFile"]["tmp_name"],FTP_BINARY);}
$list=ftp_rawlist($conn_id,"");
ftp_quit($conn_id);
// FTP OPERATIONS ARE FINISHED AND CONNECTION CLOSED... ARRANGING FILELIST
$list=str_replace("&","&",$list);
$foldPerm=array();
$filePerm=array();
$folders=array();
$files=array();
$fileSizes=array();
$fileOwner=array();
$foldOwner=array();
$fileLastMod=array();
$foldLastMod=array();
for($i=0;$i
list($permissions,$next)=split(" ",$list[$i],2);
list($num,$next)=split(" ",cutLeadingSpaces($next),2);
list($owner,$next)=split(" ",cutLeadingSpaces($next),2);
list($group,$next)=split(" ",cutLeadingSpaces($next),2);
list($size,$next)=split(" ",cutLeadingSpaces($next),2);
list($month,$next)=split(" ",cutLeadingSpaces($next),2);
list($day,$next)=split(" ",cutLeadingSpaces($next),2);
list($year_time,$filename)=split(" ",cutLeadingSpaces($next),2);
if(strlen($filename)>0 && $filename!="." && $filename!=".."){
if(substr($permissions,0,1)=="d"){
$foldPerm[]=$permissions; // was "permisions" ... thank you, Tomas Kmieliauskas
$folders[]=$filename;
$foldOwner[]=$owner;
$foldLastMod[]=$day." ".$month." ".$year_time;
} else {
$filePerm[]=$permissions;
$files[]=$filename;
$fileOwner[]=$owner;
$fileLastMod[]=$day." ".$month." ".$year_time;
$fileSizes[]=$size;}}}
$arrangerFold=arraytolowercase_standard($folders);
$arrangerFile=arraytolowercase_standard($files);
array_multisort($arrangerFold,$folders,$foldOwner,$foldLastMod);
array_multisort($arrangerFile,$files,$fileSizes,$fileOwner,$fileLastMod);
$foldersJS=str_replace("'","\\'",filterHTML($folders));
$foldersForm=filterHTML($folders);
$filesJS=str_replace("'","\\'",filterHTML($files));
$filesForm=filterHTML($files);
// PRINT CONTENTS
if($curFold==""){
$foldExplain="/";
}else{
if(strlen($curFold)<33){
$foldExplain=$curFold;
}else{
$foldExplain=unfilterHTML($curFold);
$foldExplain="...".filterHTML(substr($foldExplain,strlen($foldExplain)-33));}}
// PERHAPS THAT'S ONE OF THE WORLD'S LONGEST SINGLE-LINE "ECHO"S ... AND IT'S ONLY THE BEGINNING!!
echo "\n\n\n\n".$content[$lang]["connectedTo"]." ".filterHTML($username)." @ ".filterHTML($hostname)." | \n".$content[$lang]["disconnect"]." | \n".$content[$lang]["currentFold"]." $foldExplain |
\n";
if(!(sizeof($folders)+sizeof($files))){
echo "\n
(".$content[$lang]["empty"].")
";
}else{
if($dispMode=="detailed"){
// ECHO FILE LIST IN "DETAILED" MODE
$colors=array("F3F3F3","EEEEEE","F9F9F9","F3F3F3");
$count=0;
echo "\n\n | ".$content[$lang]["fileName"]." | ".$content[$lang]["perm"]." | ".$content[$lang]["owner"]." | ".$content[$lang]["fileLastMod"]." | ".$content[$lang]["fileSize"]." |
\n";
for($i=0;$i
echo " | | | ".$foldOwner[$i]." | ".$foldLastMod[$i]." | - |
\n";
$count++;}
for($i=0;$i
$currentFileSize=$fileSizes[$i]/1048576;
if($currentFileSize<1){
$currentFileSize*=1024;
$currentFileSize=substr("$currentFileSize",0,strpos("$currentFileSize",".")+3)." ".$content[$lang]["KB"];
}elseif($currentFileSize>1024){
$currentFileSize/=1024;
$currentFileSize=substr("$currentFileSize",0,strpos("$currentFileSize",".")+3)." ".$content[$lang]["GB"];
}else{
$currentFileSize=substr("$currentFileSize",0,strpos("$currentFileSize",".")+3)." ".$content[$lang]["MB"];;}
if(!$fileSizes[$i]){
$fileSubtitle=$content[$lang]["noSize"];
}elseif($fileSizes[$i]>$dlLimit*1048576){
$fileSubtitle=$content[$lang]["tooBig"];
}else{
$fileSubtitle=$content[$lang]["dlFile"];}
echo " | | | ".$fileOwner[$i]." | ".$fileLastMod[$i]." | $currentFileSize |
\n";
$count++;}
echo "
";
}else{
// ECHO FILE LIST IN "BIG ICON" MODE
$count=0;
echo "
\n\n";
for($i=0;$i
if($count && !($count%5)){echo "
\n\n";}
echo " | \n";
$count++;}
for($i=0;$i
$currentFileSize=$fileSizes[$i]/1048576;
if($currentFileSize<1){
$currentFileSize*=1024;
$currentFileSize=substr("$currentFileSize",0,strpos("$currentFileSize",".")+3)." ".$content[$lang]["KB"];
}elseif($currentFileSize>1024){
$currentFileSize/=1024;
$currentFileSize=substr("$currentFileSize",0,strpos("$currentFileSize",".")+3)." ".$content[$lang]["GB"];
}else{
$currentFileSize=substr("$currentFileSize",0,strpos("$currentFileSize",".")+3)." ".$content[$lang]["MB"];;}
if(!$fileSizes[$i]){
$fileSubtitle=$content[$lang]["noSize"];
}elseif($fileSizes[$i]>$dlLimit*1048576){
$fileSubtitle=$content[$lang]["tooBig"]." ($currentFileSize)";
}else{
$fileSubtitle=$content[$lang]["dlFile"]." ($currentFileSize)";}
if($count && !($count%5)){echo "
\n\n";}
echo " | \n";
$count++;}
echo "
";}}
}else{
// CONNECTION TO FTP SERVER FAILED!!
ftp_quit($conn_id);
echo $content[$lang]["ftpfail1"].filterHTML($hostname).$content[$lang]["ftpfail2"].$port.$content[$lang]["ftpfail3"].filterHTML($username).$content[$lang]["ftpfail4"];
session_name("sessID");
// session_id($sessID);
session_start();
session_unset();
session_write_close();
session_start();
session_destroy();
setcookie(session_name(),"",0,"/");}
}else{
// IP MISMATCH... HACK ATTEMPT? LET'S DESTROY THAT SESSION...
if($sessID)
{
session_name("sessID");
// session_id($sessID);
session_start();
session_unset();
session_write_close();
session_start();
session_destroy();
setcookie(session_name(),"",0,"/");
}
echo (strlen($sessInfo["ip"])>0 ? $content[$lang]["nosession"] : $content[$lang]["emptysession"]);}}
}else{
// THE USER DID NOT HAVE A SESSION ID... SO LET'S OUTPUT THE "LOGIN" FORM
echo "
".$content[$lang]["explain"];}
// LANGUAGE SELECTION
if($sessID){
echo "\n";
$howto1="javascript:setLang('";
$howto2="')";
}else{
echo "
";
$howto1=$scriptName."?lang=";
$howto2="";}
// END OF "LANGUAGE SELECTION"
// CALCULATE TIME
echo "\n".$content[$lang]["end"]."\n
";
$separ="";
for($i=0;$i
if($langs[$i]!=$lang){
echo "$separ".$langExps[$i]."";
$separ="Um ein Musikfile hochzuladen einfach auf go drücken und dann das File rechts oben mit durchsuchen auswählen. Wenn fertig dann Hochladen.
Wichtig keine größeren Dateien als 1mb hochladen, das kann dann probleme bereiten. Sollte die Datei größer sein versuch es vielleicht klappt es. Du befindest dich schon im Ordner Musik hier müssen die Songs rein sonnst geht es nicht. Bei Fragen wie gehabt Mail an mich anrufen.";}}
//echo "
\nhttp://contact.ali.tokmen.com
\nhttp://ali.tokmen.com\n
".$content[$lang]["genTime1"].substr(getmicrotime()-PAGE_START_TIME,0,6).$content[$lang]["genTime2"];
// COMPRESS OUTPUT AND SEND IT
if(ZIP_IT && !headers_sent()){
echo $content[$lang]["zipped"]."";
header('Content-Encoding: gzip');
$gzip_contents=ob_get_contents();
ob_end_clean();
$gzip_size=strlen($gzip_contents);
$gzip_crc=crc32($gzip_contents);
$gzip_contents=gzcompress($gzip_contents,9);
$gzip_contents=substr($gzip_contents,0,strlen($gzip_contents)-4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack('V',$gzip_crc);
echo pack('V',$gzip_size);
}else{
echo $content[$lang]["notZipped"]."";
ob_end_flush();}
// END OF THE FTP SCRIPT...
die();
?>
----------------------------------------------------------------------------------------------------------------------------