Location: PHPKode > projects > MembersGear > membersgear/installation/config/config.php
<?php 
        error_reporting(0); 
        ini_set('session.gc_maxlifetime', 1800);  
        session_start();  
        set_time_limit(180);
  
  
        //define('PHYSICAL_DIR',              'E:\Projects\SA\PHPProjects\sscMemberSite');
        define('PHYSICAL_APPLICATIONPATH_INSTALLATION', substr(realpath(dirname(__FILE__)),0,strlen(realpath(dirname(__FILE__)))-7));

        
        function IsLoopBack(){
            
            $IsLoopBack = false;
            
            
            //logic for loopback
            if($_SERVER["REMOTE_ADDR"] == $_SERVER["SERVER_ADDR"]) $IsLoopBack = true;
            
            //logic for 
            if($_SERVER["REMOTE_ADDR"] == '127.0.0.1') $IsLoopBack = true;
            
            //logic for IP range
            $lanIPFrom  = ip2long('192.168.99.0');
            $lanIPTo    = ip2long('192.168.99.255');
            $clientIP   = ip2long($_SERVER["REMOTE_ADDR"]);
            
            if($clientIP>=$lanIPFrom && $clientIP<=$lanIPTo) $IsLoopBack = true; 
            
            return $IsLoopBack;
            
        }
        
        $phydir= str_replace('\\','/', PHYSICAL_APPLICATIONPATH_INSTALLATION); 

        $phydirrev= strrev($phydir);
        $phydirrev=strchr($phydirrev,"/");
        $phydirrev= strrev($phydirrev); 
        define('PHYSICAL_DIR_INSTALLATION', $phydirrev);   
          if (get_magic_quotes_gpc()) {
                          $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
                          while (list($key, $val) = each($process)) {
                          foreach ($val as $k => $v) {
                          unset($process[$key][$k]);
                            if (is_array($v)) {
                                $process[$key][stripslashes($k)] = $v;
                                $process[] = &$process[$key][stripslashes($k)];
                            } else {
                                $process[$key][stripslashes($k)] = stripslashes($v);
                            }
                         }
                  }
                   unset($process);
               } 

        DEFINE('INCLUDE_DIR_INSTALLATION',               PHYSICAL_DIR_INSTALLATION.'includes');

        require_once PHYSICAL_DIR_INSTALLATION."/installation/functions.php"; 
        //echo encrypt("email_installation_fail");die; 


        
        
        if(IsLoopBack())
            DEFINE('PAYGEAR_WEB_URL',           'http://192.168.99.133'); 
        else                                                                                
           DEFINE('PAYGEAR_WEB_URL',           'http://www.paygear.com'); 

       //DEFINE('PAYGEAR_WEB_URL',           'http://192.168.99.109/paygear'); 


        DEFINE('CONFIG_DIR_INSTALLATION',                PHYSICAL_DIR_INSTALLATION.'config');
          
        //require_once(CONFIG_DIR_INSTALLATION.   '/constants.php');
        // Include Database Connection Parameter file
        require_once(CONFIG_DIR_INSTALLATION.   '/db.php');

        if( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')  
          $server_request="https://";
        else
          $server_request="http://";      
   
        $url = $_SERVER['HTTP_HOST'];
        $page = $_SERVER['PHP_SELF'];
        
        if($url=="localhost")
           $web_url= $server_request.$url.$page; 
        else
           $web_url= $server_request.$url.$page;      
     
        $rev_url=strrev($web_url) ;
        $pos = strpos($rev_url, "/");
        $substracted_revstring=substr($rev_url,$pos+1);
        
        $pos = strpos($substracted_revstring, "/");
        $substracted_revstring=substr($substracted_revstring,$pos+1);
        
        $complete_url=strrev($substracted_revstring);
        
        $_SESSION['INSTALLATION_WEB_URL']=$complete_url;
        
        $_SESSION['INSTALLATION_WEB_URL_SECURE']=str_replace("http://","https://", $complete_url);  
        
        
        if(!function_exists('mysql_connect'))     
          redirect("../check_server_requirements_mod_dir.php?check=mysql") ;  
          else
           {                 
                  if(defined('MEMBERSGEAR_DB_NAME') and defined('MEMBERSGEAR_DB_USER') and defined('MEMBERSGEAR_DB_PASSWORD') and defined('MEMBERSGEAR_DB_HOST') and defined('TABLE_PREFIX') )
                   {

                        $linkid = mysql_connect(MEMBERSGEAR_DB_HOST,MEMBERSGEAR_DB_USER,MEMBERSGEAR_DB_PASSWORD);  
                        $db_selct=mysql_select_db(stripcslashes(MEMBERSGEAR_DB_NAME), $linkid); 
                       
                        if($db_selct)
                         {  
                            
                                $query="select option_value from ".TABLE_PREFIX ."options where option_name='WEB_URL'";   
                                $lsdata=mysql_query($query,$linkid);
                                
                                $query_installation_salt="select option_value from ".TABLE_PREFIX ."options where option_name='MEMBERSGEAR_INSTALLATION_SALT'";   
                                $install_salt_res=mysql_query($query_installation_salt,$linkid);
                                  
                                if($lsdata!=false and $install_salt_res!=false)
                                 { 
                                       if(mysql_num_rows($lsdata)>0 and mysql_num_rows($install_salt_res)>0)
                                        { 
                                           $row = mysql_fetch_row($lsdata); 
                                           $web_url=$row[0];
                                           $rows_install_salt=mysql_fetch_row($install_salt_res);
                                           $salt=$rows_install_salt[0];
                                           
                                           $encyKey=encrypt($_SESSION['INSTALLATION_WEB_URL']."SUCCESSFUL");                                             
                                            if($encyKey==$salt and !isset($_SESSION['DATABASE_INSTALLATION']))
                                             {   
                                                 
                                                redirect("../installation_error.php?status_code=1050"); 
                                            
                                             }
                                        }
                                         
                                             
                                 }
                       
                         }
               
                   }
               
           }     
         
         
        
        // Include Smarty Plugin
        require_once(PHYSICAL_DIR_INSTALLATION.   'smarty/libs/Smarty.class.php');


        //Include Paygear Webservices
        require_once PHYSICAL_DIR_INSTALLATION."/installation/PaygearWebserviceClient.php";
        $PaygearWebserviceClient_installation = new PaygearWebserviceClientInstallation();

     
         if(file_exists(PHYSICAL_DIR_INSTALLATION.'templates_c/'))
         {
                   
             
                
                     if(is__writable(PHYSICAL_DIR_INSTALLATION.'templates_c/') )
                     {
                            global $smarty_installation;
                            $smarty_installation = new Smarty;
                            $smarty_installation->template_dir   = PHYSICAL_DIR_INSTALLATION.'templates/';
                            $smarty_installation->compile_dir    = PHYSICAL_DIR_INSTALLATION.'templates_c/';
                            $smarty_installation->cache_dir      = PHYSICAL_DIR_INSTALLATION.'smarty/smarty_cache';
                            $smarty_installation->debug_dir      = PHYSICAL_DIR_INSTALLATION.'/smarty/debug/';
                            $smarty_installation->config_dir     = CONFIG_DIR_INSTALLATION.'smarty_configs/';
                            $smarty_installation->assign('PHYSICAL_DIR_INSTALLATION',     PHYSICAL_DIR_INSTALLATION);
                                    


                           //$MOD_DIR         =   $smarty_installation->fetch('apache_modules_extensions_check.php'); 
                           //echo $MOD_DIR         ;
                           // $smarty_installation->assign('MOD_DIR',     $MOD_DIR); 


                            $INSTALLATION_HEADER         =   $smarty_installation->fetch('installation_header.php');        
                            $INSTALLATION_FOOTER         =   $smarty_installation->fetch('installation_footer.php');  
                            $smarty_installation->assign('PHYSICAL_DIR_INSTALLATION',     $phydirrev);
                            $smarty_installation->assign('INSTALLATION_HEADER',     $INSTALLATION_HEADER);
                            $smarty_installation->assign('INSTALLATION_FOOTER',     $INSTALLATION_FOOTER);       
                             
                             
                    
                     }
                    else
                     die("MembersGear Error occured :  Please allow read write permission on templates_c folder in the root of your website and try again. ");         
                    
                    
         }
        else
           die("MembersGear Error occured :  templates_c folder not found in the root of your website.Please create it and apply read write permission on it and try again. ");                               


?>
Return current item: MembersGear