Jump to content

Access to pages upon login


gk20

Recommended Posts

For users that are logged in I want more links to appear, more information etc.... How do I do this?
I accept from the users when logging in: login and pass and validate these. So far this works
For users not logged in I only want to have links to pages like: home, register, login, about.
But I want more for users who are logged in? I know I'm probably confusing, but does anybody understand what I'm trying to say?


$login = $_POST['login'];
$pass = $_POST['pass'];
......
......
if (!$fail)
{
$chklogin = @mysql_query("SELECT loginname,loginpass FROM login WHERE
loginname = '$login' AND loginpass = '$pass'");

$chkuser = @mysql_query("SELECT loginname FROM login WHERE loginname = '$login'");

if (mysql_num_rows($chkuser) == 1)
{
if (mysql_num_rows($chklogin) == 1)
{
echo '<p><b>Welcome</b></p>';
echo '<p><b>Login successful</b></p>';
echo '<input type="submit" name="<href="#"" value="HOME">';

- this is probably where the code should go etc.....
- or re-direct them to a page with all links etc and output their loginname on all pages from there on

Please help???




Link to comment
Share on other sites

What you may want to do is store the links for user that have logged on in a separate html file that is 'included' when the login is validated. If the login is not validated, then the include would not take place.

Something like:

...
include('header.html');
include('links_allusers.html');
if(goodLogin())
{
include('links_login.html');
}
include('body.html');
include('footer.html');

Link to comment
Share on other sites

OK, I get that. But my links file is displayed at the top of the page, where the login is validated further down in the body of the page. I want to display the links for logged in users at the top of the page with the existing ones???
I can display the 2nd set of links but it will display them in the body??
Is there any way that I could display all links on homepage but do a check to see if a user is logged in before displaying it, that way "banning" users that arent logged in from going there?????
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.