logon pages

M

melissa

http://melissarawlings.co

Go to View your pictures link on home page. Go to Password-protected page. Logon as 'testuser' - the password is 'password

I can't figure out what my problem is once you hit logon, it is supposed to redirect to a page saying you are logged on as testuser...once you get the error page, you can hit back a couple times and there it is sometimes. I am not knowledgeable in code writing, can someone help me out
 
M

melissa

I believe it is supposed to go to a password protected page. Sorry, I feel ignorant on this, I just used a predesigned template off microsoft for a logon site. It had 4 pages to it, and the instructions said after you log in as testuser, it should go to the password protected page, but when I look at the code for the logon page, it says after checking the user and password it should redirect "back to the original page", which I am assuming means the default.asp page

----- Crash Gordon® wrote: ----

yah, sorry I noticed that after I posted my msg

where is the page the login is supposd to take you to

ps...I still love your site! Can't wait to see more of it

rob



| it is a sub domai
 
A

Andrew Murray

I can't get any log on prompt to come up - that page is not found!

as a testuser are we logging into a subweb?

| http://melissarawlings.com
|
| Go to View your pictures link on home page. Go to Password-protected page.
Logon as 'testuser' - the password is 'password'
|
| I can't figure out what my problem is once you hit logon, it is supposed to
redirect to a page saying you are logged on as testuser...once you get the error
page, you can hit back a couple times and there it is sometimes. I am not
knowledgeable in code writing, can someone help me out?
|
|
 
A

Andrew Murray

melissa said:
I believe it is supposed to go to a password protected page. Sorry, I feel
ignorant on this, I just used a predesigned template off microsoft for a logon
site. It had 4 pages to it, and the instructions said after you log in as
testuser, it should go to the password protected page, but when I look at the
code for the logon page, it says after checking the user and password it should
redirect "back to the original page", which I am assuming means the default.asp
page.
----- Crash Gordon® wrote: -----

yah, sorry I noticed that after I posted my msg.

where is the page the login is supposd to take you to?

ps...I still love your site! Can't wait to see more of it.

robo



| it is a sub domain


Can I suggest you try this Log-on script?

firstly the page with the form - two fields (type text) a username and password
field.
----- html page (logon form ---)

<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<!-- The Web Wiz Guide Login Script is written by Bruce Corkhill ©2001
If you want your own Login Script then goto
http://www.webwizguide.info -->


</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="518" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<h1>Login</h1>
</td>
</tr>
</table>
<br>
<br>
<br>
<br>

<form name="Login" method="post" action="check_user.asp">
<table width="273" border="0" align="center" cellspacing="0" cellpadding="0"
bgcolor="#CCCCCC">
<tr>
<td align="right" height="47" valign="bottom" width="94">User name: </td>
<td height="47" valign="bottom" width="172">
<input type="text" name="txtUserName" size="20">
</td>
</tr>
<tr>
<td align="right" width="94">Password: </td>
<td width="172">
<input type="password" name="txtUserPass" size="20">
</td>
</tr>
<tr>
<td align="right" height="44" width="94">&nbsp;</td>
<td height="44" width="172">
<input type="submit" name="Submit" value="Enter">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="Submit2" value="Reset">
</td>
</tr>
</table>
</form>
<br>
<center>
Session Cookies must be enabled<br>
<br>
<a href="http://www.webwizguide.info" target="_blank"><img
src="web_wiz_guide.gif" width="100" height="30" border="0" alt="Web Wiz
Guide!"></a>
</center>
</body>
</html>

--- check valid user page --- filename: "check_user.asp". -----

<%
'Dimension variables
Dim adoCon 'Database Connection Variable
Dim strCon 'Holds the Database driver and the path and name of the database
Dim rsCheckUser 'Database Recordset Variable
Dim strAccessDB 'Holds the Access Database Name
Dim strSQL 'Database query sring
Dim strUserName 'Holds the user name

'Initalise the strUserName variable
strUserName = Request.Form("txtUserName")

'Check the database to see if user exists and read in there password
'Initialise the strAccessDB variable with the name of the Access Database
strAccessDB = "users"

'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=letmein; DBQ=" &
Server.MapPath(strAccessDB)

'Set an active connection to the Connection object
adoCon.Open strCon

'Create a recordset object
Set rsCheckUser = Server.CreateObject("ADODB.Recordset")

'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblUsers.Password FROM tblUsers WHERE tblUsers.UserID ='" &
strUserName & "'"

'Query the database
rsCheckUser.Open strSQL, strCon

'If the recordset finds a record for the username entered then read in the
password for the user
If NOT rsCheckUser.EOF Then

'Read in the password for the user from the database
If (Request.Form("txtUserPass")) = rsCheckUser("Password") Then

'If the password is correct then set the session variable to True
Session("blnIsUserGood") = True

'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'Redirect to the authorised user page and send the users name
Response.Redirect"authorised_user_page.asp?name=" & strUserName
End If
End If

'Close Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing

'If the script is still running then the user must not be authorised
Session("blnIsUserGood") = False

'Redirect to the unautorised user page
Response.Redirect"unauthorised_user_page.htm"
%>


---- unauthorised user redirect page ----

can be whatever you like - it is an htm page and has a message 'unauthorised
access' etc but name it "unauthorised_user_page.htm" or simplify the name and
change the Response.Redirect in ASP code (above).

_____________________


---- authorised user page --- authorised_user.asp

Redirects to this when Password is matched against username, you can have
whatever you like here, but the essential code to have is

<%
'Dimension Variables
Dim strUserName 'Holds the name of the user

'Get the users name passed from the previous page
strUserName = Request.QueryString("name")
%>

which echos puts the value of the username variable to the screen.

------

If you need the logout, a logout script I 'guessed' at is something like

<%
session.abandon
response.redirect("/")
%>

I don't know if this is correct.....again - prewritten script.
-------

the above came from www.hotscripts.com in the ASP section.

In your case you probably want the 'authorised' page to be personalised to your
user, who is viewing a gallery of their work (or the work you do for them (?) ).

I'm not sure in this instance how to do that. I'm a novice at this ASP stuff.

The above is just a basic 'logon' and redirect to a new page with personalised
welcome message
 
Top