Jump to content


Photo

Access to pages upon login


  • Please log in to reply
2 replies to this topic

#1 gk20

gk20
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 02 March 2006 - 01:32 PM

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






#2 khburres

khburres
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 02 March 2006 - 01:55 PM

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');


He who guards his mouth and his tongue keeps himself from calamity.

#3 gk20

gk20
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 02 March 2006 - 09:22 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users