Location: PHPKode > projects > MembersGear > membersgear/admin/admin_login_rotate_m.php
<?php
  require_once "../config/config.php";   
  $users=new users_class();    
  if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage Rotating Login Pages')==false)
  {
    Redirect('admin_nopermission.php',true);  
      
  }
  switch($_action)
  {
      case 'insert':
       $target_path = PHYSICAL_DIR."/member/rotating_login_pages/"; 
       $target_path = $target_path . basename( $_FILES['file_upload']['name']); 
       $file_size= $_FILES['file_upload']['size'];
       if($file_size!=null && $file_size=0)
       {
        $file_size=($file_size/1024)/1024;
       }
       else
       {
          $file_size=0; 
           
       }    
       $gfile_size=ini_get('upload_max_filesize');
       $gfile_size=(int)str_replace('M','',$gfile_size);
       if($file_size>$gfile_size)
       {
            $msg= "There was an error uploading the file, please try again!"; 
            $smarty->assign('msg',$msg);
       }
       else
       { 
       //  echo  PHYSICAL_DIR."/member/rotating_login_pages/".basename($_FILES['file_upload']['name']);
      
          if(!(file_exists(PHYSICAL_DIR."/member/rotating_login_pages/".basename($_FILES['file_upload']['name']))))
          {
               if(move_uploaded_file($_FILES['file_upload']['tmp_name'], $target_path)) 
           {
               $msg= "The file ".  basename($_FILES['file_upload']['name']). 
                   " has been uploaded";
               $message->SetMessage($msg);
               Redirect('./admin_login_rotate_v.php',true);    
           } 
           else
           {
               $msg= "There was an error uploading the file, please try again!";
              $smarty->assign('msg',$msg);
           }
          }
          else
          {
              $msg= "File ".basename($_FILES['file_upload']['name'])." is already exist";
              $smarty->assign('msg',$msg);   
              
          }    
       }
       $smarty->display('admin_login_rotate_m.tpl');   
       break;
       case 'delete':
       if($_GET['filename']!='')
      {   
         $lspath=PHYSICAL_DIR."/member/rotating_login_pages/"; 
         $lsfilename=trim($_GET['filename']);
         if(file_exists($lspath.$lsfilename))
         {
           
            if(is_writable($lspath.$lsfilename))
              {
                    unlink($lspath.$lsfilename);
                    $message->SetMessage('File is Successfully Deleted');
                    Redirect('./admin_login_rotate_v.php',true);
              }
             else           
              {
                    $msg="Please change ".$lsfilename." Permission to read and write";
                    $message->SetMessage($msg);
                    Redirect('./admin_login_rotate_v.php',true);
              
              }   
           
            
         }
         else
         {     $message->SetMessage('Selected file is  not exist');
               Redirect('./admin_login_rotate_v.php',true);  
         } 
      } 
      else
      {    // $message->SetMessage('File is Sucessfully Deleted');
            Redirect('./admin_login_rotate_v.php',true);
      }  
      
      break;
      default:
      
      $smarty->display('admin_login_rotate_m.tpl');
      
        
  }
  
?>
Return current item: MembersGear