Click here to Skip to main content
14,430,134 members
Rate this:
Please Sign up or sign in to vote.
See more:
Recently I had by a php web application.So I wants to run this one in localhost.How can make changes in to these two files.

My localhost xampp folder: c:/xampp/htdocs/xampp

--------------------
Config.php
-------------------------
/* this file is used for database connection */
$config['tplEx'] = '.tpl';  // file extension
//$Language_Types = isset($_POST['Language_Types']) ? $_POST['Language_Types'] : (isset($_SESSION['Language_Types'])?$_SESSION['Language_Types']:"en" );
//$_SESSION['Language_Types'] = $Language_Types;


$config['Website']="freelance.v-eva.com";
$config['Google_Api_Key']="ABQIAAAAk27O0F6NttJWXubTNawHBBSiuLO6tF5ZpIf4RihbdBsq-eLWZxRdvoq-mGdlR8FHTYmnMWmd2g7J8g";
$config['Twitter_Link']="http://www.twitter.com/stefanantonius";
$config['Facebook_Link']="http://www.facebook.com/antonius.stefan";


#====================================================================================================
#	Database		
#----------------------------------------------------------------------------------------------------
switch($config['Server_Name'])
{
	case "GANESH":
		$config['DB_Type']      = 'mysql';
	    $config['DB_Host']      = 'localhost';
	    $config['DB_Name']      = 'veva2010_Freelance';
	    $config['DB_User']      = 'root';
	    $config['DB_Passwd']    = '';
		
        break;
		
	case "MYLOCAL":
		$config['DB_Type']      = 'mysql';
	    $config['DB_Host']      = 'localhost';
	    $config['DB_Name']      = 'veva2010_Freelance';
	    $config['DB_User']      = 'root';
	    $config['DB_Passwd']    = '';
        break;
		

    case "freelance.v-eva.com":
	case "www.freelance.v-eva.com":
	    $config['DB_Type']      = 'mysql';
	    $config['DB_Host']      = 'localhost';
	    $config['DB_Name']      = 'veva2010_Freelance';
	    $config['DB_User']      = 'root';
	    $config['DB_Passwd']    = '';
        break;
		
    default:
	    $config['DB_Type']      = 'mysql';
	    $config['DB_Host']      = 'localhost';
	    $config['DB_Name']      = 'veva2010_Freelance';
	    $config['DB_User']      = '';
	    $config['DB_Passwd']    = '280165';
        break;
}

?>


