Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3489992
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:27:44+00:00 2026-05-18T11:27:44+00:00

Oops! I figured it out. Had to strip slashes… Hello, I have the following

  • 0

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

Hello, I have the following code to edit my configuration file in the browser. The file content is retrieved and displayed in a text box. Then the edits are saved back into the file. Everything works fine on my development machine but in my hosting account it does not work.

When I save the file, all single quotes are over written adding a backslash in front of them.

How can I change my code to prevent this? Thank you!

<?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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:27:45+00:00Added an answer on May 18, 2026 at 11:27 am

    This happens because your ISP still has Magic Quotes turned on. Ideally, get them to turn it off or find a way to configure it for your account.

    If this can’t be done, you need to use stripslashes or equivalent. See this other SO question: How to turn off magic quotes on shared hosting?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Oops - as rightly pointed out, there'd be no way to know whether
I made a big oops, and could use some help undoing it. We have
I have a question related to OOPS concept. I have a base class public
Given a linux kernel oops, how do you go about diagnosing the problem? In
This problem of mine has me pulling my hair out. It's related to the
I can't figure out how to handle exception for python 'with' statement. If I
For some time now I am trying to figure out how I can refactor
I have a Python program that dies with a MemoryError when I feed it
Here is my problem. I have a ticket-tracking system that is not very 'user
I have something like: #include MyImage.hpp // MyImage wraps the Qt library image class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.