hey, so when you go to my website for the first time, which is located under the domain http://kreskowki24.free.nf or https://kreskowki24.pl, you will see the inscription 404 Page not found, I don’t know what’s causing it, maybe it’s because of that, it should take you to index.php simply everyone who should visit this website should be on the main page and not on the error page please help me fix this or fix the faulty code. When I hosted this website on another paid hosting, everything worked and didn’t display such an error at all, but when I moved my website here it doesn’t work
Please share the contents of your index file(s), because your application is reporting a HTTP 200 OK, not a 404 error (So the index file is being found, it is just showing 404 contents for some reason)
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 20 Dec 2024 21:08:40 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Access-Control-Allow-Origin: *
<?php
session_start();
use modules\Module as Module;
use Templates as Templates;
use SESSION as SESSION;
use POST as POST;
use Route\Route as Route;
class Core{
private const name="DGCORE";
private const version="alpha";
private const number="1.2.0";
private const modules="modules";
private const author="DeagleM";
private const routes="route";
private const public="public";
public static function info(){
return "NAME: ".Core::name."</br>
VERSION: ".Core::version." (".Core::number.")</br>
AUTHOR: ".Core::author;
}
public static function modules(){
return Core::modules;
}
public static function route(){
return Core::routes;
}
public static function public(){
return Core::public;
}
public static function getName(){
return Core::name;
}
}
function removeCharAt($str, $pos) {
return substr_replace($str, "", $pos, 1);
}
@define("url",array_filter(explode('/', removeCharAt(str_replace("","",$_SERVER['REQUEST_URI']),0))));
@define("path",str_replace("index.php","",$_SERVER['PHP_SELF']));
if(Core::route()!==null&&Core::route()!=""){
if(Core::modules()!==null&&Core::modules()!=""){
include("modules/modules.php");
$allTemplates=array();
$allModules=array();
define("modules",opendir(Core::modules()));
define("route",opendir(Core::route()));
define("publicTemplates",opendir(Core::public()));
while(false !==($file=readdir(modules))){
if($file!='.'&&$file!='..'&&$file!="modules.php") {
if(@file_get_contents("./modules/".$file."/package.json")!=""&&@file_get_contents("./modules/".$file."/package.json")!==null){
$temp = json_decode(file_get_contents("./modules/".$file."/package.json"), true);
$tempArray=array();
foreach($temp as $key => $value){
array_push($tempArray,$value);
}
$tempObject = new Module($tempArray[0],$tempArray[1],$tempArray[2],$tempArray[3],$tempArray[4],$tempArray[5]);
array_push($allModules,$tempObject);
}else{
die("[".Core::getName().'] Error modules including! Not searched package.json or is damaged! ( <span style="color:#dc3545;font-weight:bold;">Damaged modules:</span> '.$file.' )');
}
}
}
for($i=0;$i<count($allModules);$i++){
include("modules/".$allModules[$i]->getName()."/".$allModules[$i]->getMainFile());
}
while(false !==($file=readdir(publicTemplates))){
if($file!='.'&&$file!='..'&&$file!="style.css") {
@array_push($allTemplates,array($file=>file_get_contents("public/".$file)));
}
}
Templates::set($allTemplates);
foreach($_SESSION as $setter => $value){
SESSION::set($setter,$value);
}
foreach($_POST as $setter => $value){
POST::set($setter,$value);
}
foreach($_GET as $setter => $value){
GET::set($setter,$value);
}
while(false !==($file=readdir(route))){
if($file!='.'&&$file!='..') {
include("route/".$file);
}
}
if(Route::$checkTemplate==""){
if(file_exists("public/errors.html")) echo str_replace('{$src}',"<a href='/../..".str_replace("index.php","",$_SERVER['PHP_SELF'])."index'><button>Strona Główna</button></a>",file_get_contents("public/errors.html"));
};
}else{
die("[".Core::getName().'] Core error! Modules is not set!');
}
}else{
die("[".Core::getName().'] Core error! Routes is not set!');
}
?>
someone help?
I’m sorry, but I don’t understand what you expect from us here.
You shared quite a long segment of code, which appears to be a part of a quite complex custom coded web application. And most people are not eager to study someone else’s custom coded framework to help you fix an issue in your website.
That said, a cursory glance does show this code segment:
if(Route::$checkTemplate==""){
if(file_exists("public/errors.html")) echo str_replace('{$src}',"<a href='/../..".str_replace("index.php","",$_SERVER['PHP_SELF'])."index'><button>Strona Główna</button></a>",file_get_contents("public/errors.html"));
};
I suspect that this is the code that’s showing the error page.
As for why it’s reaching that code, or whether it should reach that code in the first place, I can’t easily tell. There is a lot of directory listing and file loading happening which appears to be done to dynamically load routes and modules, which I’m having trouble wrapping my head around.
For someone toe be able to fix this, they would need full access to the codebase and understand how everything is supposed to work. And frankly, you’re simply the best equipped person here to do it.
Please understand that while we are happy to investigate hosting issues. But this appears to be a bug in your code, not a hosting issue.
If you do think it’s a hosting issue, then please tell us what exactly you believe is the hosting issue. And “but it works on my own computer but not here, so now you need to fix it” is not how that works.
Why my website is suspended?
You can see why you got suspended Through the client area, we can’t tell.
Your site was suspended for a terms of use violation.
Please open a support ticket in the client area for more information, we can’t help you here on the forum.