can i password protect my web site ?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

casper03

Thread Starter
Joined
Nov 25, 2001
Messages
272
does anyone know how i would do this as im building a web site
for the use of family and freinds and would like to resrict the access of unwanted users.....
relatively simple instructions as poss please !
treat me like an idiot "ive earned it "

sorry i forgot to mention i would like to restrict access after the index page so that it will be possibble to see that right away
but then require password to accesss the rest of the site
 
Joined
Oct 14, 2001
Messages
2,218
good morning casper... sent Davey ( the maker of the logo ) a message & he will send it to u or me one.



about the question.. you need to ask inm our domain about that
 

casper03

Thread Starter
Joined
Nov 25, 2001
Messages
272
sorry savy ! but if your reply is to this post and you have posted something i cannot see it . or am i just missing something here
lol
 
Joined
Oct 14, 2001
Messages
2,218
oh... I did post before but deleted it... it was the wrong logo...
Davey will send it
 

casper03

Thread Starter
Joined
Nov 25, 2001
Messages
272
sorry about that savy lady i keep forgeting that one
and im working on the web site just now
so even more forgetfull than usual "sorry"
 
Joined
Oct 14, 2001
Messages
2,218
you can post a javascript on the page that stops right clicks... but it doesn't stop an experienced user from getting copies of say photos...
 
Joined
May 25, 2000
Messages
409
casper03

Here is a simple app to "protect" a website. In my example I used ASP and Access to store and retrieve passwords but you could embed them into the page just as easy. The advantage of using Access is that you can store multiple names and passwords.

To make this work you need a database with one table and two fields. I named the database YourDatabase.mdb, the table tblUsers and the two fields uname and pword.

Now you need three asp pages. The first would be the form for user name and password and it should look like this (login.asp):

<p>&lt;html>
&lt;head>
&lt;title>Password Form&lt;/title>
&lt;/head>
&lt;body>
&lt;div align="center">
&lt;form method="post" action="login.asp">
&lt;table border="0" cellspacing="1" width="600">
&lt;tr>
&lt;td colspan="2" width="592">
&lt;p align="left">&lt;font face="Verdana">&lt;b>Log into my page&lt;/b>&lt;/font>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td width="81">
&lt;p align="right">&lt;font face="Verdana" size="2">User Name:&lt;/font>&lt;/td>
&lt;center>
&lt;td width="505">&lt;input type="text" name="uname" size="20">&lt;/td>
&lt;/tr>
&lt;/center>
&lt;tr>
&lt;td width="81">
&lt;p align="right">&lt;font face="Verdana" size="2">Password:&lt;/font>&lt;/td><br>
&lt;center>
&lt;td width="505">&lt;input type="text" name="pword" size="20">&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td width="81">
&lt;/td>
&lt;td width="505">&lt;input type="submit" value="Submit" name="B1">&lt;/td>
&lt;/tr>
&lt;/table>
&lt;/form>
&lt;/center>
&lt;/div>
<%
Const adLockOptimistic = 3
Const adCmdTable = &H0002
Dim objRs, bolFound, objConn, strUsername, strPassWord
Set objconn = Server.CreateObject("ADODB.Connection")
objconn.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & _
Server.MapPath("/fpdb/YourDatabase.mdb")
objconn.Open

strUserName = Request.Form("uname")
strPassWord = Request.Form("pword")

If ((Request.Form("uname") = "") Or (Request.Form("pword") = "")) Then
objConn.Close
Set objConn = Nothing
Else
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open "tblUsers", objConn, , adLockOptimistic, adCmdTable
bolFound = False

Do Until objRs.EOF Or bolFound
If (strComp(objRs("uname"), strUserName, vbTextCompare) = 0) _
And (strComp(objRs("pword"), strPassWord, vbTextCompare) = 0) Then
bolFound = True
Else
objRs.MoveNext
End If
Loop

If Not bolFound Then
objRs.Close
Set objRs = Nothing
ObjConn.Close
Set objConn = Nothing
Response.End
End If
session("loggedin") = true
Response.Redirect ("mainpage.asp")
objRs.Close
Set objRs = Nothing
objConn.Close
Set objConn = Nothing
End If
%>
&lt;/body>
&lt;/html>

Then you need the page to check to see wether the user has created a session. (pwd.asp):

<%
Response.Buffer = true
Session.Timeout = 03
if session("loggedin") = false then
session("calling_page") = Request.ServerVariables ("URL")
Response.Clear
Response.Redirect ("login.asp")
end if
%>

Now you can put this in any page that you want to protect. &lt;!-- #include file = &quot;pwd.asp&quot;--&gt; like this (mainpage.asp):

&lt;!-- #include file = "pwd.asp" -->&nbsp;
&lt;html>
&lt;head>
&lt;title>My protected page&lt;/title>
&lt;/head>
&lt;body>
&lt;p>You made it to the page&lt;/p>
&lt;/body>
&lt;/html>


Post back if you have more questions about this.
 

casper03

Thread Starter
Joined
Nov 25, 2001
Messages
272
(proudly showing his idiot certificate)
i have a couple of question's:
what is ASP ?
is access (microsoft's) ?
can all of these actions be done using frontpage, as it is about the only one im comfortable using as im only learning as i go along here.
 
Joined
May 25, 2000
Messages
409
(proudly showing his idiot certificate)
:D

what is ASP ?
ASP stands for Active Server Pages and it is basicaly a scripting language that allows you to do things interactively on a website. The syntax is very similar to VB or VBA. It requires a server/host that supports ASP but most IIS hosts do just check your hosts FAQ for information about whether they do or not.

is access (microsoft's) ?
Yes it is, if it is not an option you can just embed the passwords into your script. It will work the same but will not be as flexible.

can all of these actions be done using frontpage, as it is about the only one im comfortable using as im only learning as i go along here.
Yup, FrontPage is a great place to start but if you want do a lot of ASP you are going to want to get used to a editor because FrontPage doesn't have a lot of the "features" that make code editors very popular. I still use FrontPage to set up my forms and tables and then switch to an editor to do my scripts.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top