$pro = $user_data['username'];
if ($pro != "drama", "another name", "another one") {
die ('You are not allowed to use this page');
}
if i make only one name it works normal but if i make to many names i get page error any thing to fix this ? Question about Protect page with session
Question about Protect page with session
hello guys , iam trying to protect some pages on my script, i want control on session who can show this page i make somthing but after i check i see that's works with 1 name only i want make it allow to many name here is example to be more clear

Re: Question about Protect page with session
I would put the accepted names in an array and see if $pro is in that array. Like this:
$pro = "drama";
$accepted = array(
'First'=> 'drama',
'Second' => 'another name',
'Third' => 'another one'
);
if (in_array($pro, $accepted) === false) {
die ('You are not allowed to use this page');
}Re: Question about Protect page with session
You can also inline it like this

if (in_array($pro, array("drama", "another name", "another one")) == false){
// redirect ?
}
I use that all the time Re: Question about Protect page with session
That is a much nicer way of doing it 
Re: Question about Protect page with session
WOW Thankkkkkkks ,,, this is the best forum ever , Thanks for your help guy's
Re: Question about Protect page with session
drama22 wrote:WOW Thankkkkkkks ,,, this is the best forum ever , Thanks for your help guy's![]()
![]()
![]()
