worknova.manus/apiv3/auths/change-password.php
LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

40 lines
1.1 KiB
PHP

<?php
$must_login = true ;
$require_path = '../../' ;
$require_sub = '../' ;
require( $require_path.'extensions/sms.php' ) ;
require( $require_path.'extensions/mailer.php' ) ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '300' ;
if ( $array['password'] != '' ){
$status = '205' ;
$password = $staff_info['staff_id'].strPad( 6, rand(000000, 999999) ) ;
$enc_password = passwordEncrypt( $array['password'] ) ;
if ( $mysqli->query( "UPDATE staff SET
staff_password = '".$enc_password."'
WHERE staff_id = '".$staff_info['staff_id']."'" ) ){
$status = '208' ;
$mailer = new Mailer() ;
$mailer->from = EMAILNOREPLY ;
$mailer->to = [ $staff_info['staff_email'] ] ;
$mailer->subject = 'Change password' ;
$mailer->body = 'Your new password was success change to ' . $array['password'] ;
if ( $mailer->send() ){
$status = '200' ;
}
}
}
}
require( $require_sub.'footer.php' ) ;
?>