reference/oci8/functions/oci-password-change.xml
78be3d554eca2e35b0e7cdbfb3aaba62bacdc336
...
...
@@ -15,13 +15,13 @@
15
15
<methodparam><type>string</type><parameter>old_password</parameter></methodparam>
16
16
<methodparam><type>string</type><parameter>new_password</parameter></methodparam>
17
17
</methodsynopsis>
18
-
<methodsynopsis>
19
-
<type>resource</type><methodname>oci_password_change</methodname>
20
-
<methodparam><type>string</type><parameter>dbname</parameter></methodparam>
21
-
<methodparam><type>string</type><parameter>username</parameter></methodparam>
22
-
<methodparam><type>string</type><parameter>old_password</parameter></methodparam>
23
-
<methodparam><type>string</type><parameter>new_password</parameter></methodparam>
24
-
</methodsynopsis>
18
+
<methodsynopsis>
19
+
<type>resource</type><methodname>oci_password_change</methodname>
20
+
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
21
+
<methodparam><type>string</type><parameter>username</parameter></methodparam>
22
+
<methodparam><type>string</type><parameter>old_password</parameter></methodparam>
23
+
<methodparam><type>string</type><parameter>new_password</parameter></methodparam>
24
+
</methodsynopsis>
25
25
<para>
26
26
Changes password for user with <parameter>username</parameter>.
27
27
</para>
...
...
@@ -69,7 +69,7 @@
69
69
</listitem>
70
70
</varlistentry>
71
71
<varlistentry>
72
-
<term><parameter>dbname</parameter></term>
72
+
<term><parameter>database_name</parameter></term>
73
73
<listitem>
74
74
<para>
75
75
The database name.
...
...
@@ -83,7 +83,71 @@
83
83
<refsect1 role="returnvalues">
84
84
&reftitle.returnvalues;
85
85
<para>
86
-
&return.success;
86
+
When <parameter>database_name</parameter> is provided, <function>oci_password_change</function> returns &true; on success,
87
+
&return.falseforfailure;. When <parameter>connection</parameter> is provided, <function>oci_password_change</function> returns
88
+
the connection resource on success,&return.falseforfailure;.
89
+
</para>
90
+
</refsect1>
91
+

92
+
<refsect1 role="examples">
93
+
&reftitle.examples;
94
+
<para>
95
+
<example>
96
+
<title><function>oci_password_change</function> example changing the password of an already connected user</title>
97
+
<programlisting role="php">
98
+
<![CDATA[
99
+
<?php
100
+

101
+
$dbase = 'localhost/orcl';
102
+
$user = 'cj';
103
+
$current_pw = 'welcome';
104
+
$new_pw = 'geelong';
105
+

106
+
$c = oci_pconnect($user, $current_pw, $dbase);
107
+
oci_password_change($c, $user, $current_pw, $new_pw);
108
+
echo "New password is : " . $new_pw . "\n";
109
+

110
+
?>
111
+
]]>
112
+
</programlisting>
113
+
</example>
114
+
</para>
115
+
<para>
116
+
<example>
117
+
<title><function>oci_password_change</function> example of connecting and changing the password in one step</title>
118
+
<programlisting role="php">
119
+
<![CDATA[
120
+
<?php
121
+

122
+
$dbase = 'localhost/orcl';
123
+
$user = 'cj';
124
+
$current_pw = 'welcome';
125
+
$new_pw = 'geelong';
126
+

127
+
$c = oci_pconnect($user, $current_pw, $dbase);
128
+
if (!$c) {
129
+
$m = oci_error();
130
+
if ($m['code'] == 28001) { // "ORA-28001: the password has expired"
131
+
// Login and reset password at the same time
132
+
$c = oci_password_change($dbase, $user, $current_pw, $new_pw);
133
+
if ($c) {
134
+
echo "New password is : " . $new_pw . "\n";
135
+
}
136
+
}
137
+
}
138
+

139
+
if (!$c) { // The original error wasn't 28001, or the password change failed
140
+
$m = oci_error();
141
+
trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR);
142
+
}
143
+

144
+
// Use the connection $c
145
+
// ...
146
+

147
+
?>
148
+
]]>
149
+
</programlisting>
150
+
</example>
87
151
</para>
88
152
</refsect1>
89
153

...
...
@@ -107,24 +171,14 @@
107
171
</para>
108
172
</note>
109
173
<note>
110
-
<simpara>
174
+
<para>
111
175
The second <function>oci_password_change</function> syntax is available
112
176
since OCI8 version 1.1.
113
-
</simpara>
114
-
</note>
115
-
<note>
116
-
<para>
117
-
In PHP versions before 5.0.0 you must use <function>ocipasswordchange</function> instead.
118
-
This name still can be used, it was left as alias of
119
-
<function>oci_password_change</function> for downwards compatability.
120
-
This, however, is deprecated and not recommended.
121
177
</para>
122
178
</note>
123
-

124
179
</refsect1>
125
180

126
181
</refentry>
127
-

128
182
<!-- Keep this comment at the end of the file
129
183
Local variables:
130
184
mode: sgml
131
185