<?php 
$fullurl = (htmlentities($_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'], ENT_QUOTES));
$fullurl = str_replace('webadmin/', '', $fullurl);
$siteurl1 = substr($fullurl, 0, strrpos( $fullurl, '/'));
$siteurl = substr($siteurl1, strrpos($siteurl1, '/') + 1);
$sitename = substr($siteurl, 0, strrpos( $siteurl, '.'));

if (strpos($fullurl, '/sites/') === false) {
require_once '../includes/connect.php';
} else {
$sitepath1='../sites/'.$sitename.'/';
require_once '../sites/'.$sitename.'/includes/connect.php';
}
?>