mtb211 Posted December 12, 2008 Share Posted December 12, 2008 Hey I need help creating a very very simple login screen. No forget password , register ,or remember me etc Im having a little issue creating this because i am a newbee to php programing I want a file named login.php when the user enters their name and password.. if its correct it will send them to their user name folder I have no need to create users since I already have users with their user name and password Ie user name is bob, password is 123 If this is correct then user name bob will be sent to the bob folder in the sub directory... Is this very simple to do? Link to comment https://forums.phpfreaks.com/topic/136656-help-creating-a-very-very-simple-login-screen/ Share on other sites More sharing options...
vbnullchar Posted December 12, 2008 Share Posted December 12, 2008 this will help http://www.phpeasystep.com/workshopview.php?id=6 Link to comment https://forums.phpfreaks.com/topic/136656-help-creating-a-very-very-simple-login-screen/#findComment-713542 Share on other sites More sharing options...
mtb211 Posted December 12, 2008 Author Share Posted December 12, 2008 hey thanks again, I am a bit of a novice but I dont think this will work The user name and passwords are created in an ERP system.. I dont think hes using a database because I can not find it in the code 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> I just need a log in screen that works with this code thanks again for the help Link to comment https://forums.phpfreaks.com/topic/136656-help-creating-a-very-very-simple-login-screen/#findComment-713547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.