1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-19 20:33:06 +05:30

(fixed): router and host_config for my local network cross device access

This commit is contained in:
2023-11-18 00:35:46 +05:30
parent 02834eb5f6
commit 771771e061
5 changed files with 28 additions and 8 deletions

View File

@@ -5,7 +5,9 @@ require 'query_functions.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['keyword'])) {
$keyword = $_POST['keyword'];
$results = fetch_search_results($conn, $keyword);
$results_projects = fetch_search_results_projects($conn, $keyword);
$results_socials = fetch_search_results_socials($conn, $keyword);
$results = array_merge($results_projects, $results_socials);
echo json_encode($results);
}
}

View File

@@ -4,6 +4,9 @@ $currentHost = $_SERVER['HTTP_HOST'];
if($currentHost == "localhost") {
$basePath = "https://localhost/neosubhamoy/htdocs";
}
elseif ($currentHost == "192.168.29.177") {
$basePath = "https://192.168.29.177/neosubhamoy/htdocs";
}
else {
$basePath = "https://" . $currentHost;
}

View File

@@ -51,7 +51,7 @@ function fetch_social_icon($conn, $platform_name) {
}
}
function fetch_search_results($conn, $keyword) {
function fetch_search_results_projects($conn, $keyword) {
$sql = "SELECT * FROM projects WHERE name LIKE '%$keyword%'";
$result = $conn -> query($sql);
if($result -> num_rows > 0) {
@@ -65,4 +65,19 @@ function fetch_search_results($conn, $keyword) {
return array('results' => 'none', 'message' => ': (   No Results Found');
}
}
function fetch_search_results_socials($conn, $keyword) {
$sql = "SELECT * FROM socials WHERE platform LIKE '%$keyword%'";
$result = $conn -> query($sql);
if($result -> num_rows > 0) {
$result = mysqli_fetch_all($result, MYSQLI_ASSOC);
foreach ($result as &$element) {
$element['tag'] = 'social';
}
return $result;
}
else {
return array('results' => 'none', 'message' => ': (   No Results Found');
}
}
?>

View File

@@ -16,7 +16,7 @@ $devRoutes = [
'/neosubhamoy/htdocs/contact' => 'contact.php',
];
if ($host == "localhost") {
if ($host == "localhost" || $host == "192.168.29.177") {
$routes = $devRoutes;
}
else {