Tech Support Guy banner
Status
Not open for further replies.
1 - 14 of 14 Posts

·
Registered
Joined
·
272 Posts
Discussion Starter · #1 ·
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
 

·
Registered
Joined
·
2,218 Posts
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
 

·
Registered
Joined
·
272 Posts
Discussion Starter · #3 ·
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
 

·
Registered
Joined
·
2,218 Posts
casper you have to refresh from your browser while waiting
 

·
Registered
Joined
·
2,218 Posts
oh... I did post before but deleted it... it was the wrong logo...
Davey will send it
 

·
Registered
Joined
·
272 Posts
Discussion Starter · #6 ·
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"
 

·
Registered
Joined
·
2,218 Posts
ok.... well it will be along soon I think... (the logo)
 

·
Registered
Joined
·
2,218 Posts
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...
 

·
Registered
Joined
·
409 Posts
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):

<html>
<head>
<title>Password Form</title>
</head>
<body>
<div align="center">
<form method="post" action="login.asp">
<table border="0" cellspacing="1" width="600">
<tr>
<td colspan="2" width="592">
<p align="left"><font face="Verdana"><b>Log into my page</b></font></td>
</tr>
<tr>
<td width="81">
<p align="right"><font face="Verdana" size="2">User Name:</font></td>
<center>
<td width="505"><input type="text" name="uname" size="20"></td>
</tr>
</center>
<tr>
<td width="81">
<p align="right"><font face="Verdana" size="2">Password:</font></td>
<center>
<td width="505"><input type="text" name="pword" size="20"></td>
</tr>
<tr>
<td width="81">
</td>
<td width="505"><input type="submit" value="Submit" name="B1"></td>
</tr>
</table>
</form>
</center>
</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
%>
</body>
</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. <!-- #include file = "pwd.asp"--> like this (mainpage.asp):

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

Post back if you have more questions about this.
 

·
Registered
Joined
·
272 Posts
Discussion Starter · #12 ·
(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.
 

·
Registered
Joined
·
409 Posts
(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.
 
1 - 14 of 14 Posts
Status
Not open for further replies.
Top