| | |
|
|
|
CFML and Login Procedures |
| message from Bruce Cirrinone on 21 Jul 2004 |
I would like to require a User ID and Password for entry into the
Development area of my website.
My requirements are simple - each client will receive an ID and a Password -
for their entire organization to share. In addition, I'd like an Admin User
ID and PW that will allow access to all. I don't need an admin screen, as I
can change the data within Access itself.
I'm using DWMX04 on WinXP Pro, and the development language I'm trying to
learn is CFML. I've tried the tutotials I've found on the net, and
everything either seems too complicated or doesn't do what I need it to do.
It seems like it should be an easy project, but I'm stumped! Can someone
point me to a comprehensive tutorial, or some sort of CF extension or
something???
TIA!
|
| ~Angela, TMM replied to Bruce Cirrinone on 21 Jul 2004 |
Hi Bruce,
Here's some pretty easy steps for you below. Do let me know if you get stuck
anywhere.
1. Create a new table to hold your access levels.
intAccessID | txtAccessFriendlyName
1 | Admin
2 | User
3 | Guest
2. Create the login page. login.cfm
3. Click the (+) button in the Server behaviors panel and then choose User
Authentication> Login User
4. Complete the dialog (it is pretty straight forward). Be sure to choose
Restrict access based on username, password, and access level. Choose the
intAccessID field for the Get level from list.
5. Next, on any page (other than login.cfm) that you wish to restrict access
to, click the (+) button in the Server behaviors panel and then choose User
Authentication> Restrict Access To Page.
6. You will need to define your access levels. Use 1, 2, and 3 as the access
levels, not their friendly name. Why? A) Less code B)Hard to misspell a
number. C)You can change the friendly name if needed later without breaking
the authentication. You should only need to complete this step the first
time you apply the server behavior to a site.
7. Hold the shift key to select more than one access level. You'll ALWAYS
select 1 since it is your admin, and they need access to everything.
8. Get fancier by taking the code this generates and making an include out
of it. Then any time you need this access level combination, you just add
this include to a page and you won't have to go through applying the Server
behavior again.
Tip: I always create includes for each of the access level combinations I
need and name them according to the lowest level that is allowed. For
example, I would have incLevel1.cfm, incLevel2.cfm and incLevel3.cfm. If I
include incLevel2.cfm it will allow both level 1 and level 2. If I include
incLevel3.cfm it allows levels 1, 2, and 3.
Good luck!
~Angela
|
| Spiky replied to Bruce Cirrinone on 21 Jul 2004 |
If you have DMX2004 you can take advantage of the server behaviors to create
a login with username, password and level of authentication. Failing that,
get your hands on Oreilly's "Programming ColdFusion" or Ben Forta's
"ColdFusion MX Web Application Construction Kit". There are some exercises
on what you're looking for in both books.
bonne chance!
"Bruce Cirrinone" <mrbrucec@removeme.hotmail.com> wrote in message
news:cdm7b3$puh$1@forums.macromedia.com...
|
|
Archived message: CFML and Login Procedures (Macromedia Dreamweaver)