diff --git a/htdocs/assets/js/floatingbar-config.js b/htdocs/assets/js/floatingbar-config.js index 6f7b562..4328b16 100644 --- a/htdocs/assets/js/floatingbar-config.js +++ b/htdocs/assets/js/floatingbar-config.js @@ -128,11 +128,11 @@ function inject_search_results (results) { searchRes.innerHTML = `

SEARCH RESULTS

`; results.forEach(function(result) { - let resultDiv = document.createElement("div"); - resultDiv.className = "group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg"; - resultDiv.setAttribute("onclick", "location.href='" + result.link + "'"); + let projectsDiv = document.createElement("div"); + projectsDiv.className = "group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg"; + projectsDiv.setAttribute("onclick", "location.href='" + result.link + "'"); - resultDiv.innerHTML = ` + projectsDiv.innerHTML = ` ${result.name.charAt(0).toUpperCase()} @@ -146,7 +146,7 @@ function inject_search_results (results) { `; - searchRes.appendChild(resultDiv); + searchRes.appendChild(projectsDiv); }); } diff --git a/htdocs/core/handle_search.php b/htdocs/core/handle_search.php index 4b5a2f9..e67ad76 100644 --- a/htdocs/core/handle_search.php +++ b/htdocs/core/handle_search.php @@ -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); } } diff --git a/htdocs/core/host_config.php b/htdocs/core/host_config.php index f130acf..e8c15c6 100644 --- a/htdocs/core/host_config.php +++ b/htdocs/core/host_config.php @@ -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; } diff --git a/htdocs/core/query_functions.php b/htdocs/core/query_functions.php index 2579697..31ad9bb 100644 --- a/htdocs/core/query_functions.php +++ b/htdocs/core/query_functions.php @@ -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'); + } +} ?> \ No newline at end of file diff --git a/htdocs/core/router.php b/htdocs/core/router.php index e91a88d..62faa1f 100644 --- a/htdocs/core/router.php +++ b/htdocs/core/router.php @@ -16,7 +16,7 @@ $devRoutes = [ '/neosubhamoy/htdocs/contact' => 'contact.php', ]; -if ($host == "localhost") { +if ($host == "localhost" || $host == "192.168.29.177") { $routes = $devRoutes; } else {