PHP MySQL Admin Level -
this user table
create table `users` ( `id` int(11) not null auto_increment, `firstname` varchar(255) not null, `lastname` varchar(255) not null, `email` varchar(255) not null, `username` varchar(255) not null, `password` varchar(100) not null, `level` enum('0','1') not null default '0', primary key (`id`)
so lets on index.php
i want if user level = 1, can see link appear on page. other wise if level = 0, never see link.
how can that?
i think want this.
in login module this
session_start(); $_session['level'] = 1; // passed level database.
and in pages.
session_start(); if (isset($_session['level']) && (int) $_session['level'] === 1) { echo '<a>link admin</a>'; }
Comments
Post a Comment