1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

can i password protect my web site ?

Discussion in 'Software Development' started by casper03, Dec 31, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. casper03

    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
     
  2. SavvyLady

    SavvyLady

    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
     
  3. casper03

    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
     
  4. SavvyLady

    SavvyLady

    Joined:
    Oct 14, 2001
    Messages:
    2,218
    casper you have to refresh from your browser while waiting
     
  5. SavvyLady

    SavvyLady

    Joined:
    Oct 14, 2001
    Messages:
    2,218
    oh... I did post before but deleted it... it was the wrong logo...
    Davey will send it
     
  6. casper03

    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"
     
  7. SavvyLady

    SavvyLady

    Joined:
    Oct 14, 2001
    Messages:
    2,218
    ok.... well it will be along soon I think... (the logo)
     
  8. nczman

    nczman

    Joined:
    Dec 12, 2000
    Messages:
    310
  9. casper03

    casper03 Thread Starter

    Joined:
    Nov 25, 2001
    Messages:
    272
    thank's 4 that i will look into that one
     
  10. SavvyLady

    SavvyLady

    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...
     
  11. Talismanic

    Talismanic

    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.
     
  12. casper03

    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.
     
  13. SavvyLady

    SavvyLady

    Joined:
    Oct 14, 2001
    Messages:
    2,218
  14. Talismanic

    Talismanic

    Joined:
    May 25, 2000
    Messages:
    409
    :D

    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.

    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.

    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.
     
  15. Sponsor

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 733,556 other people just like you!

Loading...
Similar Threads - password protect site
  1. alanh01
    Replies:
    2
    Views:
    486
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/63617

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice