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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:40:15+00:00 2026-05-11T05:40:15+00:00

At the moment, I apply a ‘throw everything at the wall and see what

  • 0

At the moment, I apply a ‘throw everything at the wall and see what sticks’ method of stopping the aforementioned issues. Below is the function I have cobbled together:

function madSafety($string) {  $string = mysql_real_escape_string($string); $string = stripslashes($string); $string = strip_tags($string); return $string;  } 

However, I am convinced that there is a better way to do this. I am using FILTER_ SANITIZE_STRING and this doesn’t appear to to totally secure.

I guess I am asking, which methods do you guys employ and how successful are they? Thanks

  • 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. 2026-05-11T05:40:15+00:00Added an answer on May 11, 2026 at 5:40 am

    Just doing a lot of stuff that you don’t really understand, is not going to help you. You need to understand what injection attacks are and exactly how and where you should do what.

    In bullet points:

    • Disable magic quotes. They are an inadequate solution, and they confuse matters.
    • Never embed strings directly in SQL. Use bound parameters, or escape (using mysql_real_escape_string).
    • Don’t unescape (eg. stripslashes) when you retrieve data from the database.
    • When you embed strings in html (Eg. when you echo), you should default to escape the string (Using htmlentities with ENT_QUOTES).
    • If you need to embed html-strings in html, you must consider the source of the string. If it’s untrusted, you should pipe it through a filter. strip_tags is in theory what you should use, but it’s flawed; Use HtmlPurifier instead.

    See also: What's the best method for sanitizing user input with PHP?

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

Sidebar

Related Questions

i have a function that i can call to apply a rounded corner fix
I need a list of URLs to apply filters to and at the moment
At the moment I have this code (and I don't like it): private RenderedImage
I'm working on a project at the moment and have become a little stuck.
I am using an ASP.NET ListView control and, at the moment, I have a
At the moment I have this (standard) code which gives me a full-width background
I have a jquery problem, I'm a beginner at this! I want to apply
I am calling a method using apply and I do not know how many
In the Io programming language, is there an equivalent to lisp's apply function. So
I am trying to apply the same gradient as per the screen shot below

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.