• 0

how do you make a sign up section so people have to log into your webs


Question

How would I go about making a sign up thing for my site so that when people they have to sign in as a registered user. I really have no idea where to start with the scripting. Anyone know how I would do this?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

i won't get into all the details. i'll assume that you can figure out

how to do these steps in the middleware language of your choice.

1. decide how you are going to store usernames/passwords (i'd

suggest database)

2. add an include to all the files you want to protect that points to

another script file. (i use "security_check.asp")

3. have that file (security_check.asp), look for something that

only registered users will have (such as a cookie or session variable)

4. if they dont have it, then they get redirected to a login page. if

they have it, they get the page they asked for

5. create a login page that submits to something that will query

the database to see if that user exists. if they do, then write a

cookie or a session variable* to store something unique about them)

*note about session variable.

don't be afraid to use session and application variables like some

panicky programmers might tell you. just use discretion. if your

a high traffic site, then its prob. not a good idea to use session

vars. but if you are doing client admin tools or custom web

applications, then the there's nothing wrong with using the most

efficient programatic methods.

here's an example in vb script:

<%

' ensure the user is allowed to see this page

if request.cookies("clientID") = "" then ' no userid has been entered so kick the user to the login

 p = request.servervariables("PATH_INFO") ' myredirect

 response.redirect "login.asp?page=" & p

end if

%>

i send some information back to the login page, so i can send the

user to the original page they asked for, once they've logged in.

save that as "security_check.asp" and you would put the following

at the top of each page you want to protect:

you can translate that method to any of the popular middleware

languages (php,coldfusion,jsp). you could probably even do it

with javascript!

hope that helps!!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.