Jump to content

login.php links to ftp server, help! Profi needed(german speaking maybe?)


mtb211

Recommended Posts

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, 

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?

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 :P

 

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

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.