Username Stamp

G

Guest

Right now I have a very basic password protect setup. I have password
protected a folder with a utility that is provided by my host lunar pages. I
have stuck a form in that folder that only registered users can have access
to.

However I need their username and password on the form. Is their a
relatively easy way to set up a folder in frontpage with a form as the
default page in the folder and have their username that they entered to get
into the folder stamped onto the form somewhere when it is submitted so that
I can file the form results correctly.

I am trying to get a way from having them manually enter their username and
password again on the form. It doesn't seem very professional on my end when
they have to enter it twice in a row.

Thanks.

I am using FP 2003, on a Unix host (Lunar Pages) that supports FP Extensions
 
M

MikeR

Without knowing the ins and outs of the utility your host provides, it's
impossible to say if what you want is doable.
IMHO a better approach would be to set up a database on the host, and use whatever
scripting language the host supports to implement a solution. That is not a
press-the-button-and-it's-done method, but if you decide to go that way, there are
a bunch of people here who could answer specific questions when you hit a snag. Or
possibly write it for you for a fee. It would be a much more flexible and scalable
solution. There is a blue ton of tutorial material on the web, once you figure
what to look for.
MikeR
 
G

Guest

Thanks for the response Mike. I will explain what I am doing.

I have a pick the winners contest for football games. I want people to make
their picks, but I want to know where the picks are coming from, so I can
sort them accordingly.

I could just have people put their username and password on the top of the
form and I can check it manually, but I wanted to do something a little more
professsional, like having them log in to a password protected folder,and
accessing the form within the folder without having to type in their username
or password again.

I guess what I could do is just give everybody access to the form(picks) and
then have them enter their username and password on the form. What I would
like to do then is to have that form validate the username/password.

Any ideas on this approach. I am not very familiar with MySQL, but I am
sure it will have something to do with that, since my host doesn't support
Access.

I think that is the only way that I can have the username and password
validated?

Thanks again.
 
M

MikeR

IF your host supports ASP, here's one approach.
Create a folder to hold all this. Create a login page(form) to accept user and
password. In the action for the form, put in an asp page like pw.asp <form
METHOD="POST" ACTION="pw.asp">. Name this one either index.htm or default.htm
(whatever your host has set up as "home pages").

Create pword.asp and in HTML view delete everything and paste this in. The lines
that begin with a ' are comments.
I'm not familiar with MySQL. The example is for an Access db. The principal is the
same, the details will vary.

Beware word wrap. If you do a copy and paste of this stuff, paste it into Notepad
first, then copy and paste it to FP.

<%
Option explicit
Dim UID pwin, conxtemp, sql, PWRS
'response.write "Here " & request.form & "<br>"
'response.end
'response.write "user pword <br>"

' Here are the user name and passwort from the form page
pwin = Ucase(request("pword"))
UID = UCase(request("user"))
'response.write "User= " & request("user") & " pword= " & pwin
'response.end

'Below is the connection to an access db. You'll have to
'work out the details of connecting to the MySQL db

set conxtemp=server.createobject("adodb.connection")
conxtemp.Mode = 3

conxtemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\DB\mydatabase.mdb")

'This line tries to retrieve a matching user and pword from the db.
'Your syntax may vary
sql="select * from tablename where Password = '" & pwin & "' and user = '" & UID
& "';"
'response.write sql & " <br>"
'response.end

'This reads the userid and pw into PWRs
set PWRS=conxtemp.execute(SQL)
'response.write "user= " & request("user")
'response.write "<br> pw= " & PWrs("user")
'response.end

If UCase(PWRs("user")) = UID and UCase(PWRs("password")) = pwin and not PWRS.EOF then
session("OK") = "TRUE"
response.redirect "/finalpage.asp"
end if
end if
'If no match, direct 'em to a page telling 'em so.
session("OK") = "FALSE"
response.redirect "badpw.htm"
%>

Create the page you want them to end up on (finalpage.asp) and in HTML view put
this at the very top. If anybody tries to go straight to this page, it will
redirect them to the login page
<%
If session("OK") <> "TRUE" THEN
response.redirect "default.htm"
End If
%>

I'm hazy on Iding a user for the picks sort.
Store their real name or nickname in the db and pass it along to the final page so
it can greet them?

Enhancement for later maybe -
An ASP admin interface to the DB so you can edit it on-line.

Anyway, food for thought.
MikeR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top