Author |
Message |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 2:46 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Right!
I've just designed my PHP News Script, although the thing is anyone can access it by visiting the appropriate page on my site, and then can publish there articles, what I wanted to do, is get a box to pop up in internet explorer asking for a username and password to access the page (news.php), how would I do this?
Thanks
Justin |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Daniel
Team Member
![](images/rank_6.gif)
![](http://www.4webhelp.net/forums/images/daniel_avatar.php)
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 28, 2002 4:05 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Isn't it possible to use .htaccess Password Protection? |
________________________________
![Image Image](http://www.4webhelp.net/images/daniel_sig.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Daniel Find all posts by Daniel](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Darren
Team Member
![](images/rank_6.gif)
![](images/avatars/gallery/computers/apple.gif)
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun Apr 28, 2002 4:24 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
If its just one file could you hard code the username and password into the script.
How secure would this be? |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Darren Find all posts by Darren](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 4:29 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
403
Code: |
HTACCESS :
AuthName "The Kop Online News Administration"
AuthType Basic
AuthUserFile .htpasswd
Allow From All
<Files news.php>
Deny From All
</Files>
|
http://www.koponline.cc/news.php |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 4:31 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Darren wrote: | If its just one file could you hard code the username and password into the script.
How secure would this be? |
I'd rather have the pop-up box to be honest, so the visitors can't see the admin page! |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Darren
Team Member
![](images/rank_6.gif)
![](images/avatars/gallery/computers/apple.gif)
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun Apr 28, 2002 4:33 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Firstly do you need to provide the full path to the .htpassword file? I did when I set mine up.
Secondly, how did you generate the password? it took me several attempts with various scripts people had online before I found one that worked. |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Darren Find all posts by Darren](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
Daniel
Team Member
![](images/rank_6.gif)
![](http://www.4webhelp.net/forums/images/daniel_avatar.php)
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 28, 2002 4:34 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Try this?
Code: | <Files news.php>
AuthName "The Kop Online News Administration"
AuthType Basic
AuthUserFile .htpasswd
</Files>
|
|
________________________________
![Image Image](http://www.4webhelp.net/images/daniel_sig.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Daniel Find all posts by Daniel](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 4:39 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Daniel wrote: | Try this?
Code: | <Files news.php>
AuthName "The Kop Online News Administration"
AuthType Basic
AuthUserFile .htpasswd
</Files>
|
|
now it doesn't ask for any authentication, goes straight to the script ![Sad](/forums/images/smilies/icon_sad.gif) |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Darren
Team Member
![](images/rank_6.gif)
![](images/avatars/gallery/computers/apple.gif)
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun Apr 28, 2002 4:40 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
What about?
Code: | <?
if($username != "myusername" && $password != "mypassword") {
// Login form
//i.e. two text inputs with names 'username' and 'password' and a submit button
} else {
//your news script
}
?>
|
|
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Darren Find all posts by Darren](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 4:41 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Darren wrote: | Firstly do you need to provide the full path to the .htpassword file? I did when I set mine up.
Secondly, how did you generate the password? it took me several attempts with various scripts people had online before I found one that worked. |
The script is in the root directory, along with the .htaccess and .htpasswd file.
Generated the password using the tool suggested in the tutorial on this site! |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Daniel
Team Member
![](images/rank_6.gif)
![](http://www.4webhelp.net/forums/images/daniel_avatar.php)
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 28, 2002 4:41 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Well, try this then:
Code: | if ($password=="yourpassword") {
ALL YOUR CODE HERE
}
else {
print ("Please login."); |
Then access your script like this:
news.php?password=yourpassword
You'll then have to include the password in all links in your script, if there are any. |
________________________________
![Image Image](http://www.4webhelp.net/images/daniel_sig.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Daniel Find all posts by Daniel](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 4:44 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Daniel wrote: | Well, try this then:
Code: | if ($password=="yourpassword") {
ALL YOUR CODE HERE
}
else {
print ("Please login."); |
Then access your script like this:
news.php?password=yourpassword
You'll then have to include the password in all links in your script, if there are any. |
I may use that as a stopgap, but I really need a solution with a pop-up password box for a few clients that I am designing sites for, as the problem would be, as you can guess, people can see the password just by looking at the address bar if they are watching you. |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Daniel
Team Member
![](images/rank_6.gif)
![](http://www.4webhelp.net/forums/images/daniel_avatar.php)
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 28, 2002 4:46 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Could you password protect the whole directory (and if needed move the script to it's own directory)? |
________________________________
![Image Image](http://www.4webhelp.net/images/daniel_sig.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Daniel Find all posts by Daniel](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Justin
4WebHelp Addict
![4WebHelp Addict 4WebHelp Addict](images/rank_4.gif)
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Apr 28, 2002 4:48 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Justin Find all posts by Justin](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Send email Send email](templates/4WebHelp2/images/lang_english/icon_email.gif) |
![](images/spacer.gif) |
Darren
Team Member
![](images/rank_6.gif)
![](images/avatars/gallery/computers/apple.gif)
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun Apr 28, 2002 4:52 pm (22 years ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
Justin wrote: | I may use that as a stopgap, but I really need a solution with a pop-up password box for a few clients that I am designing sites for, as the problem would be, as you can guess, people can see the password just by looking at the address bar if they are watching you. |
Then do it my waywith a little form and use session variables to keep them logged in between pages. |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Darren Find all posts by Darren](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
|