Answer the question
In order to leave comments, you need to log in
Yii: Is this the right way to work with models, security issues?
Hello!
There is an application which saves the entered data of the user in a DB.
Code example
$newVisit = new MYMODEL();
$newVisit->SERVICEID = $serviceId;
$newVisit->VISITEDDATE = new CDbExpression('sysdate');
$newVisit->NAME = $_POST['name'];
$newVisit->COST = $_POST['amount'];
$newVisit->TERM = $_POST['term'];
$newVisit->USERID = $_POST['uid'];
$newVisit->save();
Answer the question
In order to leave comments, you need to log in
Certainly safe, especially since the model has validation rules.
If you write rules () in the model to validate the received data, then in theory there should be no other data there, only those that have passed validation. Therefore, it is quite safe, but depends on your prescribed rules.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question