public function actionAddFavourite() { if (isset($_POST['idUserList']) && (isset($_POST['idTruth']) || isset($_POST['idDare']))) { //Verify that the person that add to favourite is the owner of the list $model = UserList::model()->findByPk($_POST['idUserList']); if ($model->idUser == Yii::app()->user->getId()) { $model = new Userlistcontent(); $model->idUserList = $_POST['idUserList']; if (isset($_POST['idTruth'])) { $model->idTruth = $_POST['idTruth']; } if (isset($_POST['idDare'])) { $model->idDare = $_POST['idDare']; } if ($model->save()) { echo "SUCCESS"; $ttotot = "rr"; $ttotot = "rr"; } } } }
public function actionDeleteUserListContent() { if (isset($_POST['idUserListContent'])) { $userListContent = Userlistcontent::model()->with('userList')->findByPk($_POST['idUserListContent']); //Verify that the person who deletes the content is its owner if ($userListContent->userList->idUser == Yii::app()->user->getId()) { if ($userListContent->delete()) { echo "SUCCESS"; return; } } } echo "ERROR"; return; }
<?php if (isset($_POST['idUserList']) && (isset($_POST['idTruth']) || isset($_POST['idDare']))) { //VERIFIER QUE PERSONNE QUI AJOUTE EST BIEN PERSONNE QUI POSSEDE LA LISTE $test = 'toto'; $test = 'toto'; $test = 'toto'; $model = new Userlistcontent(); $model->idUserList = $_POST['idUserList']; if (isset($_POST['idTruth'])) { $model->idTruth = $_POST['idTruth']; } if (isset($_POST['idDare'])) { $model->idTruth = $_POST['idDare']; } if ($model->save()) { echo "SUCCESS"; } else { echo "FAIL"; } }