piątek, 22 czerwca 2012

Oracle and PHP - change password

PHP and change expired password on the Oracle database.


For databases with more users with expiring  passwords if not all users have sqlplus client installed is the problem with changing passwords. Unfortunately, few tools support this feature.

The easiest way is to write a simple interface PHP that uses a very useful function oci_password_change:


public function change_and_connect($user, $old_pw, $new_pw, $database)
    {
          $c = oci_password_change($
database, $user, $old_pw, $new_pw);
        if (!$c) {
            $m = oci_error();
            $_SESSION['err_message'] =$m["message"];
            return($m['code']);
        }
        else {
            return(true);
        }
       
    }

Brak komentarzy:

Prześlij komentarz