|
-
Apr 19th, 2000, 10:17 PM
#1
Thread Starter
Lively Member
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
-
Apr 19th, 2000, 10:27 PM
#2
Lively Member
Use vbscript and ASP. That's the easist way I found.
-
Apr 19th, 2000, 10:47 PM
#3
Thread Starter
Lively Member
Thanks damonous, I haven't used ASP before, but have to on another project anyway.
Cady
-
Apr 24th, 2000, 02:42 PM
#4
Frenzied Member
Do you still need help with this?
-
Apr 24th, 2000, 07:56 PM
#5
Thread Starter
Lively Member
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
-
Apr 24th, 2000, 08:34 PM
#6
Mark,
Please may you help me. I would like to be able to do this on my web site.
thanks
-
Apr 24th, 2000, 09:43 PM
#7
Frenzied Member
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]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|