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 7772555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:54:57+00:00 2026-06-01T16:54:57+00:00

I have a default site template I use for my site like below: <!–

  • 0

I have a default site template I use for my site like below:

<!-- Meta start -->
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<!-- Meta end -->

<?php
    require_once($sidebar_inc);
?>

<?php
    // main.inc.php
    require_once($main_inc);
?>

<!-- CONTENT START -->
<?php
    // signup.tpl template location
    $tpl = 'inc/tpl/signup.tpl';
    // check if files exists and is readable
    if(file_exists($tpl) && is_readable($tpl)) {
        echo file_get_contents($tpl);
    } else {
        echo 'Template not found';
    }
?>

<!-- CONTENT FINISH -->

<?php
    // footer.inc.php
    require_once($footer_inc);
?>

Now my problem is when the signup.tpl is included via file_get_contents if magic quotes is on it adds "\ to all the form data.

Here is the signup.tpl template

<h1>Sign up</h1>

<p>Welcome to SITE_NAME. To get started, you’ll need an account.</p>

<form action="signup.php" method="post">
    <div class="form_settings">
        <p><span>Name</span><input class="contact" type="text" name="your_name" value="" /></p>
        <p><span>Email Address</span><input class="contact" type="text" name="your_email" value="" /></p>
        <p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="your_enquiry"></textarea></p>
        <p style="padding-top: 15px"><span>&nbsp;</span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p>
    </div>
</form>

Basically with magic quotes on it looks like this when the signup.tpl is included.

enter image description here

But with magic quotes off it does not add slashes so it looks as it should:

enter image description here

Now I know you should not have magic quotes on but I have a function to strip slashes if magic quotes is on from all $_GET, $_POST, $_COOKIE, $_SESSION so my scripts will work even if magic quotes is on. The problem is I don’t know how to solve my problem that if magic quotes is on that it won’t add slashes to the signup.tpl. I just want to make sure my script(s) will work if i for example moved it to a server which had magic quotes on.

What do I need to do to stop magic quotes adding slashes to the signup.tpl? I know I could just turn magic quotes off but like I said in case I changed server which had magic quotes on and did not allow to turn off magic quotes.

(Ignore the form, it is not a signup form just used as sample to show problem).

  • 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-06-01T16:54:58+00:00Added an answer on June 1, 2026 at 4:54 pm

    There are two magic quotes settings. From the manual:

    ; Magic quotes for incoming GET/POST/Cookie data.
    magic_quotes_gpc = Off
    
    ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
    magic_quotes_runtime = Off
    

    Magic-quotes-runtiume is not the same thing as magic GPC quoting – magic-quotes-runtime happens to all input at runtime, not just the GET/POST/COOKIE globals. You need to disable this setting at the start of your script:

    set_magic_quotes_runtime(false); # pre 5.3
    ini_set('magic_quotes_runtime', 0); # 5.3 onwards
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to have default text like Enter content here... appear
I have already a page template for the default view of a Plone site
I have 3 Django templates: base.html <title>{% block title %} SITE NAME {% endblock
I have a rails application using views/layouts/application.html.erb as the default site template. I'm just
I want to have site wide default settings for all jQuery validation uses on
I have some code that sets the lang var to the site default language.
I have a site where when accessing via site.com/default.aspx everything is fine, however when
i have multilingual asp.net site. there is a masterpage and default.aspx. I put two
I have an ASPX Page: <%@ Page Language=C# MasterPageFile=~/site.Master AutoEventWireup=true CodeBehind=Default.aspx.cs Inherits=myProject.Presentation.Web.Default src=Default.aspx.cs %>
I want to use the roles based authorization in my web site. I have

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.