Baby Jai
08-09-2003, 06:27 PM
how do you integrade a login box for htacess so this way they dont have to click on a link to get into the restricted section?
|
Click to See Complete Forum and Search --> : htaccess intergrade??? Baby Jai 08-09-2003, 06:27 PM how do you integrade a login box for htacess so this way they dont have to click on a link to get into the restricted section? brendandonhue 08-09-2003, 09:48 PM Heres a javascript implementation of it http://javascript.internet.com/navigation/htaccess-login.html pyro 08-09-2003, 10:00 PM Which would be very easily ported over to PHP, which will keep it working for those without javascript enabled. brendandonhue 08-09-2003, 10:09 PM In that case <?php $username = $_POST['username']; $password = $_POST['password']; $server = $_POST['server']; $htsite = "http://" . $username . ":" . $password . "@" . $server; header("Location: $htsite"); ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <input type="hidden" name="server" value="www.domain.com/secure/"> Username: <input type=text name=username size=20> <br><br> Password: <input type=password name=password size=20> <input type="submit" value="Login"> </form> Baby Jai 08-10-2003, 07:59 AM i see how it starts with PHP, but its not PHP, its a regular (.htaccess) file. Will this integrade with it? brendandonhue 08-10-2003, 09:09 AM Yes. Baby Jai 08-10-2003, 10:11 AM what do i have to change for it to work brendandonhue 08-10-2003, 12:55 PM The URL of your protected area. Baby Jai 08-17-2003, 09:07 PM I see that this is mainly on a php server side, do i have to name the page that i pout this on a .php file or can ikeep it .html, also another thing is i dont see it calling the htaccess file? brendandonhue 08-17-2003, 09:11 PM its a .php file, or whatever the extension is for PHP on your server. Don't doubt it, just try the script, it ought to work :) pyro 08-17-2003, 09:13 PM For the server to parse PHP, it generally needs to have a .php extention. You can change this in the .htaccess file, but why? Also, it is not using anything special to log in, basically this: http://username:password@www.yourdomain.com/securedirectory Baby Jai 08-17-2003, 09:17 PM Ok im trying to get a html to get to another directory instead of using a pop up box, here is my current script, and when i input the info, it bring me to the directory afte ri put it in the box, but its not directed to my file wehre the paswords are?? <form name=login> <div align="center"> <input type="hidden" name="server" value="www.babyjai.com/members/"> Username: <input type=text name=username size=20> Password: <input type=password name=password size=20> <input type=button value="Login!" onClick="Login(this.form)" name="button"> </div> </form> brendandonhue 08-17-2003, 09:24 PM Wha? What "file where the passwords are" are you talking about? Have you tried the script i wrote in my above post? Baby Jai 08-17-2003, 09:24 PM see but if i do this they will be able to view source and see the file that hold the password correct? Baby Jai 08-17-2003, 09:27 PM look man this is what im saying, I have an HTML file that I do not want to convert to PHP. It would be too much trouble the way I have my site set up. So I would liek to integrade this into my site. But the problem is, it doesnt work. That is the code that im using. Is there somethign wrong with it"? What im saying is it isnt check the htaccess txt filke with that code. YOu can enter anything and it still goes to the site, but then the pop up comes along. So that script isnt working. That is the HTML code i have in there. Tell me what im missing pyro 08-17-2003, 09:33 PM Try the code brendandonhue posted above (in a PHP file) and check if it works. If it does, we can go from there... Baby Jai 08-17-2003, 09:39 PM i did it in a html file and it works great, tell me if you see any bugs, Here (http://www.babyjai.com/members.html) pyro 08-17-2003, 09:41 PM I see you used the javascript method. That will not work for 13% of web users. Also, unless you provide a sample username and password, we really don't have any way of testing it... webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |