Results 1 to 7 of 7

Thread: Sign in page...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66

    Question

    Have any of you used VB to create a sign in/log in page for a website, with a database to store the username and password? If so any suggestions on the best and fastest way to do it? You can email me directly if you want or post here. Thanks!
    Cady

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Location
    Fort Lauderdale, FL USA
    Posts
    112
    Use vbscript and ASP. That's the easist way I found.
    Damonous

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66
    Thanks damonous, I haven't used ASP before, but have to on another project anyway.
    Cady

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Do you still need help with this?
    Mark
    -------------------

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Virginia Beach
    Posts
    66

    Smile

    Mark, actually it turned out to be a stand alone sign in page to be put on a lap top and the information was saved in a file. My boss ended up doing it because I was too busy! I have many questions regarding the project that I am currently working on though, so any help with that would be wonderful. The project is a search engine that started out pretty simple but has gotten more complicated by the day.
    Thanks,
    Cady

  6. #6
    Guest

    Wink

    Mark,

    Please may you help me. I would like to be able to do this on my web site.

    thanks


  7. #7
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    for rlculver

    Ok here goes:

    You need a server that will host Active Server Pages.

    I use http://www.ewebcity.com so go there and open an account as a "General User" - don't worry it is free!

    Once you've don that you'll need an Access 97 database with fields:

    username, password,lastlogin and anything else you want.

    call it users.mdb and
    put it in a directory called db on your ewebcity site.


    copy this code to a file called login.asp

    the line:

    Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\rlculver\db\users.mdb"))

    needs to contain your account name. Here I've put in rlculver but you'll open an account with a better name than that though!


    Code:
    <%@ Language=VBScript %>
    <%
    dim username
    dim password
    dim strSQL
    dim rst
    username = request("txtUser")
    password = request("txtPass")
    
    	strSQL = "SELECT * FROM Users WHERE Username = '" & username & "' AND password = '" & password & "';"
    
    	Set Conn = Server.CreateObject("ADODB.Connection")
    	
    	'next line is for on site 
    	Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\rlculver\db\users.mdb"))
    	
    	'this line is devmode
    	'Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\users.mdb")
    
    	Set rst = Conn.Execute(strSQL)
    %>
      <html>
      <head>
      <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
      <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
     
       
    	</head>
      
      <body BGCOLOR="#FFFFFF" BACKGROUND="">
      <center><BR><BR>
     <%
    if rst.eof then
    'login fail
    
    %>
    
    	<form name="form1" method="post" action="login.asp">
     	<table width="75%" cellpadding="0" cellspacing="0">
     	<tr><td><FONT face="Verdana, Arial" color="#000080">This site may only be viewed by authorised users.
     	<p>Click <a href="mailto:someone@somewhere">here</a> to request a User ID or login below.</font><p><br></td></tr>
    
     	<tr><td align="center">
       <b>Enter your User ID:</b>  <input name="txtUser" size="10" maxlength="10"><BR>
       <b>and Password:</b> <input type = password name="txtPass" size="10" maxlength="10">
       <input type="submit" value="Login.asp">
     </td></tr>
     </table>
     </form>
    
    
    <%
    else
    'login sucessful...
    
    
    %>
    
    
    <FONT SIZE="2" FACE="arial, helvetica" color="#0000ff"><b>Login successful</b></font>
        <p><b>Good 
    
    <%
    if (hour(now()) > 0) and (hour(now()) < 12) then%>
    
    	Morning
    <%else%>
    	Afternoon
    <%end if%>
    
    <%=rst("username")%>
    
    
    
    
     <p><b>You may now proceed.</b>
    	
        <p>Click <A HREF="http://rlculvers_pornsite">here</a> to proceed.
        <p><br><FONT SIZE="2" FACE="arial, helvetica" size="1" face="Verdana, Arial">Last login on: <%=rst("LastLogin")%></font>
    <%
    
    strSQL = "UPDATE Users set LastLogin = '" & Now() & "' WHERE Username = '" & username & "'"
    conn.Execute(strsql)
    
    
    %>
    
    
    </b>
    
      
    <%end if
    
    set rst = nothing
    set conn = nothing
    
    
    %>
    </CENTER>
    </body>
    </html>
    Ok it need some formatting but it works.

    On you own website use put a frame in the default page
    index.htm, or default.htm usually

    with the source pointing to your ewebcity .....\login.asp page.


    a sucessfull login will give access to a set hyperlink. You could change this so the link is stored in the database and each user is sent somewhere else.


    to do this change the line:
    <p>Click <A HREF="http://www.rlculvers_pornsite">here</a> to proceed.

    to

    <p>Click <A HREF="<%=hyperlink%>">here</a> to proceed.

    where hyperlink is a field name in your database.

    [Edited by Mark Sreeves on 04-25-2000 at 03:47 PM]
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width