Location: PHPKode > projects > MembersGear > membersgear/includes/page_not_found.php
<?php
 /* function Get_Relative_Path() {
      $result = '';
      
      $lSCRIPT_NAME = $_SERVER['REQUEST_URI'];
      $result = $lSCRIPT_NAME;
      $revString=strrev($result);
      $larrResult = explode('/',$revString);
       
      $result = '';
      if(is_array($larrResult)) {
          for($i=1;$i<count($larrResult)-2;$i++) {
           
              if($larrResult[$i]!='')
                $result .= '../';
          }
      }
      return $result;
  }  */
                       
 if(isset($_GET['inc']))                               
 {
          $configUrl=decrypt_protected_folder($_GET['inc']);
          $configfile=$configUrl."/config.php";
          
          if(isset($_GET['msg']))
            $msg=decrypt_protected_folder($_GET['msg']);   
               
           
          if(file_exists($configfile))
          {
              include  $configfile;
             //**********************************************Begin Page code**********************************************     
                
                $userImgdir=USER_IMAGE_DIR;
                if(isset($_GET['bd']) )
                 {
                       $scriptname=$_SERVER['SCRIPT_FILENAME'];
                       $revstr=strrev($scriptname);
                       $dirOrg=strchr($revstr,"/");
                       $dirOrgrev= strrev($dirOrg);
                       $dirOrgrev=substr($dirOrgrev,0,strlen($dirOrgrev)-1);
                       $path = $dirOrgrev;

                    // Open the folder
                    $dir_handle = @opendir($path) or die("Unable to open $path");

                     $str="<table width=90% ><tr><td><h1 style='font-size: 15px'>Directory Contains following folders/files</h1></td></tr><tr><td><div style='border:solid 1px #ccc;width:90%'>";  
                     $flag_files=false;
                    while ($file = readdir($dir_handle)) {

                         if($file == "." || $file == ".." || $file == "index.php" || $file == ".htaccess" || $file == ".htpasswd" || $file == "page_not_found.php" )
                        continue;
                        $flag_files=true;
                        if(is_dir($file))
                        {
                                $str.= " <div style='padding-top:5px;padding-bottom:2px;clear:both'>
                                <img src=\"$userImgdir/closed.gif\"  align=\"absmiddle\"  height=\"18\" width=\"18\" style=\"margin-left:1px;\" />      
                                <a href=\"$file\" style=padding-left:5px; >$file</a></div><br>";
                        }
                       else
                        {
                               $str.= " <div style='padding-top:5px;padding-bottom:2px;clear:both'>
                                <img src=\"$userImgdir/document.png\" height=20px align=\"absmiddle\"/>
                                <a href=\"$file\" style=padding-left:5px; >$file</a></div><br>";
                        }      
                    }

                    if($flag_files==false)
                       $str.= " <center><h3>No folders/files found</h3></center>";
                       
                    $str.="</div></td></tr></table>"; 
                    // Close
                    closedir($dir_handle); 
                   $smarty->assign('msg',$str);        
                 
                 } 
                else if(isset($_GET['msg']))
                  {
                    $mes="<center>";  
                    $mes.=decrypt_protected_folder($_GET['msg']);
                    $mes.="</center>";
                    $smarty->assign('msg',$mes);         
                    
                  } 
                $PAGE_CONTENT          = $smarty->fetch('page_not_found.tpl');  
                 
            //**********************************************End Page code**********************************************
            //Common Line
                 
            $smarty->assign('USER_CONTENT',     $PAGE_CONTENT);
       
             
            $smarty->display('user_page_main.tpl');
          }
          else
           {
            
              $request_uri=$_SERVER['REQUEST_URI'];
              $request_urirev=strrev($request_uri);
              $request_urirev=strchr($request_urirev,"/");
              $request_urirev_org= strrev($request_urirev);
              Redirect_protected($request_urirev_org);  
             
              
           }
            
 }
else
 {
              $request_uri=$_SERVER['REQUEST_URI'];
              $request_urirev=strrev($request_uri);
              $request_urirev=strchr($request_urirev,"/");
              $request_urirev_org= strrev($request_urirev); 
              Redirect_protected($request_urirev_org); 
 } 
 
 
 function decrypt_protected_folder($string,$pkey='MEMBERSITEENCRYPTEDKEY') {
        $key = $pkey;
        if(!isset($key) or  $key=="")           
              $key='MEMBERSITE';
        $result = '';
        $string = base64_decode(urldecode($string));
       for($i=0; $i<strlen($string); $i++) {
             $char = substr($string, $i, 1);
             $keychar = substr($key, ($i % strlen($key))-1, 1);
             $char = chr(ord($char)-ord($keychar));
             $result.=$char;
         }
       return $result;
  }
  
 
  function Redirect_protected($pUrl='', $pEndResponse=false)
    {     
        if(trim($pUrl)=='')
            return false;
            
        echo("<script language='javascript'>\n" .
                "window.location.href='".$pUrl."'\n" .
             "</script>");  
             
        if($pEndResponse) die;
        
        return false;     
    }


?>
Return current item: MembersGear