models/UserForm.php
public function save()
    {
        if (!$this->validateForm())
            return false;
        
        try
        {
            // Store some data in session temporarily
            Yii::app()->session['encryptionKey']    = $this->encryptionKey;
            Yii::app()->session['siteName']         = $this->siteName;
            Yii::app()->session['primaryEmail']     = $this->email;
            
            // Try to save the record into the database
            $connection = new CDbConnection(Yii::app()->session['dsn']['dsn'], Yii::app()->session['dsn']['username'], Yii::app()->session['dsn']['password']);
            $connection->setActive(true);
            $connection->createCommand('INSERT INTO users (id, email, password, username, user_role, status, created, updated) VALUES (1, :email, :password, :username, 9, 1, UNIX_TIMESTAMP(),UNIX_TIMESTAMP())')
                       ->bindParam(':email',        $this->email)
                       ->bindParam(':password',     $this->encryptedPassword)
                       ->bindParam(':username',     $this->username)
                       ->execute();
            return true;
        }
        catch (CDbException $e)
        {
            $this->addError('password', Yii::t('Install.main','There was an error saving your details to the database.'));
            return false;
        }
        
        return false;
    }
public function save()
    {
        if (!$this->validateForm())
            return false;
        
        try
        {
            // Store some data in session temporarily
            Yii::app()->session['encryptionKey']    = $this->encryptionKey;
            Yii::app()->session['siteName']         = $this->siteName;
            Yii::app()->session['primaryEmail']     = $this->email;
            
            // Try to save the record into the database
            $connection = new CDbConnection(Yii::app()->session['dsn']['dsn'], Yii::app()->session['dsn']['username'], Yii::app()->session['dsn']['password']);
            $connection->setActive(true);
            $connection->createCommand('INSERT INTO users (id, email, password, username, user_role, status, created, updated) VALUES (1, :email, :password, :username, 9, 1, UNIX_TIMESTAMP(),UNIX_TIMESTAMP())')
                       ->bindParam(':email',        $this->email)
                       ->bindParam(':password',     $this->encryptedPassword)
                       ->bindParam(':username',     $this->username)
                       ->execute();
            return true;
        }
        catch (CDbException $e)
        {
            $this->addError('password', Yii::t('Install.main','There was an error saving your details to the database.'));
            return false;
        }
        
        return false;
    }
public function save ( ) { if ( ! $ this -> validateForm ( ) ) return false ; try { // Store some data in session temporarily Yii :: app ( ) -> session [ 'encryptionKey' ] = $ this -> encryptionKey ; Yii :: app ( ) -> session [ 'siteName' ] = $ this -> siteName ; Yii :: app ( ) -> session [ 'primaryEmail' ] = $ this -> email ; // Try to save the record into the database $ connection = new CDbConnection ( Yii :: app ( ) -> session [ 'dsn' ] [ 'dsn' ] , Yii :: app ( ) -> session [ 'dsn' ] [ 'username' ] , Yii :: app ( ) -> session [ 'dsn' ] [ 'password' ] ) ; $ connection -> setActive ( true ) ; $ connection -> createCommand ( 'INSERT INTO users (id, email, password, username, user_role, status, created, updated) VALUES (1, :email, :password, :username, 9, 1, UNIX_TIMESTAMP(),UNIX_TIMESTAMP())' ) -> bindParam ( ':email' , $ this -> email ) -> bindParam ( ':password' , $ this -> encryptedPassword ) -> bindParam ( ':username' , $ this -> username ) -> execute ( ) ; return true ; } catch ( CDbException $ e ) { $ this -> addError ( 'password' , Yii :: t ( 'Install.main' , 'There was an error saving your details to the database.' ) ) ; return false ; } return false ; }
This method will save the admin user into the database,
This method will save the admin user into the database