Click to See Complete Forum and Search --> : Password lock


aangavatar101
06-03-2006, 05:28 PM
Is it possible to make a password lock on a page. When you enter it, it will ask you for a password :eek: !

Can that happen :confused:

Thanks

(Watch someone post something in a day!)

kiwibrit
06-03-2006, 06:16 PM
Have you tried htaccess (http://www.javascriptkit.com/howto/htaccess3.shtml)?

aangavatar101
06-04-2006, 08:48 AM
No, No, and No!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!
Thanks Again

the tree
06-04-2006, 09:44 AM
Was that "No I haven't tried it", "No, my host wont allow me to use .htaccess or doesn't use Apache" or "No, I don't want to use .htaccess, for whatever reason"?

Anyways, if check what your host has in the way of server-side technologies. I know that this is particuarly easy with PHP (epecially if you only want this for one page) and I'll bet that it isn't difficult with JSP or ASP either.

The PHP sollution would look an awful lot, like this:<?php
// change these two variables.

$username = 'Username';
$password = 'Password';

if ($PHP_AUTH_USER != $username or $PHP_AUTH_PW != $password){
header('WWW-Authenticate: Basic realm="Protected Page"');
header('HTTP/1.0 401 Unauthorized');

// Firstly, for those who *haven't* already entered the correct username + password
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Unauthorised</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>Unauthorised</h1>
<p>You haven't entered a correct password, go away.</p>
</body>
</html>
<?php }else{
// This section is for those who *have* entered the correct username + password
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Authorised</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>Authorised</h1>
<p>You've entered the correct pasword, well done.</p>
<p>Content, content, content.</p>
</body>
</html>
<?php } ?>

Mayham
06-04-2006, 11:08 AM
How does it works ?

the tree
06-04-2006, 11:12 AM
The awnser to that depends on your knowlege of how HTTP works, and your scripting experience.

In short, there's an if statement which looks for info sent in the request and there's a http header line send to those who haven't provided the user name + password, asking for one.

Mayham
06-04-2006, 11:14 AM
the biggest problem is i'm just started typing HTML don't know **** about HTTP
and my english sucks to read all those instructions i need a dutch user that can help me

the tree
06-04-2006, 11:22 AM
If you want to learn PHP then after making sure your host supports it, start learning the very basics at w3schools (http://www.w3schools.com/php/default.asp). You'll pick up what you need of HTTP as you go.

Mayham
06-04-2006, 11:23 AM
ow ok don't know of www.telenet.be support it ill check it

the tree
06-04-2006, 11:27 AM
I wouldn't know, I can't see anything on thier website that suggests they even do hosting.

Mayham
06-04-2006, 11:34 AM
look http://users.telenet.be/crashsite thats my website but my frames are in 150px and i need to change it in % (don't understand ****)

the tree
06-04-2006, 11:52 AM
Can't see any documents there, just an .mp3 file. But more to the point the free webspace that ISPs like to hand out rarely has support for server-side scripting such as PHP.

JPnyc
06-04-2006, 12:01 PM
Don't we have a member here from the netherlands? I could swear we do.

aangavatar101
06-04-2006, 04:07 PM
Ummm...

Am I in the middle of something?!?

:)

the tree
06-04-2006, 04:09 PM
No. Mayham just took your thread off on a tangent, it happens sometimes, "just like in real life".

aangavatar101
06-04-2006, 04:12 PM
From last post - here is the awnser!

This is real life

Mayham
06-04-2006, 04:47 PM
srry i can start a new topic if u like

about my site i have uploaded my pages
and no telenet = my internet provider and can't handle php files

i have made every page in a different color
tell me what is the best
don't want to add a BG IMG because those often load slowly


shall i start new topic ?


can anyone edit my frames in %

the tree
06-05-2006, 03:52 AM
Mayham Yeh, maybe you shuold start a new topic.

aangavatar101, not it isn't, don't be silly.

Mayham
06-05-2006, 11:28 AM
started new topic in siterevieuws

aangavatar101
06-05-2006, 03:20 PM
DONT START A NEW TOPIC!!!

How dare you tree :mad:

the tree
06-05-2006, 04:34 PM
I've done something wrong? Well that is interesting, but it doesn't mean my nick should loose it's definate article.
Well, happy hacking, I'm going to leave this thread until it starts making sense again.

aangavatar101
06-06-2006, 03:28 PM
the tree: I'm going to leave this thread until it starts making sense again.
Mee to :) :)

(Know i started this thread)

aangavatar101
06-07-2006, 03:27 PM
Tree:
I'm going to leave this thread until it starts making sense again.
>_<
U mad everybody leave,
for an update check Text Over Image