Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 176
0 Users 21 Guests Online
Forum Index » PHP + MySQL » Question to usersystem
Posted on Monday 24th March 2008 at 06:34 PM
schorsch
templates/default/images/noavatar.png's Avatar
Active Member
How can I make a php page with a line also include a command to protect the only admins can enter this page?
Posted on Wednesday 26th March 2008 at 06:30 PM
ShadowMage
templates/default/images/noavatar.png's Avatar
Senior Member
try using this:
PHP Code
1
2
3
4
5
6
7
8
9
10
<?php
session_start
();
require(
"config.php");
if(
$logged[username] && $logged[userlevel] == 6){
//admin stuff
}else{
print 
"You Are Not an Admin!";
}
?>


That what you mean?
Posted on Saturday 29th March 2008 at 07:14 PM
schorsch
templates/default/images/noavatar.png's Avatar
Active Member
No I mean it

<?php
include("protect.php";
$rang = 5;
?>

And here html code or txte only with the user rang see 5 or higher
Posted on Tuesday 1st April 2008 at 12:43 AM
DanielXP
avatars/1.png's Avatar
Senior Member
Do you want the protect.php page to be the page that checks to see if the user is admin?

So you don't need to keep putting that code in every page you can just include it instead?
Posted on Saturday 5th April 2008 at 09:01 AM
schorsch
templates/default/images/noavatar.png's Avatar
Active Member
Yes, I would like a man that can do as in the example

So test.php

<?php
include("protect.php";
$rang = 5;
?>

Only for Admins

Test2.php

<?php
include("protect.php";
$rang = 1;
?>

For user or Higher
It should be able to include the site to protect it is also the html code can use
Posted on Sunday 6th April 2008 at 07:55 PM
DanielXP
avatars/1.png's Avatar
Senior Member
PHP Code
1
2
3
4
5
6
7
<?php
session_start
();
require(
"config.php");
if(
$logged[userlevel] != 6){
die;
}
?>


Is your protect.php

And for the include you need

Code
include("protect.php");
Posted on Monday 7th April 2008 at 08:46 AM
schorsch
templates/default/images/noavatar.png's Avatar
Active Member
thx
Posted on Tuesday 8th April 2008 at 08:16 AM
schorsch
templates/default/images/noavatar.png's Avatar
Active Member
How can I make it all level 2 or higher can see the page?
But level 0 and 1 not enter?
Posted on Wednesday 9th April 2008 at 07:47 PM
DanielXP
avatars/1.png's Avatar
Senior Member
PHP Code
1
2
3
4
5
6
7
<?php
session_start
();
require(
"config.php");
if(
$logged[userlevel] >= 2){
die;
}
?>
Posted on Wednesday 9th April 2008 at 07:51 PM
DanielXP
avatars/1.png's Avatar
Senior Member
Woops that will do the opersit to what u want.

PHP Code
1
2
3
4
5
6
7
<?php
session_start
();
require(
"config.php");
if(
$logged[userlevel] < 2){
die;
}
?>


Thats better