public function actionDownload_client() { $afterDownload = false; if (isset($_POST['download'])) { $currentUser = Yii::app()->db->createCommand("SELECT * FROM external_users_usr WHERE id_usr="******"SELECT * FROM external_users_usr WHERE id_usr="******"norman-sampleshare-client-example.zip"'); header('Content-Transfer-Encoding: binary'); readfile($tmpPath . 'zip.zip'); // step 6. clean folder unlink($tmpPath . 'sampleshare.inc'); unlink($tmpPath . 'sampleshare.php'); unlink($tmpPath . 'zip.zip'); rmdir($tmpPath); unset($_SESSION['password']); } else { Yii::app()->user->setFlash('_error', 'Wrong password!'); } } $this->render('download_client', array('afterDownload' => $afterDownload)); }