your code seems to report no errors however the result is nto what is expected.
Do not expect my (or anyone else's) code examples to be handouts that work right out of the box (though if you are lucky sometimes they are).
I have a table with three variables (user, pass, link)
The idea is that a user in a login page types in the user then types in tha pass, this is then compared to the table and if there is a match the user would be then forwarded to a new page whose address is gotten from the "link" variable.
Quite frankly the ideal situation would be that the specific client pages were password protected, and the post from the inputs served not only to redirect to the correct "link" but also as validation to the password protected page.
Do you have any thoughts?
Basically, you have a simple permission system where a user with a given username and password is permitted to access the page with the given link (URL).
In such a case, you have two choices:
a) Require users to login on every visit to a restricted page, or
b) Require users to login, then transparently authenticate them on restricted pages
One possible implementation of option (a) is pretty simple: display the login page. If the user sucessfully logs in, include the desired page (which should be kept in a restricted directory). Else, display a failed login error message.
Option (b) needs more work, but makes life easier for your users, and indeed is what is normally expected of a web-based authentication system. Instead of having one table with username/password/URL, you would have a users table with userid/username/password, and also a permissions table where you associate each userid with one or more URLs. When the user logs in, you create a session for the user and record the userid in the session, and store the sessionid in a cookie. You also retrieve the list of pages that the user can visit, and display their links. When the user visits one of the links, the system checks the session and ensures that the given userid is indeed associated with the given URL.
What you should not do is redirect users after login without re-authenticating them on the destination page. A lack of such re-authentication would allow unauthorised users to by-pass the login system if they somehow got hold of the restricted page's URL, e.g., by viewing browser address history.