Jump to content

admin with my register system?


ChrisMartino

Recommended Posts

Hey i wana make it so i can make a admin level on my register system , I'm kinda new to php to im not sure how, i wana do something like a 'if' statment so when they click the page if the admin level in there user row in the sql table it lets them on the page, So like how would i do that what format would i create the field in the sql like text, number, var, varchar etc i dont know what and how could i do a if statment for if there level 1??

Link to comment
https://forums.phpfreaks.com/topic/184956-admin-with-my-register-system/
Share on other sites

At the very top of your page

if($_SESSION['admin_level'] != '10')

{header('Location: http://www.domain.com');}

or you could send them to an error page

header('Location: http://www.domain.com/error.php?error=admin_access')

 

What would the Field Type be in PHPmyAdmin ? i put int but it didn't work.

<?php

 

include "main/base.php";

 

if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username']))

{

?>

   

    <h1>Member Area</h1>

  <p>Thanks for logging in! You are <b><?=$_SESSION['Username']?><b> and your email address is <b><?=$_SESSION['EmailAddress']?></b>.</p>

<p>And your level is <b><?=$_SESSION['Level']?></b></p?

   

    <ul>

        <li><a href="logout.php">Logout.</a></li>

    </ul>

   

<?php

}

?>

 

that dont work ?

 

it doesn't display the level

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.