Results 1 to 8 of 8

Thread: Encryption and web

  1. #1
    Cybernetic Interloper ub3r_n00b's Avatar
    Join Date
    Feb 2003
    Location
    Rivendel, East of The Ford of Bruinen
    Posts
    2,086

    Encryption and web

    Alright, well here is the scoop... my IT teacher wants me to create a page where you can log into and go to a directory. He wants it to be fairly secure and have a Login Name and a password per each login. Now this doesnt have to be uber encrypted... but it would be nice so that i dont have to be like /view source oh passwords are...

    any clue what i should write this in?

    -Preet

  2. #2
    Regular Member
    Join Date
    Aug 1999
    Posts
    341
    If all your teacher wants is that functionality, and you are using the Apache webserver, then all you need is to use .htaccess. See this how-to.

  3. #3
    Regular Member catngo's Avatar
    Join Date
    Dec 2000
    Location
    Oklahoma City
    Posts
    213
    this is the most simple script for u/p login it needs 2 files. the script file and the text file to store username/pass. no registration allow though.

    1st file: xxxxxx.asp (login.asp)

    includelogin.asp:
    <%
    'include this on pages to protect
    ' (put it before the <html> tag):
    '<!--#include file="includelogin.asp"
    ' -->
    Response.Buffer = True
    function ValidateLogin(sId,sPwd)
    Dim FSObject
    Dim LoginFile

    Set FSObject = Server.CreateObject("Scripting.FileSystemObject")
    Set LoginFile = FSObject.OpenTextFile(Server.MapPath("passwords.txt"))
    ' change this To the path\name
    ' of the file that holds your passwords
    'DATA FORMAT In TEXT FILE: "username<SPACE>password"

    ValidateLogin = False

    While Not LoginFile.AtEndOfStream 'Scan the text file To determine if the user is legal
    if LoginFile.ReadLine = sID & " " & sPwd Then 'If username AND password are found,
    ValidateLogin = True ' You passed!

    End if
    Wend
    LoginFile.Close 'Close the text file
    Set LoginFile = Nothing 'free up objects
    Set FSObject = Nothing
    End function
    Dim sText
    Dim fBack
    fBack = False
    if Request.Form("dologin") = "yes" Then
    'Try To login
    if ValidateLogin( Request.Form("id"),Request.Form("pwd") ) = True Then
    'It is OK!!!
    'We are logged In so lets go back To the file that included us
    fBack = True
    Session("logonid") = Request.Form("id")
    Else
    sText = "Wrong User ID or Password"
    End if
    Else
    'We are Not trying To login...
    if Session("logonid") <> "" Then
    '
    fBack = True
    'We are logged In so lets go back To the file that included us
    Else
    sText = "Please login"
    End if
    End if
    if fBack = False Then %>
    <HTML>

    <HEAD>
    <META http-equiv="Content-Language" content="en">
    <META http-equiv="Content-Type" content="text/html; charset=windows-1252">

    <TITLE>You need To login</TITLE>

    </HEAD>
    <BODY>
    <%=sText%>
    <%
    Dim sURL
    sURL = Request.ServerVariables("SCRIPT_NAME")
    if Request.ServerVariables("QUERY_STRING") <> "" Then
    sURL = sURL & "?" & Request.ServerVariables("QUERY_STRING")
    End if
    %>
    <FORM method="POST" action="<%=sURL%>">
    <INPUT type="hidden" name="dologin" value="yes">
    <TABLE border="0">
    <TR>
    <TD>User ID:</TD>
    <TD><INPUT name="id" size="30"></TD>
    </TR>
    <TR>
    <TD>Password:</TD>
    <TD><INPUT type="password" name="pwd" size="30"></TD>
    </TR>
    </TABLE>

    <P><INPUT type="submit" value="Login" name="B1"></P>
    </FORM>
    </BODY>
    </HTML>
    <%
    Response.End
    End if
    %>


    2nd file: passwords.txt
    username1 password1
    username2 password2
    .
    .
    .


    if you have perl and/or php running, i have other easier script but don't know if your teacher allow using it. most school using asp.


    if you name the xxxxxx.asp anything differ from login.asp, make sure change the first line of the script to that name ex: includexxxx.asp

    any other page you want to have user login when access to it, just add includexxxxxx.asp before the <html> </html> tag

  4. #4
    Cybernetic Interloper ub3r_n00b's Avatar
    Join Date
    Feb 2003
    Location
    Rivendel, East of The Ford of Bruinen
    Posts
    2,086
    thnz... just a question.. does it acces a certain page or does it access a directory???

    and where in the coding is that?

    -Preet

  5. #5
    Banned Jon's Avatar
    Join Date
    Jun 2000
    Location
    3rd rock from the sun
    Posts
    882
    Are you looking to get a listing of the files in a given directory or actually copy a file to the directory?

  6. #6
    Cybernetic Interloper ub3r_n00b's Avatar
    Join Date
    Feb 2003
    Location
    Rivendel, East of The Ford of Bruinen
    Posts
    2,086
    I think its actually go to the directory, I told my IT teacher to frikin download an FTP program but he is like uh i dont wanna crack it.. and i want it to be student made and i was like WTF you want ME TO MAKE A FRIKIN FTP SERVICES PROGRAMM???? im 16!!!!
    you B************************p


    so yeah :P

    -Preet

  7. #7
    Banned Jon's Avatar
    Join Date
    Jun 2000
    Location
    3rd rock from the sun
    Posts
    882
    Are you going to have access to the server to set permissions on a given folder?

    I can give you a simple ASP login page which will forward you to another page which will gain access to an FTP directory.

  8. #8
    Cybernetic Interloper ub3r_n00b's Avatar
    Join Date
    Feb 2003
    Location
    Rivendel, East of The Ford of Bruinen
    Posts
    2,086
    yup.. and thanks

    -Preet

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •