PHP Okuma Yazma Dosyası

0 Cevap php

Oops! I figured it out. Had to strip slashes...

Merhaba, ben tarayıcıda benim yapılandırma dosyasını düzenlemek için aşağıdaki kodu var. Dosya içeriği alınır ve bir metin kutusunda görüntülenir. Sonra düzenlemeler geri dosyasına kaydedilir. Her şey benim geliştirme makinede çalışıyor ama benim barındırma hesabı çalışmıyor.

Ben dosyayı kaydedin, tüm tek tırnak önlerinde bir ters eğik çizgi ekleyerek yazılı bitti.

Nasıl benim kod Bunu önlemek için değiştirebilirim? Teşekkür ederiz!

<?php
// button javascript
$save_changes_js = "return confirm('Do you want to SAVE the CHANGE(S)?');";

// open web config
$filename = ROOT_PATH.'web.config.php';
$contents = file_get_contents($filename);

if(isset($_POST['txbConfig']) && !empty($_POST['txbConfig']))
{
    // save changes to file
    $changes = $_POST['txbConfig'];
    file_put_contents($filename,$changes);

    // refresh page
    $destination_url = SITE_URL.'admin/edit-config.php';
    header('Location:'.$destination_url);
}
?>

<form action="" method="post" name="editConfig" class="htmlForm">
  <div class="editConfigWrap">
    <textarea name="txbConfig"><?php echo $contents ?></textarea>
  </div>
  <input name="submit" type="submit" value="Save Changes" class="gvbtn" onclick="<?php echo $save_changes_js; ?>">
</form>

0 Cevap