----------------------------------
common.php
---------------------------
#====================================================================================================
#	Start Session and define site access valid
#----------------------------------------------------------------------------------------------------
if ( !defined('IN_SITE') )
{
	die("Hacking attempt");
}
session_start();
#====================================================================================================
#	addslashes to vars if magic_quotes_gpc is off
#	this is a security precaution to prevent someone
#	trying to break out of a SQL statement.
#----------------------------------------------------------------------------------------------------
error_reporting(E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables

#====================================================================================================
#	Define some basic configuration arrays. This also prevents
#	malicious rewriting of language and otherarray values via
#	URI params
#----------------------------------------------------------------------------------------------------
$physical_path	= array();
$virtual_path	= array();
$config 		= array();

/*header("location: under_maintenance.html");
exit();*/
#====================================================================================================
#	Define Site state and set site root
#----------------------------------------------------------------------------------------------------

// Set the server name
$config['Server_Name'] = strtoupper($_SERVER['SERVER_NAME']);
//print $config['Server_Name'];die;
// Set the installation directory
switch($config['Server_Name'])
{
	// Dotnet (local)
	case "GANESH":
		define("INSTALL_DIR", "/mapfreelance/");
		$physical_path['Site_Root']			=	'E:/websites/'. INSTALL_DIR;
		$spaw_dir =  "/mapfreelance/editor/";
      	break;
		
	case "MYLOCAL":
		define("INSTALL_DIR", "/new_design/");
		$physical_path['Site_Root']			=	'E:/websites/tac'. INSTALL_DIR;
		$spaw_dir =  "/new_design/editor/";
      	break;
	
	case "freelance.v-eva.com":
	case "www.freelance.v-eva.com":
		define("INSTALL_DIR", "/");
		$physical_path['Site_Root']			=	$_SERVER['DOCUMENT_ROOT']. INSTALL_DIR;
		$spaw_dir =  "/editor/";
    	break;
		
	default:
		define("INSTALL_DIR", "/");
		$physical_path['Site_Root']			=	$_SERVER['DOCUMENT_ROOT']. INSTALL_DIR;
    	break;

}
#print $spaw_dir;die;
// Define site root
//$physical_path['Site_Root']			=	$_SERVER['DOCUMENT_ROOT']. INSTALL_DIR;
$virtual_path['Site_Root']			=	'http://'. $_SERVER['HTTP_HOST']. INSTALL_DIR;

/*print_r($physical_path['Site_Root']);
print_r($virtual_path['Site_Root']);die;
*/#====================================================================================================
#	Including required configuration
#----------------------------------------------------------------------------------------------------
$physical_path['Site_Include']		=	$physical_path['Site_Root']. 'includes/';

include($physical_path['Site_Include']. 'config.php');
include($physical_path['Site_Include']. 'constants.php');
include($physical_path['Site_Include']. 'functions.php');
#====================================================================================================
#	Including all required library
#----------------------------------------------------------------------------------------------------
$physical_path['Libs']				=	$physical_path['Site_Root']. 'libs/';
$virtual_path['Libs']				=	$virtual_path['Site_Root']. 'libs/';

include($physical_path['Libs']. 'mysql.php');
include($physical_path['Libs']. 'htmlMimeMail.php');
include($physical_path['Libs']. 'thumbnail.php');
include($physical_path['Libs']. 'Smarty.class.php');

#====================================================================================================
#	Including required language files and folders
#----------------------------------------------------------------------------------------------------
//$physical_path['Site_Lang']		=	$physical_path['Site_Root']. 'lang/en/';

$physical_path['Site_Lang']		=	$physical_path['Site_Root']. 'lang/default/';


#====================================================================================================
#	Define Rich HTML editor path
#----------------------------------------------------------------------------------------------------
$physical_path['Editor']			=	$physical_path['Site_Root']. 'editor/';
$virtual_path['Editor']				=	$virtual_path['Site_Root']. 'editor/';
global $spaw_root;
define('EDITOR_ROOT', 	$physical_path['Editor']);
define('EDITOR_URL', 	$virtual_path['Editor']);
$spaw_root = EDITOR_ROOT;
//print_r(EDITOR_URL);die;
#====================================================================================================
#	Define Data Access root
#----------------------------------------------------------------------------------------------------
$physical_path['DB_Access']			=	$physical_path['Site_Root']. 'db_access/';
include($physical_path['DB_Access']. 'WebConfig.php');
include($physical_path['DB_Access']. 'User.php');
include($physical_path['DB_Access']. 'Utility.php');

#====================================================================================================
#	Email Template
#----------------------------------------------------------------------------------------------------
$physical_path['EmailTemplate']			=	$physical_path['Site_Root']. 'email_templates/';
$virtual_path['EmailTemplate']			=	$virtual_path['Site_Root']. 'email_templates/';

$physical_path['EmailTemplate_Images']		=	$physical_path['EmailTemplate']. 'images/';
$virtual_path['EmailTemplate_Images']		=	$virtual_path['EmailTemplate']. 'images/';

#====================================================================================================
#	Upload
#----------------------------------------------------------------------------------------------------
$physical_path['Upload']		=	$physical_path['Site_Root']. 'upload/';
$virtual_path['Upload']			=	$virtual_path['Site_Root']. 'upload/';

$physical_path['Seller_Logo']	=	$physical_path['Upload']. 'Seller_Logo/';
$virtual_path['Seller_Logo']	=	$virtual_path['Upload']. 'Seller_Logo/';

$physical_path['Portfolio']	=	$physical_path['Upload']. 'Portfolio/';
$virtual_path['Portfolio']	=	$virtual_path['Upload']. 'Portfolio/';

$physical_path['Contact']	=	$physical_path['Upload']. 'Contact/';
$virtual_path['Contact']	=	$virtual_path['Upload']. 'Contact/';

$physical_path['Project']	=	$physical_path['Upload']. 'Project/';
$virtual_path['Project']	=	$virtual_path['Upload']. 'Project/';

$physical_path['Private_Message']	=	$physical_path['Upload']. 'Private_Message/';
$virtual_path['Private_Message']	=	$virtual_path['Upload']. 'Private_Message/';

$physical_path['Pdf']	=	$physical_path['Upload']. 'Pdf/';
$virtual_path['Pdf']	=	$virtual_path['Upload']. 'Pdf/';

$physical_path['Affilates']		=	$physical_path['Site_Root']. 'Affilates/';
$virtual_path['Affilates']		=	$virtual_path['Site_Root']. 'Affilates/';

#====================================================================================================
#	Define User the user root file path
#----------------------------------------------------------------------------------------------------
if(defined("IN_USER"))
{
	$physical_path['User_Root']			=	$physical_path['Site_Root'];
	$virtual_path['User_Root']			=	$virtual_path['Site_Root'];
}
elseif(defined("IN_ADMIN"))
{
	$physical_path['User_Root']			=	$physical_path['Site_Root']. 'admin/';
	$virtual_path['User_Root']			=	$virtual_path['Site_Root']. 'admin/';
}


// Define Template root
$physical_path['Templates_Root']		=	$physical_path['User_Root']. 'templates/';
$virtual_path['Templates_Root']			=	$virtual_path['User_Root'].  'templates/';

$virtual_path['Templates_CSS']			=	$virtual_path['Templates_Root']. 'css/';
$virtual_path['Templates_JS']			=	$virtual_path['Templates_Root']. 'js/';
$virtual_path['Templates_Image']		=	$virtual_path['Templates_Root']. 'images/';

$virtual_path['Templates_Help']			=	$virtual_path['Templates_Image']. 'help/';


#====================================================================================================
#	Initial the required object
#----------------------------------------------------------------------------------------------------

# 	Make the mail object
#----------------------------------------------------------------------------------------------------
global $mail,$mail1;
$mail = '';
$mail = new htmlMimeMail();

# Make the database connection
#----------------------------------------------------------------------------------------------------
global $db,$db1,$db2;
$db = '';
$db = new DB_Sql($config['DB_Host'], $config['DB_Name'], $config['DB_User'], $config['DB_Passwd'], false);
$db1 = '';
$db1 = new DB_Sql($config['DB_Host'], $config['DB_Name'], $config['DB_User'], $config['DB_Passwd'], false);
$db2 = '';
$db2 = new DB_Sql($config['DB_Host'], $config['DB_Name'], $config['DB_User'], $config['DB_Passwd'], false);
if(!$db->link_id())
{
  die("Could not connect to the database");
}

#	Read site configuration
#----------------------------------------------------------------------------------------------------
global $webConf;
$webConf = '';
$webConf = new WebConfig();


#	Utility
#----------------------------------------------------------------------------------------------------
global $utility;
$utility = '';
$utility = new Utility();

#	Thumbnail
#----------------------------------------------------------------------------------------------------
global $thumb;
$thumb = '';
$thumb = new thumbnail();

#	Homepage
#----------------------------------------------------------------------------------------------------
global $homepage;
$homepage = '';
$hpcontent = ViewAllHomePageContent();

# Initiate User and start session
#----------------------------------------------------------------------------------------------------

//$user->StartSession();

# Set page size under cookie
if($_POST['page_size'])
	setcookie('page_size', $_POST['page_size'], time()+24*3600);
	
if($_POST['user_page_size'])
	setcookie('user_page_size', $_POST['user_page_size'], time()+24*3600);
# Initial the smarty object
#----------------------------------------------------------------------------------------------------
$tpl = new Smarty;
$tpl_1 = new Smarty;

$tpl->compile_check = true;
$tpl_1->compile_check = true;
//$tpl->force_compile = true;
$tpl->debugging 	= DEBUG;
$tpl_1->debugging 	= DEBUG;

# Define page layout
$tpl->template_dir 	= $physical_path['Templates_Root'];
$tpl->compile_dir 	= $physical_path['User_Root']. 'templates_c/';
# Define page layout
$tpl_1->template_dir 	= $physical_path['Templates_Root'];
$tpl_1->compile_dir 	= $physical_path['User_Root']. 'templates_c/';


if(defined("POPUP_WINDOW"))
{
	$tpl->assign(array(	"T_Body"	=>	'popupwin_layout'. $config['tplEx'],
						));
}

elseif(defined("IN_ADMIN"))
{
	include_once($physical_path['DB_Access']. 'Admins.php');
	global $admin;
	
	$admins = new Admins();

	$tpl->assign(array(	"T_Header"		=>	'default_header'. $config['tplEx'],
						"T_Menu"		=>	'default_menu'. $config['tplEx'],	
						"T_Footer"		=>	'default_footer'. $config['tplEx'],
						));
}
else
{

	global $user;
	$user = new User();
	//$physical_path['Theme_Root']		=	$physical_path['Templates_Root']. $config[WC_THEME].'/';
	//$virtual_path['Theme_Root']			=	$virtual_path['Templates_Root'].  $config[WC_THEME].'/';
	
	//$virtual_path['Templates_CSS']		=	$virtual_path['Theme_Root'].'css/';
	//$virtual_path['Templates_Image']	=	$virtual_path['Theme_Root'].'images/';
	
	$virtual_path['Templates_CSS']		=	$virtual_path['Templates_Root'].'css/';
	$virtual_path['Templates_Image']	=	$virtual_path['Templates_Root'].'images/';
	
	if(defined("HOME_PAGE"))
	{
 		//if some special homepage is there
		$tpl->assign(array(	"T_Header"	=>	'default_header'. $config['tplEx'],
							"T_Footer"	=>	'default_footer'. $config['tplEx'],
							#"T_Menu"	=>	'default_menu'. $config['tplEx'],	
							));
	}
	elseif(defined("IN_USER") && $_SESSION['User_Id'])
	{
		//$user->GetUserStatus($_SESSION['User_Id']);
		// login of user
		$tpl->assign(array(	"T_Header"	=>	'default_header'. $config['tplEx'],
							"T_Footer"	=>	'default_footer'. $config['tplEx'],
							"T_Balance"	=>	'balance'. $config['tplEx'],	
							));
		include('balance.php');
	}
	else
	{
		// without logins
		$tpl->assign(array(	"T_Header"	=>	'default_header'. $config['tplEx'],
							"T_Footer"	=>	'default_footer'. $config['tplEx'],
							"T_Menu"	=>	'default_menu'. $config['tplEx'],	
							));
	}


}
# Assign default values

$tpl->assign(array("Templates_CSS"			=> 	$virtual_path['Templates_CSS'],
					"Templates_JS"			=> 	$virtual_path['Templates_JS'],
					"Templates_Image"		=> 	$virtual_path['Templates_Image'],
					"Affilates_Image"		=> 	$virtual_path['Affilates'],
					"Templates_Help"		=> 	$virtual_path['Templates_Help'],

					"Site_Root"				=> 	$virtual_path['Site_Root'],
                    "Company_Title"			=>	$config[WC_COMPANY_TITLE],
                    "Site_Title"			=>	$config[WC_SITE_TITLE],
					"Meta_Title"			=>	$config[WC_SITE_TITLE],
					"Meta_Keyword"			=>	$config[WC_SITE_KEYWORD],
					"Meta_Description"		=>	$config[site_description],
					"google_adsense_code"	=>	$config[WC_GOOGLE_ADSENSE],
					"google_adsense_code_125"	=>	$config[WC_GOOGLE_ADSENSE_125],
					"tab"					=>	1,
					"home_content"			=> $hpcontent,
					"Google_Api_Key" => $config['Google_Api_Key'],
					"Twitter_Link"		=>	$config['Twitter_Link'],
					"Facebook_Link"		=>	$config['Facebook_Link'],
					));

//for local
include($physical_path['Site_Lang'].'/common.php');


# Assign default languages
$tpl->assign(array( "lang_common"				=> 	$lang,
					));

?>
Posted
Updated 10-Apr-12 18:22pm
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

What error or warning are you getting. Can you elaborate a little?
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

Just make a new folder in htdocs and place the web content in there. You do not need to make any changes in config file.
   
Comments
ahmed559 11-Apr-12 12:01pm
   
I already fixed this issue...Your solution already applied ,but it doesn't working.But running website without a folder in htdocs.Al files and folders directly copied in to htdocs by removing existing items.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100