mtb211 Posted December 17, 2008 Share Posted December 17, 2008 I am basically using a log in screen so my users can log into their secured folders(using htaccess,pwrd). I have an individual link for each user ie www.pointcloud.com/kunden/matt " "joe " "dingle" is there a way I can set the htaccess login popup to //kunden and when the user enters their name it will direct them to the correct folder? thank you... here is my code if it helps <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 "Enter user name and password please!" 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> if you want to tell me why this code sucks, feel free Matt Link to comment https://forums.phpfreaks.com/topic/137329-htaccess-login-popup-question/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.