mtb211 Posted December 4, 2008 Share Posted December 4, 2008 Hi all, Currently we have a small erp system that holds information about our customers on our localhost. When you create a user name and password a php file named erstill.php(I dont know if i spelled that correct,its german) communicates with the ftp server, creates a folder for the user so they can access their files. When you type in the ftp address and input your UN and PW you can access everything fine. My boss wants to create a login system off our webpage, so when the username and password is inputed it will automatically direct you to the correct ftp folder(currently a simple ftp list, and my boss wants a windows explorer look to it). This I understand with this index.php code i added to the folder here is the code <? echo "Hier sind die Bereitgestellten Dateien<br><br>"; $action=opendir("./"); while($datei=readdir($action)){ if(!preg_match("!(\.|\..)$!", $datei)){ if ($datei!="index.php" && $datei!=".htaccess" && $datei!=".htpasswd" ) { echo " <a href=\"$datei\"> $datei</a><br>"; } } } ?> The problem is I cant even contemplate how to create a webpage with a logon and it sends you to the correct ftp folder Thanks in advance if anyone responds to this, Link to comment https://forums.phpfreaks.com/topic/135492-loginphp-links-to-ftp-server-help-profi-neededgerman-speaking-maybe/ Share on other sites More sharing options...
Mr_J Posted December 4, 2008 Share Posted December 4, 2008 What os will be used? try using explorer.exe of the os to give it the "explorer look" if using ie7, good luck I would do: 1: make shortcut to %windir%\explorer.exe ftp://USERNAME: [email protected]/public_html/folder 2: make a form or button or alike to <a href=" as above " Hope it helps? Link to comment https://forums.phpfreaks.com/topic/135492-loginphp-links-to-ftp-server-help-profi-neededgerman-speaking-maybe/#findComment-705847 Share on other sites More sharing options...
mtb211 Posted December 4, 2008 Author Share Posted December 4, 2008 The OS is windows wow you sound brillant and make that seem very simple.. Im currently using IE6, so i create a shortcut in the erstill.php? Then I create an h ref and paste that link it and everything will work? sounds way too good to be true made some haste with that response.. I know its hard to work with an inferior but could you walk me through the first step? i believe i understand the second Link to comment https://forums.phpfreaks.com/topic/135492-loginphp-links-to-ftp-server-help-profi-neededgerman-speaking-maybe/#findComment-705851 Share on other sites More sharing options...
mtb211 Posted December 4, 2008 Author Share Posted December 4, 2008 the file was called erstell.php here is the code <html> <head> <title>Unbenanntes Dokument</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $dir = $uname; $user = $_POST['user']; $pass = $_POST['pass']; // Aktuelles Verzeichnis ermitteln $thisdir = str_replace(strrchr($_SERVER['SCRIPT_FILENAME'],'/'), '', $_SERVER['SCRIPT_FILENAME']); // Gewünschtes Verzeichnis erstellen $oldumask = umask(0); mkdir($dir,0777); umask($oldumask); // Daten für .htaccess erstellen $htaccess = 'AuthType Basic AuthUserFile '.$thisdir.'/'.$dir.'/.htpasswd AuthName "Geschuetzer Bereich" order deny,allow allow from all require valid-user'; // Daten für .htpasswd erstellen $htpasswd = $uname.':'.crypt($pw, substr(md5(uniqid(rand())), 0, 2)); // Testdatei erstellen (wird angezeigt beim erfolgreichen Login) $handle = fopen($dir.'/index.php', 'w'); fwrite($handle, ' <? echo "Hier sind die Bereitgestellten Dateien<br><br>"; $action=opendir("./"); while($datei=readdir($action)){ if(!preg_match("!(\.|\..)$!", $datei)){ if ($datei!="index.php" && $datei!=".htaccess" && $datei!=".htpasswd" ) { echo " <a href=\"$datei\"> $datei</a><br>"; } } } ?>'); fclose($handle); // .htaccess erstellen $handle = fopen($dir.'/.htaccess', 'w'); fwrite($handle, $htaccess); fclose($handle); // .htpasswd erstellen $handle = fopen($dir.'/.htpasswd', 'w'); fwrite($handle, $htpasswd); fclose($handle); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/135492-loginphp-links-to-ftp-server-help-profi-neededgerman-speaking-maybe/#findComment-705868 Share on other sites More sharing options...
mtb211 Posted December 5, 2008 Author Share Posted December 5, 2008 no one? The advice was helpful above, It is used as more of a link then an actual log in screen.. anyone know how to use a log in screen in a web browser that links to ftp Link to comment https://forums.phpfreaks.com/topic/135492-loginphp-links-to-ftp-server-help-profi-neededgerman-speaking-maybe/#findComment-706665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.