Do something like the following.  This is using JQUERY

jQuery.ajax({
 type: "POST",
 url: "/index.php",
 data: "tmpl=ajax",//in templates/system/ I create a file called ajax, which is a view.  All my php goes there
 success: function(response){
  alert(response);
 },
 error: function(er){
 alert("error! "+er);
 return false;
 }
 });

Joomla

Just another way to protect your Joomla Admin.  Remember, leaving your Joomla Admin open to the public is a big no-no!

Heres what I do.  

  1. Create an error page (article).
  2. Add it to a hidden menu and publish it.
  3. In templates/system/error.php:
  4. if($this->error->getCode()=="404" || $this->error->getCode()=="403"):
     $app->redirect( "/404-error" );
    endif;
    
  5. Add a .htaccess file in the administrator folder and put your public IP address there.  This means you will only be able to access the admin from that ip, so add all the ips you work from.
  6. ErrorDocument 403 /404-error
    Order deny,allow
    Deny from all
    Allow from 111.11.11.111
    

 

Joomla

I created a custom plugin to allow Joomla to redirect the user to a specific page based on the user group. In the plugin xml I setup some configuration parameters for each user group. example: Code:

    <config>
      <fields name="params">
         <fieldset name="basic">
            <field name="superuser" type="text"
               default="/super-user-dashboard"
               description="Put in the path you want them to see when logging in"
               label="Super User Dashboard"
            ></field>
         </fieldset>
      </fields>
   </config>

Then in the plugin php file, you'll need something like the following: Code:

public function onUserLogin($user, $options = array()){
   $app = &JFactory::getApplication();
   if(!$app->isSite()):
      return true;//make sure plugin doesn't run for backend
   endif;
      
   jimport('joomla.user.helper');
   $instance = JUser::getInstance();
   if ($id = intval(JUserHelper::getUserId($user['username'])))  {
      $instance->load($id);
   }      

/*
//theres better ways to do this, but it worked for me.  you might want to print_r the groups array and see what you can use
*/      
if($instance->groups["Super Users"]=="8"):
  $app->redirect(  $this->params->get('superuser', 1) );
  return true;
endif;
...

Joomla

Search My Site