Jump to content

admin levels ??


janim

Recommended Posts

hi all i have to make script that pulls from mysql and showing the level of this admin

 

like this :

 

<?php
function ($admin) {
$sql = mysql_query("select * from people where name ='$admin' ") or die("".mysql_error());
   if ( mysql_num_rows($sql) ) {
  fetch = mysql_fetch_array($sql) 
}

   if ($fetch['level] == 1 ) {
   // here the problem 
}elseif($fetch[level == 2 ){
// here too 
}elseif($fetch[level] == 3 ) {
// here 
}
  }

 

so what can i defined in the comments area above to call this function later and authorized admins ?

if you noticed that i have a lot of levels !

 

thanks for any suggestions

Link to comment
https://forums.phpfreaks.com/topic/82763-admin-levels/
Share on other sites

<?php
if ($fetch['level] == 1 ) {
   // here the problem 
}elseif($fetch[level == 2 ){
// here too 
}elseif($fetch[level] == 3 ) {
// here 
}
  }

 

notice this difference:

 

<?php
if ($fetch['level'] == 1 ) {
   // here the problem 
}elseif($fetch['level'] == 2 ){
// here too 
}elseif($fetch['level'] == 3 ) {
// here 
}
  }

the colour of the script gives away something is not closed in your attempt

it should be ['level']

 

Link to comment
https://forums.phpfreaks.com/topic/82763-admin-levels/#findComment-420929
Share on other sites

ah , i'm so sorry about this code i just typed it know

 

but the idea is : it dosent matter know from where to get these levels but i want to something like defining value like this :

 

 

   <?php 

   function auth($someone) {
     global $ptab;
	 $admin_sql = mysql_query("select * from $ptab where name = '$someone' ");
		   
		  if (mysql_num_rows($admin_sql)) {
		   $fetch = mysql_fetch_array($admin_sql);
		   }
			  
			   if ( $fetch['lvl'] == 1 ) {
			 // do something
			   }elseif($fetch['lvl'] == 2 ) {
			// do something
			   }elseif($fetch['lvl'] == 3 ) {
                                // do something
			   }

			   
          } // end function auth ;
?>
         
  // so i dont know how to call this function !!!!!!!!!
  // but this is the idea i want the authorization in this way 
// thanks for your replay  

Link to comment
https://forums.phpfreaks.com/topic/82763-admin-levels/#findComment-420932
Share on other sites

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.