| tensh |  | 
|---|---|
| Hi; I'm developing a plugin which has parts divided by "switch" statement. How can I make one 'switch' disabled for regular users but enabled for admin? What I have by now is: 
$IsAdmin = sed_auth('plug', 'myplug', 'A');
(...)
switch($s)
{ 
	case edit:
if ($IsAdmin) 
        {
        (...)
        }
}
	break;When I go to plug.php?e=myplug&s=edit as a guest, I see blank page, but I'd like to display a message "you're not allowed to do it". How can I call it? 
                        This post was edited by tensh (2009-07-27 19:58, 16 years ago)
                     | 
| Kilandor |  | 
|---|---|
| First thing to note, you don't have to use sed_auth in a standalone plugin as it is already loaded for you. 
switch($s)
{
	case 'edit':
		sed_block($usr['isadmin']); //Blocks anyone who isn't an admin - if value is false it blocks them
		/* your code */
	break;
} | 
| tensh |  | 
|---|---|
| Oh, didn't know that... Thanks!    Added 1 day later: By the way, I have another question about Cotonti POST forms protection. I notices the hidden field named "x" in e.g. search form, with a value. I suppose it's a sort of defense from external attacks. How can I use it in forms in other plugins? 
                        This post was edited by tensh (2009-07-29 18:12, 16 years ago)
                     | 
| Trustmaster |  | 
|---|---|
| In POST forms it is applied automatically, you don't need to care about it. Only GET forms (which normally shouldn't be used) there is a special way to check them. May the Source be with you! | 
| tensh |  | 
|---|---|
| That's so cooool!   I didn't even notice that  |