Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Restricting access

From: Dynamic Dreamweaver Websites: Creating Login Areas

Video: Restricting access

We need to add the Restrict Access To Page server behavior to our administrative interface. And when we do that we want to make sure only admin users in the admin role in our database have access to these pages. And right now we just have four pages so it's fairly easy to do this. I'm going to start at the Admin Home page and in our Server Behaviors panel I'm going to restrict access to the page. Now I don't have to be in any specific location on the page. Unlike our Insert new record or our other Server Behaviors that we've attached specifically to the button on a form.

Restricting access

We need to add the Restrict Access To Page server behavior to our administrative interface. And when we do that we want to make sure only admin users in the admin role in our database have access to these pages. And right now we just have four pages so it's fairly easy to do this. I'm going to start at the Admin Home page and in our Server Behaviors panel I'm going to restrict access to the page. Now I don't have to be in any specific location on the page. Unlike our Insert new record or our other Server Behaviors that we've attached specifically to the button on a form.

This one is immediately going to test for that log in as a admin. So we don't have to specify any particular area of the page. I will click Server Behaviors. Go down to User Authentication, and I'm going to say Restrict Access To Page. Now within this area, I'm not just going to restrict to user name and password. But I'm also going to restrict their access level. So I'm going to check the second option for our admin area. Now we don't have any levels set up in here so I'm going to click the Define button to set those up and our name is going to be admin. These are the roles in the database we're going to allow. The other role will be a guest.

Once you type it in click the plus sign and you can see we now have two roles available. Once I click Okay, I now have them listed in here. So you can add more than just two. We just need two for this particular site. So the level of access that connects us this page is only admin. If access is denied, we will send them to the Login page.

So if they can't login and access this page, we'll send them here to login again. Now we may want to set up another page that says only administrations can access this page, or whatever you want to do. I'm just using Log In for this course. So I will click Okay. Now you've selected a security method. Either the Login page does not have this, or no user log has been accessed.

So in other words when I have people logging in, they aren't logging in based on a particular user. So let's check this out. I will click Okay. Notice we have Restrict Access to page Admin. Now, we're sending them to the Login page to test that. So let's go down to the Login page. This is what Dreamweaver was trying to warn you of. In our log in area, if we select that in our log in user. Notice we don't have admin.

So let's double check that. So here we are. We have this all set up and restrict access based on user name and password. This is why we're getting that message. So what we need to do is tell Dreamweaver within its security area when they log in, test their access level. We don't have that defined if we're using this top button. So we need to put into our programming where to get that level, and that's what that message was all about. So I'm changing my Login page for everybody to test their level. Now we can Save all of this.

If I go to Admin Home I'll preview it in the browser. If I'm not logged in, I will put my name in here. I'll type it in and lets see what happens. I got to the members area. Now can I get to the admin home area? This page here. So instead of Members Home, I will go to Admin Home, notice I can't. I registered on the website, I am only a guest level access, so I know I'm being blocked.

Now I could go out and check the database. In order to fully test this page, I will look at our log in area, view the data, I am in here another time as Admin. This time, my email address is uniquevacations, password candice. So let me go out and test that one So, Candace@uniquevacations.com.

Password of Candace. I go to the member area. So, if I go back out to this, my role is admin. I should be able to get to the admin area from this page. So, we'll try that one more time. Notice I'm in Admin Home. Let me Close all of these up. If you keep your browser windows open, sometimes it can get confusing when you're trying to test.

So make sure whatever browser you're in, close all of your windows. So we'll try this one more time. Now what should happen, is this Administrative Area I should be led to the log in page. Now our Administrative Area does not seem to be working correctly, and it's because of a very minor issue that I want to point out to you. And what we have done is set up Admin Home, to Insert a New User, and in our user insert they can be added as guest or admin.

This works with the Insert Record and Check New Username area. So that works just fine. But when I go to log in. If I try and log in as admin. It is not working. I'm getting to the Members Area page. Well technically speaking, this is working exactly how we specified this. And this is what can happen if you already have a log in set up. And you later decide to add an Administrative Area. If I want to show you think piece on the Login dot php page. If I double-click the Login button and I get the Login User, Server Behavior from this form and I double-click that piece here is what's happening. These pages are doing exactly what we told them to do. They are logging in the user and sending them to members home. No matter what page they requested initially, what I need to do is check that check box.

What that does is if I'm checking or trying to access another page not Member's Home. It's going to send me to that one instead. A small check box that we did not talk about previously. And I'll click Okay. I will go ahead and Save this page. Let's go back, and I will try and log in. My browser window is closed. So here's my log in, I tried to access Admin Home, you can see it says access check.

