mtb211 Posted December 9, 2008 Share Posted December 9, 2008 I have about 50 folders for 50 different clients that access these folders from seperate links. so basically customer "joe smith" will go to www.mywebsite.com/Jsmith and enter his password is there a way i can create a user name and login in www.mywebsite.com so when the user enters the correct name and password it will direct him to the correct folder instead of me sending out 50 different links, it would be easier to just have 1 link thank you in advance Matt Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/ Share on other sites More sharing options...
Maq Posted December 9, 2008 Share Posted December 9, 2008 When they fill out the the user/pass form, just submit the form to itself and redirect with the user concatenated to the end of the URL. Just make his user the same as his folder. Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710559 Share on other sites More sharing options...
mtb211 Posted December 9, 2008 Author Share Posted December 9, 2008 my php is a bit bad... So I create this code within the login button? ps. Im living in germany at the moment, but im actually from west chester pa right near philadelphia about 30 miles, small world Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710565 Share on other sites More sharing options...
premiso Posted December 9, 2008 Share Posted December 9, 2008 Yep, there are alot of ways. MySQL db is probably the most common and secureist. You could even have a text file of username:password / linktoredirect and just put each new user on a different and hash the password. This is the unsafeway as anyone could potentially read the file unless it is put in the right spot. You could even just hardcode the username/passwords on the php page in a multi-dimm array like this: $usersPass = array(array("username" => "jack", "password" => "md5hash of password", "redirect" => "urltoredirecto"), array("username" => "john", "password" => "md5hash of password", "redirect" => "urltoredirecto")); foreach ($usersPass as $userArr) { if ($userArr['username'] == $_POST['username'] && $userArr['password'] == md5($_POST['password'])) header("location: " . $userArr['redirect']); } It just depends on how secure you want it. My preference, MySQL. Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710568 Share on other sites More sharing options...
Maq Posted December 9, 2008 Share Posted December 9, 2008 ps. Im living in germany at the moment, but im actually from west chester pa right near philadelphia about 30 miles, small world That's funny, I go to West Chester University. Very small world... Example (*not tested): if(isset($_POST['submit'])) { $username = $_POST['username']; header( 'Location: http://www.mywebsite.com/$username' ) ; } ?> </pre> <form method="post" action="<?php%20%24_SERVER%5B'PHP_SELF'%5D;%20?>><br%20/>%0A<input%20type=" text name="username"> </form> <b So, in essence, whatever they type in for their user name is going to be what folder they're redirected to. Best way to do this is the use of a DB. Of course you need to validate, error check, check passwords etc. but this should give you an idea. Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710576 Share on other sites More sharing options...
mtb211 Posted December 9, 2008 Author Share Posted December 9, 2008 thanks guys.... I still dont fully understand because my iq is 50. So i create a user name and password on a php page and when I login I just add this code to the page? I took a few classes at west chester, I took java there... since i failed java 2 times at albright I took it at west chester and got a b- ... we didnt have to hand write the code at wc... it was sweet... my teacher was asian .. you had thet guy? Matt ps whered you go to high school? Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710585 Share on other sites More sharing options...
Maq Posted December 9, 2008 Share Posted December 9, 2008 I still dont fully understand because my iq is 50. Bummer... So i create a user name and password on a php page and when I login I just add this code to the page? How do you check the user name/password in the first place? we didnt have to hand write the code at wc... it was sweet... my teacher was asian .. you had thet guy? Hand write code... The only hand-written code were on exams. There are a lot of asian teachers, I've had a couple, do you remember his name? ps whered you go to high school? Penncrest Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710591 Share on other sites More sharing options...
mtb211 Posted December 9, 2008 Author Share Posted December 9, 2008 I can not remember his name... All i remember is he was asian and he taught java 101 O yeah i know penncrest, I went to malvern.. small world the user name and password are checked in my index.php file you can grab the file here if youd like http://www.evoluted.net/community/code/directorylisting.php Quote Link to comment https://forums.phpfreaks.com/topic/136218-listing-filesphp-made-easier/#findComment-710610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.