Jump to content

php security.


fredted40x

Recommended Posts

1. Make sure you validate inputs.

2. If you are dealing with databases, always use mysql_real_escape_string() function. This function properly scrubs your input so it doesn't include invalid characters.

3. Hide your php errors.

4. Make sure to md5 passwords or any vital information.. if you store it into db.

5. Use captcha, it prevents spammers.

 

That's what came into my mind right now. Hope it helps you :)

You can always google, there's a lot to study.

Link to comment
https://forums.phpfreaks.com/topic/198542-php-security/#findComment-1041849
Share on other sites

1. Make sure you validate inputs.

2. If you are dealing with databases, always use mysql_real_escape_string() function. This function properly scrubs your input so it doesn't include invalid characters.

3. Hide your php errors.

4. Make sure to md5 passwords or any vital information.. if you store it into db.

5. Use captcha, it prevents spammers.

 

That's what came into my mind right now. Hope it helps you :)

You can always google, there's a lot to study.

 

Ahhh captcha, good idea. for got about them.

 

 

So far i have md5ds passwords and i have just found the escape_string function on google so will be adding that.

 

Could you explain a little more about how to hid php errors?

 

Thanks again

Link to comment
https://forums.phpfreaks.com/topic/198542-php-security/#findComment-1041850
Share on other sites

Adding below code in your script would never show any php errors to your users. Add it to your code when you are done debugging it.

 

error_reporting(0);  

 

No. That makes sure that no single error is reported meaning that altough your application does not function it also does not show any errors in your error log the correct setting is:

 

error_reporting(E_ALL);
ini_set('display_errors', 1);//1=development, 0=production

 

You also shouldn't set these in your PHP script but in your php.ini. On your development machine display_errors = On and on your production machine display_errors = Off

Link to comment
https://forums.phpfreaks.com/topic/198542-php-security/#findComment-1041865
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.