For continued disscussion on this topic : Log In
kamilsey
08-16-2000, 02:44 PM
You people
its me again
right i have to make a log in dude thingy on my site and im just getting started in asp i know how to get data back and forth to a database. But how do i get asp to make a log in thingy like when you log in to hotmail or somit like that. well perhaps not that extensive well can anyone help
gzazJim
08-16-2000, 04:48 PM
Hi Kamilsey,
Below is a simple login page:
<HTML>
<HEAD>
<TITLE>Login Page</TITLE>
</HEAD>
<BODY>
<h1>Login Page</font></h1>
<FORM ACTION="CheckLogin.asp" METHOD=POST>
<TABLE>
<TR>
<TD>Login Name:<br>
<INPUT TYPE="text" NAME="Login"></TD>
</TR>
<TR>
<TD>Password:<br>
<INPUT TYPE="password" NAME="Pass"></TD>
</TR>
<TR>
<TD><INPUT TYPE=SUBMIT VALUE="Login>
<INPUT TYPE=RESET VALUE="Reset"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
The "CheckLogin.asp" page, which the above form calls, now checks Login information, and if it's correct creates and sets session variables for the authorized user (Note that the below code is ALL that the page should contain - nothing else is needed):
<%
dim strLogin
dim strPass
strLogin = request.Form("Login")
strPass = request.Form("Pass")
if (strPass = "session" and strLogin = "session")then
session("VaiidUser") = True
response.redirect "PasswordProtectedPage.asp"
else
response.redirect "Login.asp"
end if
%>
Finally, above all the HTML code for your "PasswordProtectedPage.asp", place the following:
<%@Language=VBScript%>
<%
If ((session("ValidUser")="") OR (session("ValidUser")="False")) Then
Response.Redirect "Login.asp"
End IF
%>
<HTML>
(etc...)
This will give you a very basic password-protected page. Please note that session variables are rather slow, so you may be better off setting a cookie and checking it's value instead. That's a bit more convoluted so let's stick with this one first!
Good luck!
Jim
[Edited by gzazJim on 08-18-2000 at 10:27 AM]
kamilsey
08-16-2000, 05:30 PM
yo gzaz jim
thanks 4 the reply ill try that one now
what does gzaz mean
kamilsey
08-16-2000, 05:35 PM
right theres only 1 thing i don't get where does it look for the valid user is it a file or a database
gzazJim
08-16-2000, 05:40 PM
Kamilsey,
The way it's set up, the second page (CheckLogin.asp) is the only place that checks the username and password. It's hard-coded into the page at the moment.
...and GZAZ is short for Ground Zero AriZona :)
Try the pages I've posted first, and once they're working, We'll get into how to access a database and pull out information.
Good Luck,
Jim
kamilsey
08-18-2000, 10:17 AM
yo Jim
Web design is hard with a massive hang over
ive put in and configed all that code there is only 1 thing that i cant get workin. when i put the right user name and pword in i get a cant find server error but its cant find CheckLogin.asp for some reason when i put in a wrong 1 it will redirect to Login.asp Ehats Going on there
Thanks 4 the help
kamilsey
08-18-2000, 10:59 AM
Yo Jim
i managed to do it but whats the Imagelogin.asp
whats page is that if i login i go straight through the page and back to the password.htm
kamilsey
08-18-2000, 02:04 PM
yo jim thanks for the help
i finaly done it its taken me the best part of today but i done it is there any chance you could show me the rest
gzazJim
08-18-2000, 05:03 PM
kamilsey,
Glad to hear you got it working. Now, when you say you want "the rest" - do you mean the DB stuff? I guess i haven't had enough coffee yet!
Thanks,
Jim
kamilsey
08-21-2000, 10:51 AM
yo jim
Im Ready to learn
teach teach
kina DB Stuff so people can log in and it will look to a database for the info and also it it could set up a session so they could change their details online type of thing
WillyBanjo
08-21-2000, 12:35 PM
Hi Kamilsey. Glad to hear your login is sorta working. A database-driven user magagement system (as posh buggers would call it) is a fair chunk of asp - you might want to try some of the resources here:
http://www.pageresource.com/asp/asp1.htm
Alternatively, a book like Wrox's "Beginning ASP 3.0" is a good investment.
Good luck
WB
gzazJim
08-21-2000, 06:05 PM
Hey all,
WB is right - the DB end of things in ASP can be a bear to review on-line. I agree with WB, and highly reccommend the WROX books - excellent value for the money. Another good Wrox book is "Beginning ASP Databases" - that's one I refer to on a regular basis. You also may want to have a look at http://www.aspin.com They have a number of decent websites and references on ASP.
Good luck Kam!
Jim
kamilsey
08-22-2000, 01:19 PM
YO WHATS UP PEPS
I looked at all the pages u suggested and am waiting for my credit card 2 come through to order some books they look pretty impressive.
Jim you said u can help me in changing the script to look at a database for the user names and passwords
any chance u can show me how
Thanks for all the help
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.