Jump to content

Securing my site.


scottnicol

Recommended Posts

I understand encryption and so on, and am now making my encryption method have double salts from separate tables, and also completely random at user registration. I realized that if people were to type in <?php mysql_query(blablabla); ?> and delete a load of stuff, it would mess me about (or am I just being skeptical?). How can I strip all input/post of php tags, or rather stop it from executing (comments section of a blog).

Link to comment
Share on other sites

Are you calling eval() on user input?  If not, then it doesn't matter if they input PHP code into the comments section on a blog.

 

All you need to do is:

 

1) When inserting data into the database, use mysql_real_escape_string() (or the appropriate function for your database)

2) When displaying data, call striptags(), htmlentities(), or some other escaping function so that potentially dangerous input from one user is not sent to another user.

Link to comment
Share on other sites

You can not sanitize data all in one go.

 

Use mysql_real_escape_string() when inserting the data or the appropriate escape function for your database.

 

Use an appropriate escaping function such as striptags() or htmlentities() after selecting data from the database and before sending it to the user's browser.

 

Do it any other way and your site will be vulnerable to attacks.

Link to comment
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.