- Joined
- Dec 21, 2007
- Messages
- 1,049
- Reaction score
- 220
Well, here I am again with my noob questions =D
I kinda made a PHP study-plan which consists in studying and coding for 1 hour each day..
Today's lesson was to make an restricted login system.
What is a restricted login system?
Well, when the user submits his login info, if correct, it will check on the database if his user rights are 2.
I thought, "well, that's easy.." , but i seem to be getting some problems..
To do the check-if user rights = 2 function , i added it near the session_Start.
So you can understand and help me out, ill show you what I did
My $userrrr function =
Yet, i can't seem to do this right.
Any ideas on whats wrong or if im not doing it by the correct way? Any advice on other ways of doing this? :blush:
I kinda made a PHP study-plan which consists in studying and coding for 1 hour each day..
Today's lesson was to make an restricted login system.
What is a restricted login system?
Well, when the user submits his login info, if correct, it will check on the database if his user rights are 2.
I thought, "well, that's easy.." , but i seem to be getting some problems..
To do the check-if user rights = 2 function , i added it near the session_Start.
So you can understand and help me out, ill show you what I did
using the function said:<?
session_start();
if(isset($_SESSION['user'])) {
if($userrrr = true) {
header('location: inside.php');
} else {
if($userrrr = false) {
echo "You don't have enough rights to login into the admin panel.";
session_destroy();
}
} }
else {
echo "You are not logged in.";
}
require("main.php");
?>
My $userrrr function =
Code:
function userrrr() {
$userr = mysql_query("SELECT * FROM accounts WHERE user-rights = '2'");
$userrr = mysql_num_rows($userr);
return $userrr;
Yet, i can't seem to do this right.
Any ideas on whats wrong or if im not doing it by the correct way? Any advice on other ways of doing this? :blush: