Jump to content

Recommended Posts

i was wondering if it would be best to mysqli escape and trim and what-not $_POST values before they're even compared to the db. I have a login script that checks to see if the username already exists so it puts the post value in the query to check...is that dangerous to do without escaping? or does it not matter since its only comparing and not inserting in the db?

Link to comment
https://forums.phpfreaks.com/topic/149064-security-question/
Share on other sites

There is, but you only need to use it on data, that will be stored in database.

 

Imagine user inputs his nickname as

<h1>Mchl</h1>

 

Obviously you wouldn't like it to appear as a header to spoil your page's layout, so you use htmlentities to change all < and > to < and >

Link to comment
https://forums.phpfreaks.com/topic/149064-security-question/#findComment-783240
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.