+ | '.$json[$i]["name"].' '.$json[$i]["location"].' '.$fulltype.' |
"; + }else{ + $error = 1; + } } -} -if(!file_exists("images/user")){ - if(mkdir("images/user", 0777) && $error != 1){ - echo "Felhasználói fotó könyvtár létrehozva
"; - }else{ - $error = 1; + if(!file_exists("images/user")){ + if(mkdir("images/user", 0777) && $error != 1){ + echo "Felhasználói fotó könyvtár létrehozva
"; + }else{ + $error = 1; + } } -} -if(!file_exists("images/school")){ - if(mkdir("images/school", 0777) && $error != 1){ - echo "Intézményi fotó könyvtár létrehozva
"; - }else{ - $error = 1; + if(!file_exists("images/school")){ + if(mkdir("images/school", 0777) && $error != 1){ + echo "Intézményi fotó könyvtár létrehozva
"; + }else{ + $error = 1; + } } +}else{ + echo "Az 'images' könyvtár vagy nem létezik, vagy nincs írhatónak beállítva."; } -if(!file_exists("creds.php")){ - if(file_put_contents("creds.php", '') && $error != 1){ - echo "Adatbázis konfiguráció létrehozva (creds.php)
"; - }else{ - $error = 1; + +if (is_writable(__DIR__)){ + if(!file_exists("creds.php")){ + $url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . '://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); + if(file_put_contents("creds.php", '') && $error != 1){ + echo "Adatbázis konfiguráció létrehozva (creds.php)
"; + }else{ + $error = 1; + } } +}else{ + echo "Az gyökérkönyvtár nincs írhatónak beállítva."; } if($error == 1){ - echo "Nincsennek a jogok megfelelően beállítva. A gyökérmappa (".basename(__DIR__) .") legyen 777 jogosultságú."; + echo "Nincsennek a jogok megfelelően beállítva. A gyökérmappa (".basename(__DIR__) .") legyen 777 jogosultságú."; +} + +echo "
Visszatérés a kezdőlapra"; +}else{ + echo "Már kész a telepítés. Az azonosító adatokat a creds.php fájlban lehet módosítani."; } ?> \ No newline at end of file