I'll begin with something simple - using patUser to restrict access to a Web page. In this scenario, only users who provide appropriate credentials - a login name and password - will be allowed access to the page; all other users will simply be presented with an error message. Here's the code: As you can see, the script above contains an HTML page which I'm assuming you want to restrict access to, surrounded with some fairly complicated code. The code is all explained a little further down, so don't worry too much about it just yet; instead, try accessing this page through your Web browser. You should see something like this: ![]() Try entering a random user name and password - since the database is currently empty, the system should barf and throw you back out with an error message. ![]() Now, add a user to the "users" table, and try logging in again with that username and password. This time, patUser should recognize that your credentials are valid and allow you access to the page. ![]()
blog comments powered by Disqus |