http change password php

(PHP 5, PHP 7, PECL OCI8 >= 1.1.0)

oci_password_change — Изменяет пароль пользователя Oracle

Содержание

  1. Описание
  2. Список параметров
  3. Возвращаемые значения
  4. Примеры
  5. Примечания
  6. 4 Answers 4
  7. HTML Code for Change Password Form
  8. PHP Change Password Script

Описание

Изменяет пароль пользователя, указанного в username .

Функция oci_password_change() особенно полезна для скриптов PHP командной строки, или при использовании непостоянных соединений во всем приложении PHP.

Список параметров

Идентификатор соединения, возвращаемый функцией oci_connect() или oci_pconnect() .

Имя пользователя Oracle.

Имя базы данных.

Возвращаемые значения

Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.

Примеры

Пример #1 Пример использования oci_password_change() с изменением пароля уже подключенного пользователя

= ‘localhost/orcl’ ;
$user = ‘cj’ ;
$current_pw = ‘welcome’ ;
$new_pw = ‘geelong’ ;

$c = oci_pconnect ( $user , $current_pw , $dbase );
oci_password_change ( $c , $user , $current_pw , $new_pw );
echo «Новый пароль : » . $new_pw . »
» ;

Пример #2 Пример использования oci_password_change() с подключением и изменением пароля одновременно

= ‘localhost/orcl’ ;
$user = ‘cj’ ;
$current_pw = ‘welcome’ ;
$new_pw = ‘geelong’ ;

$c = oci_pconnect ( $user , $current_pw , $dbase );
if (! $c )

>

if (! $c ) < // Ошибка не совпадала с 28001, или не получилось изменить пароль
$m = oci_error ();
trigger_error ( ‘Не удалось подключиться к базе данных: ‘ . $m [ ‘message’ ], E_USER_ERROR );
>

// Использование подключения $c
.

Примечания

Изменение пароля с помощью этой функции или непосредственно в Oracle должно выполняться аккуратно, поскольку PHP-приложение может продолжать использовать в постоянных соединениях данные аутентификации последнего удачного подключения, которые уже устарели. Наилучшим решением может быть перезапуск всех веб-серверов после смены пароля.

При обновлении библиотеки клиента Oracle или базы данных от версии установки до версии 11.2.0.3 и выше функция oci_password_change() может вернуть ошибку «ORA-1017: invalid username/password» (Неверные имя пользователя/пароль), если версии и клиента и сервера обновлены в одно время.

Второй набор параметров функции oci_password_change() доступен начиная с версии OCI8 1.1.

В версиях PHP ниже 5.0.0 эта функция называлась ocipasswordchange() . В PHP 5.0.0 и выше ocipasswordchange() является алиасом oci_password_change() для обратной совместимости, вы можете продолжать использовать это имя, однако это не рекомендуется.

I am working on a section of code that changes a password in a database upon completion of the following form:

And the the PHP:

The problem I have at the moment is when I submit the submit button takes me to a read only page of this code.

4 Answers 4

On first looks I can figure out few major mistakes you made:

if you are comparing you should use

secondly when you use if..elseif. loop format shold be

You apparently miss the else part in one of your such loops. Please correct your syntax and try again.

You made a mistake here This include ‘dbconfig.php’;

Should be like this include (‘dbconfig.php’);

u can 1st select a table and check a password is correct and if correct a update a password .else display a error message.hey this just update a password if old is password is match to update a password. Cracker World

After seen your script, i found that you have not use ‘==’ in your password comparison condition.

Which is wrong. You accepted the birju shah’s answer above which is pointing out what i want to say.

Apart from this, i found that you did’t use any encryption method, which is extremely wrong. Anyone can hack your password from the database.

You should use Password_verify() and Password_hash() functions to encrypt and decrypt your password. These encryption and decryption are considered most safe now days. You should not use md5 encryption because now days anyone can decrypt md5 algorithm.

Here i have made one tutorial Change password code in PHP. I have covered all the above topics. I Hope that this tutorial will help you.

Change password feature in a web application is to let the user change their old password at some periodic interval. It makes the user protect the sensitive pages from hackers.

Some web application fixes some expiration period for user’s password. It forces the user to change the password once the expiration period is elapsed. For example, some banking applications force users to change the password for security.

We are going to see an example to change the password with Javascript validation by, accessing MySQL table.

HTML Code for Change Password Form

This HTML code shows the change password.

All the fields are mandatory and the newPassword and confirmPassword should be same. We are using Javascript validation. The validation function is,

PHP Change Password Script

After successful form submits, the PHP code will access MySQL to get current password. If this database value is matched with the forms current password value, then the password will be changed. The PHP code is,

Источник: computermaker.info

Техника и Гаджеты
Добавить комментарий