Now when I log in, as Uniquevacations.com, set up my password of "candice" and click Login. Instead of always going to Members Home, I should be redirected to wherever I asked for, which should be Admin Home. Let's test it out. And there we are. So our Server Behavior, our Restrict Access to Page, was working correctly.

So, back on our Login page let me just review that in our log in new user this Login User Server Behavior I double click. You want to check go to previous URL if it exist. In other words, if the user was asking for a page other than Member's Home, make sure you send them to the page they were asking for. If they were just trying to get to the Member's Area, they will end up on Member's Home. This covers our admin piece for our administrative users. And we also change the access level for logging in, adding a level from the role area within our website.

So we fine tuned our member log in when we added our administrative login. So now the task is to go out and to test all of this in every way, shape or form. In other words add as a log in as a guest, that's incorrect. Add a log in as an actual person, that's correct. Request another page and make sure you're redirected to that page. Test this Administrative Area much more extensively than I've shown you here because the basic functionality for our admin area is set up.

Now our Admin user insert, has Insert Record and Check New User name, but it does not have a test for access level. So if I go out to Admin Home, restrict access to page Admin. So let's finish this piece up. User Admin insert, I want to restrict access to page on this page as well this will be user name password and access level we select Admin.

If access is denied we will take them to the Login page. Click Okay and I'm going to do this for the two remaining Admin pages that we have set up right now. So Admin User List > Restrict Access To Page. Add the access level they must be admin and if they can't log in here we will send them to a Login page. And our last page to add this to is our Update User piece. So I will add this Server Behavior as well, Add Access Level, choose Admin Access Only, and browse out to Login.

Now as I mentioned earlier If I was going to add a bunch of additional pages to admin. What I would do is create a template for the Administrative Area and add this Restrict Access to Page to it so I don't have to do this on every page. I can use that template for Admin as a Home page and it will already have the Server Behavior attached to it. There we are save this and now it's a matter of testing all of this functionality.

I'll do a quick test of these pages. You can see it's making me log in, tested that one out, good, and this last piece, perfect. Now users have to be logged in as Admin in order to access these pages. Now what we have left is building the Update User. So we want to be able to change your user from whatever information they have into new information within the Administrative Area of our Scuba2u Website.

Show transcript

This video is part of

Image for Dynamic Dreamweaver Websites: Creating Login Areas
Dynamic Dreamweaver Websites: Creating Login Areas

43 video lessons · 1748 viewers

Candyce Mairs
Author

 
Expand all | Collapse all
  1. 1m 32s
    1. Welcome
      1m 32s
  2. 2m 57s
    1. Course overview
      1m 16s
    2. The course environment
      1m 41s
  3. 26m 58s
    1. Static vs. dynamic requests
      4m 8s
    2. Installing XAMPP on a Windows system
      8m 54s
    3. Installing MAMP on a Mac system
      4m 29s
    4. Using admin consoles
      3m 54s
    5. Installing the course files
      5m 33s
  4. 18m 36s
    1. Overview of the Dreamweaver interface
      6m 22s
    2. Setting up the course site
      6m 20s
    3. Previewing pages
      5m 54s
  5. 33m 38s
    1. Creating PHP pages
      5m 45s
    2. Adding PHP code
      5m 44s
    3. Displaying variables
      4m 45s
    4. Commenting your code
      5m 30s
    5. Working with includes
      5m 58s
    6. Building the course templates
      5m 56s
  6. 35m 13s
    1. What is a database?
      5m 2s
    2. Adding database tables
      7m 34s
    3. Connecting to the database
      8m 28s
    4. Getting data from a database: Part one
      8m 25s
    5. Getting data from a database: Part two
      5m 44s
  7. 1h 16m
    1. Planning the login process
      7m 25s
    2. Creating a login form
      7m 45s
    3. Adding form validation: Part one
      9m 22s
    4. Adding form validation: Part two
      1m 37s
    5. Exploring the registration page
      7m 17s
    6. Correcting table fields
      6m 1s
    7. Setting up the login landing page
      4m 1s
    8. Using server behaviors
      3m 36s
    9. Inserting new members
      8m 48s
    10. User authentication
      10m 3s
    11. Restricting access to pages
      5m 17s
    12. Testing the login
      4m 53s
  8. 1h 6m
    1. Admin area overview
      5m 9s
    2. Adding new users
      5m 19s
    3. Restricting access
      12m 25s
    4. Planning the admin update area
      5m 19s
    5. Building the members table listing
      6m 55s
    6. Building the querystring
      9m 14s
    7. Populating the update form
      6m 33s
    8. Updating the database data
      11m 28s
    9. Testing the admin update process
      3m 47s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dynamic Dreamweaver Websites: Creating Login Areas.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.