php login check

yanaros07

New Member
Messages
1
Reaction score
0
Points
0
i am haveing an issue creating a check to verify that you are logged in before viewing the page
 

vishal

-::-X10 Guru-::-
Community Support
Messages
5,255
Reaction score
192
Points
63
Can you post the code ?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
In particular, post a minimal test case. Also, describe what your problem is–we're not psychic. Describe the behavior you expect and the behavior you get, including any error messages. Third, ask a meaningful question.
 
Last edited:

normaconti

New Member
Messages
11
Reaction score
0
Points
0
me too, i'm havong that kind of problem. can somebody help me?thanks!:tongue:
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
@normaconti: firstly, don't threadjack. Second, there's still no meaningful question, nor any information to answer one even if there was. If you call a mechanic and say "I'm having a problem with my car," do you expect them to be able to solve it then and there? Of course not. You show them the car and describe what your problem is. However, since you're not paying us, you can't expect us to do as much diagnosis as a mechanic. Do as much as you can to diagnose the problem.
 
Last edited:

devstr

New Member
Messages
5
Reaction score
0
Points
0
Utilise session control to make sure that, the user has authenticated him/or herself before viewing the page.

Add
PHP:
session_start();
in either the globals file, or at the top of every page, before any PHP statements. Add
PHP:
$_SESSION["userAuthenticated"] = true;
to the control structure that checks the login information against a database etc.

Now, whenever you create pages that are only viewable to authenticated users, add this at the top
PHP:
if($_SESSION["userAuthenticated"] != true) { 
   echo "Hello, user!";
}

else if($_SESSION["userAuthenticated"] != false) {
   echo "You must login to view this page.";
}
Another way is you can use a database, but that is completely on a different scope. If this does not work, please be sure to tell me.

If you are having problems implementing it, please let me know, and I will do it for you.
 
Last edited:
Top