 |
 |
| Coding Forum Problems with your code? Let's hear about it. |
|
 |
11-20-2003, 02:06 PM
|
#1 (permalink)
|
|
v7n Mentor
Join Date: 10-13-03
Location: Dallas, Texas, U.S.A.
Posts: 2,214
Latest Blog: None
|
Password protect pages - htaccess, php, cgi
Ok, I have an html log in form, here ( http://www.oliverswater.com/password.html), and everything works ok. The username is Joshua and the password is Dowdy. The login directs me to the page that i want it to, here, ( http://www.oliverswater.com/loginenter.html), so that works. But it truly is not password protecting anything because you could just go directly to http://www.oliverswater.com/loginenter.html and it doesn't ask you for a password or anything. Does anyone have a free script or know where one is that will only allow someone to get to a protected page through a login screen.
__________________
5Twelve Design
"The music that really turns me on is either running toward God or away from God. Both recognize the pivot, that God is at the center of the jaunt."
::: Bono :::
|
|
|
11-20-2003, 04:08 PM
|
#3 (permalink)
|
|
Inactive
Join Date: 10-13-03
Posts: 1,671
Latest Blog: None
|
wouldnt bother wiv cgi its old and has vunerabilties go fo php
|
|
|
11-20-2003, 05:30 PM
|
#4 (permalink)
|
|
Inactive
Join Date: 10-13-03
Location: New Zealand
Posts: 534
Latest Blog: None
|
Quote:
|
Originally Posted by AcRoNym
wouldnt bother wiv cgi its old and has vunerabilties go fo php
|
Not the most balanced or informative comment I've seen on this issue. There are many pros and cons of these technologies and there's plenty of information to help you decide which best suits your needs.
If you have no personal language preference, I think you should choose based on how well the script meets your needs, not the language it's written in.
|
|
|
11-20-2003, 08:59 PM
|
#5 (permalink)
|
|
v7n Mentor
Join Date: 10-13-03
Location: Dallas, Texas, U.S.A.
Posts: 2,214
Latest Blog: None
|
ya i agree dave, damn i'm still having trouble finding what i need
__________________
5Twelve Design
"The music that really turns me on is either running toward God or away from God. Both recognize the pivot, that God is at the center of the jaunt."
::: Bono :::
|
|
|
11-20-2003, 09:02 PM
|
#6 (permalink)
|
|
Inactive
Join Date: 10-13-03
Posts: 275
Latest Blog: None
|
You could set a cookie on the login page and use a redirect in the enter page if they don't have the cookie.
In ASP it might look something like this for the login page's action... maybe:
[code:1:b3e3e2b283]
<%
If password <> ('password') Then
Page.Location = "wrong.hml"
Else setCookie stuff....
Page.Location = "welcome.html"
End If
%>
[/code:1:b3e3e2b283]
Hope this helps.
|
|
|
11-21-2003, 04:36 AM
|
#7 (permalink)
|
|
Moderator
Join Date: 10-13-03
Location: UK
Posts: 2,821
Latest Blog: None
|
The only thing wrong with that Distorted, is it relies on the user having cookies enabled.
No I think an .htaccess based solution is best.
That way anyone trying to go directly to the protected files will be asked for username and password by their browser.
I'm not sure how the log-in page would pass the username and pass word, but it is possible to to go to http://usename:password@www.example.com/members/ and it will do the log-in if the username an pword are correct.
|
|
|
11-21-2003, 05:13 AM
|
#8 (permalink)
|
|
v7n Mentor
Join Date: 10-13-03
Location: Dallas, Texas, U.S.A.
Posts: 2,214
Latest Blog: None
|
thanks guys
__________________
5Twelve Design
"The music that really turns me on is either running toward God or away from God. Both recognize the pivot, that God is at the center of the jaunt."
::: Bono :::
|
|
|
11-21-2003, 07:44 AM
|
#9 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,137
Latest Blog: None
|
or on the protected file page you could have (this is php)
if ( !isset($username || $password) {
header (location: http://domain.com/sorry.html);
}
Essentially saying if those are not set then goto sorry.html
|
|
|
11-21-2003, 08:16 AM
|
#10 (permalink)
|
|
Moderator
Join Date: 10-13-03
Location: UK
Posts: 2,821
Latest Blog: None
|
where do $username and $password come from (when they are logged on)?
|
|
|
11-21-2003, 08:40 AM
|
#11 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,137
Latest Blog: None
|
Yep.. once they are logged on you can set those variables as global.. the problem with the html form though is that it gets put into the url many times - so it would all have to be php to hide the variables from the browser window.
|
|
|
11-21-2003, 08:50 AM
|
#12 (permalink)
|
|
Moderator
Join Date: 10-13-03
Location: UK
Posts: 2,821
Latest Blog: None
|
many times?
I tought it's just sent via POST to the file names in the action property?
|
|
|
11-21-2003, 12:58 PM
|
#13 (permalink)
|
|
v7n Mentor
Join Date: 10-13-03
Location: Dallas, Texas, U.S.A.
Posts: 2,214
Latest Blog: None
|
there we go, keep talkin guys, were getin somewhere, thanks alot
__________________
5Twelve Design
"The music that really turns me on is either running toward God or away from God. Both recognize the pivot, that God is at the center of the jaunt."
::: Bono :::
|
|
|
11-21-2003, 02:56 PM
|
#14 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,137
Latest Blog: None
|
By many times I mean often the variables can be visible..
with php it hides them as a server side function. It could be standard security / authorization script found at hotscripts..
|
|
|
11-25-2003, 06:42 AM
|
#15 (permalink)
|
|
Contributing Member
Join Date: 10-13-03
Location: Belgium
Posts: 322
Latest Blog: None
|
I have made a system that doesn't use .htaccess but i'm pretty sure it works for a 100%
I made it for the controlcenter of my website. I have a script on every page (with an include) that checks for a username and password in the database. The password and username from the login form are stored in a PHP session. I have made sure that cookies don't have to be enabled for it to work.
it's quite complicated though
if you want more info
mail me
grtz
DragonEye
|
|
|
11-29-2003, 01:28 AM
|
#16 (permalink)
|
|
Inactive
Join Date: 10-15-03
Location: Charlotte, NC
Posts: 537
Latest Blog: None
|
Just as an added note...
Sometimes the Web Hosting Provider will have built in password protection built into their control pannel for directories on your site.
|
|
|
11-29-2003, 06:41 AM
|
#17 (permalink)
|
|
Moderator
Join Date: 10-13-03
Location: UK
Posts: 2,821
Latest Blog: None
|
doesn't .htaccess cause thebrowser to prompt theuser for username and password?
How can you securely have the log-in fields on the page instead of the browser dialogue?
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:56 AM.
© Copyright 2008 V7 Inc
|
|
|