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
https://forums.phpfreaks.com/topic/3911-access-to-pages-upon-login/
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');

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?????

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.