Created
July 23, 2020 17:08
-
-
Save vanpariyar/a21e499a2a884bf710be7564e165f4c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Send Email For OTP | |
* Using WP_rand ( because it is cryptographically secure then PHP rand ). | |
*/ | |
$otp = wp_rand( 100000, 999999 ); | |
$timestemp = current_time('timestamp'); | |
/** | |
* OTP stemp Format( TimeStemp:OtpString ) for Ex. 15000000245455:465478 | |
*/ | |
$user_string = current_time('timestamp') .':'. wp_rand( 100000, 999999 ); | |
update_user_meta( $user->ID, 'pass_stemp', $user_string ); | |
$fields = [ | |
'otp' => $otp, | |
'email'=> $user_email, | |
'name'=> $user->user_firstname, | |
]; | |
/** SEND THis to email */ | |
/** | |
*FOr validation code | |
*/ | |
get user meta | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment