header("Content-type: text/html; charset=windows-1254");
$dizin = "hastane";
$ddizin = $dizin;
$dizin = opendir($dizin);
function tipBul ($dosya) {
$dosya = explode(".",$dosya);
$eleman = count($dosya)-1;
return $dosya[$eleman];
}
while ($dosya = readdir($dizin)) {
if ($dosya != "." || $dosya != "..") {
if (tipBul($dosya) == "php" || tipBul($dosya) == "html") {
if ($dosya) {
$icerik = file_get_contents($ddizin."/".$dosya);
$degistir = preg_replace("'(index.html)'i","index.php",$icerik);
$degistir = preg_replace("'file:\/\/.*\/web\/'i","",$icerik);
$harf = array("/ö/","/ç/","/ş/","/ğ/","/ü/","/ı/");
$degis = array("o","c","s","g","u","i");
$dosya = preg_replace($harf,$degis,$dosya);
$ac = fopen("yeni/".$dosya,"w");
if (fwrite($ac,$degistir)) {
echo "$dosya dosyasında gerekli işlemler yapıldı. Linkler PHP uzantılı çevrildi
";
} else {
echo "değiştirilemedi
";
}
}
}
}
}
closedir($dizin);
?>