PHP security question?

I just wanted to know what basic PHP security methods should I use when creating a web page that accepts articles?

I am new to PHP and wondering what will keep the fort until I am a security specialist?

+5
source share
8 answers

When adopting custom text that will be displayed later, you need to consider two fronts.

First, you need to protect your database from injection attacks. There is a simple PHP function for this: mysql_real_escape_string () is usually sufficient to protect your database from injection when passing this string to the repository as a value field.

, , HTML-, , . , htmlspecialchars() . ( , , .) , Markdown, , HTML , .

, , GET/POST, . , , .

+5

, , .

? ? ? SQL-? HTML? ?

+1
+1

, , , .

-, (, , WYSIWYG HTML), -, , XSS ..

HTML.

0

, , Drupal CakePHP. , , , , . , ..

0

, -.

  • , , , , , .
  • , , mysql , :

    if(!empty($_GET["integer_like_id_value"]){
        $integer_id_value = (int)$_GET["integer_like_id_value"];
    }else{
        // that stuff seems not to be legit, die application, log error ? whatever
        die();
    }
    
0
source

When your project is ready for public use, it is usually recommended to set error_reporting (0);

This will not provide more security, but it makes it difficult (usually) for bad guys to find possible security problems on your site.

-1
source

All Articles