ONE TIME PASSWORD

0 athuman said · February 11, 2015
hi guys i need your help on this .i  want my to send one time password or pin like six numbers from my website to the mobile 
phone .and  i am using php language .
1. Now how could i generate the those pin
2.how will they be transmitted from web to mobile 

Post a Reply

Replies

Oldest  Newest  Rating
+1 Samuel Oloruntoba · February 11, 2015
to send sms, check out twilio, then to generate the pin

// for numeric pin only
function getNumericPin($length = 6) {
   $output = '';

   for($i = 0; $i < $length; $i++) {
       $output .= mt_rand(0, 9);
   }

   return $output;
}

// for alphanumeric pin only
function getAlphanumericPin($length = 6) {
$characters = array_merge(
range('A' , 'Z'),
range('a', 'z'),
range(0, 9)
);

$output = '';

for($i = 0; $i < $length; $i++) {
$output .= $characters[array_rand($characters)];
}

return $output;
}
  • 1

PHP

107,048 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators