Jump to content

Admin Mode


seventheyejosh

Recommended Posts

Hey all. I was wondering if someone could give me a quick snippet that'll change every instance of one class to another onclick. So i can have an 'admin side of a forum without an actual one :D'.

 

basically just a button ->

 

<input type=button value="Enable Admin Mode" onclick="enable();">

 

and a little function that will change all of the classes. note: i know a bit of js, but obviosuly the following example would never ever work :D

 


function enable(){

foreach element with class of 'adminhidden' update to class of 'admindisplayed'

}//end function

 

thanks :D

 

 

Link to comment
Share on other sites

Just to give you the heads up, this is horribly insecure. Anyone will be able to see the admin buttons in your source code, and can just change the css visibility themselves to get access to your admin panel.

Link to comment
Share on other sites

well im using (on this site) the smarty template engine, im not sure if you're familiar, but basically on the php side i'll do

 

<?

 

if (isset($is_admin)){

 

$smarty->assign('variable with admin divs',$variable);

 

}

 

?>

 

then the smarty will be

 

$variable_with_admin_divs

 

so basically, if the php perms dont match, not only will the 'button' never be created, but the divs it unlocks wont be either :D

 

it wont even be in the source code.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.