B
B
BadassRolf2017-07-26 09:02:57
PHP
BadassRolf, 2017-07-26 09:02:57

How to make a secure database query?

Good afternoon. Not so long ago I did a test task in one Internet agency (for the position of an intern, not even a junior), they indicated an error about unsafe access to the database on the add.php page. Now I'm just curious, how can this be done in Bitrix?
Link to the repository

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ildar Gizetdinov, 2017-07-26
@BadassRolf

CModule::IncludeModule("iblock");
$cibe = new CIBlockElement();
$cibe->Add(array(
  "IBLOCK_ID" => 1,
  "NAME" => $name,
  "DETAIL_TEXT" => $text,
  "PREVIEW_TEXT" => $text_small	
));

A
Andrey Nikolaev, 2017-07-26
@gromdron

Depending on what exactly you want to do.
If you are interested in how to do it correctly, then see the message from Ildar Gizetdinov , it is described in detail there
If you are interested in how to fix your query, then before inserting values ​​into the query, you need to use the ForSql () method

D
DRusak, 2019-06-13
@DRusak

Watch the course - Bitrix Framework developer -> Working with database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question