mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-20 01:09:35 +05:30
(fixed): router and host_config for my local network cross device access
This commit is contained in:
@@ -128,11 +128,11 @@ function inject_search_results (results) {
|
|||||||
searchRes.innerHTML = `<p class="text-xs text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS</p>`;
|
searchRes.innerHTML = `<p class="text-xs text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS</p>`;
|
||||||
|
|
||||||
results.forEach(function(result) {
|
results.forEach(function(result) {
|
||||||
let resultDiv = document.createElement("div");
|
let projectsDiv = 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";
|
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";
|
||||||
resultDiv.setAttribute("onclick", "location.href='" + result.link + "'");
|
projectsDiv.setAttribute("onclick", "location.href='" + result.link + "'");
|
||||||
|
|
||||||
resultDiv.innerHTML = `
|
projectsDiv.innerHTML = `
|
||||||
<span class="flex items-center">
|
<span class="flex items-center">
|
||||||
<span class="mx-1 px-[0.65rem] py-1 rounded border-[1px] border-accent_secondary_transparent">${result.name.charAt(0).toUpperCase()}</span>
|
<span class="mx-1 px-[0.65rem] py-1 rounded border-[1px] border-accent_secondary_transparent">${result.name.charAt(0).toUpperCase()}</span>
|
||||||
<span class="flex flex-col">
|
<span class="flex flex-col">
|
||||||
@@ -146,7 +146,7 @@ function inject_search_results (results) {
|
|||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
searchRes.appendChild(resultDiv);
|
searchRes.appendChild(projectsDiv);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ require 'query_functions.php';
|
|||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
if (isset($_POST['keyword'])) {
|
if (isset($_POST['keyword'])) {
|
||||||
$keyword = $_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);
|
echo json_encode($results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ $currentHost = $_SERVER['HTTP_HOST'];
|
|||||||
if($currentHost == "localhost") {
|
if($currentHost == "localhost") {
|
||||||
$basePath = "https://localhost/neosubhamoy/htdocs";
|
$basePath = "https://localhost/neosubhamoy/htdocs";
|
||||||
}
|
}
|
||||||
|
elseif ($currentHost == "192.168.29.177") {
|
||||||
|
$basePath = "https://192.168.29.177/neosubhamoy/htdocs";
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$basePath = "https://" . $currentHost;
|
$basePath = "https://" . $currentHost;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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%'";
|
$sql = "SELECT * FROM projects WHERE name LIKE '%$keyword%'";
|
||||||
$result = $conn -> query($sql);
|
$result = $conn -> query($sql);
|
||||||
if($result -> num_rows > 0) {
|
if($result -> num_rows > 0) {
|
||||||
@@ -65,4 +65,19 @@ function fetch_search_results($conn, $keyword) {
|
|||||||
return array('results' => 'none', 'message' => ': ( No Results Found');
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
@@ -16,7 +16,7 @@ $devRoutes = [
|
|||||||
'/neosubhamoy/htdocs/contact' => 'contact.php',
|
'/neosubhamoy/htdocs/contact' => 'contact.php',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($host == "localhost") {
|
if ($host == "localhost" || $host == "192.168.29.177") {
|
||||||
$routes = $devRoutes;
|
$routes = $devRoutes;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user