2020-08-14 14:47:50 -04:00
|
|
|
<?php
|
2020-08-14 07:40:42 -04:00
|
|
|
/********************************************************************/
|
2020-08-14 14:47:50 -04:00
|
|
|
// create-server-config.php
|
2020-08-14 07:40:42 -04:00
|
|
|
// Created by Yigit Kerem Oktay
|
2020-08-14 14:47:50 -04:00
|
|
|
// This file generates a .htaccess file that contains all necessary
|
2020-08-14 07:40:42 -04:00
|
|
|
// code for it.
|
|
|
|
// This is needed because some hosts do not either unzip hidden files
|
|
|
|
// or neither GitHub puts that file inside the zips.
|
|
|
|
/********************************************************************/
|
2023-03-12 06:40:27 -04:00
|
|
|
$apacheExampleName = "ApacheHtaccess";
|
|
|
|
$apacheProductionName = ".htaccess";
|
|
|
|
$iisExampleName = "IISWebConfig";
|
|
|
|
$iisProductionName = "web.config";
|
2020-08-14 07:40:42 -04:00
|
|
|
if(stripos($_SERVER['SERVER_SOFTWARE'],'apache')!== false){
|
2023-03-12 06:40:27 -04:00
|
|
|
if(!file_exists($apacheProductionName)) {
|
|
|
|
$f = fopen($apacheProductionName, "a+");
|
|
|
|
$f2 = fopen($apacheExampleName,"r");
|
|
|
|
fwrite($f, fread($f2, filesize($apacheExampleName)));
|
|
|
|
fclose($f);
|
|
|
|
fclose($f2);
|
|
|
|
}
|
|
|
|
// skipping renaming file if it already exists
|
2020-08-14 07:40:42 -04:00
|
|
|
} else {
|
2023-03-12 06:40:27 -04:00
|
|
|
if(!file_exists($iisProductionName)) {
|
|
|
|
$f = fopen($iisProductionName, "a+");
|
|
|
|
$f2 = fopen($iisExampleName,"r");
|
|
|
|
fwrite($f, fread($f2, filesize($iisExampleName)));
|
|
|
|
fclose($f);
|
|
|
|
fclose($f2);
|
|
|
|
}
|
2020-08-14 07:40:42 -04:00
|
|
|
}
|
|
|
|
?>
|