Jump to content

Otp - One Time Password Send To Clients Cellphone


tinusstrydom

Recommended Posts

Hi Guys !

 

Maybe someone can help me with this ,

i manage to have a form that validates all the inputs and regular expressions ,

but after that redirects to a otp screen that should send out a random number and to the clients cellphone that

he can insert in the otp form ,that then safes the random number and the one filled in by client for reference.

So assume that it should maybe send the random number to the database first and then check if the number is in the database and then update the database with details and then rediret to thank you page

 

 

 

<?php

//Generate random number

$otpin = substr(number_format(time() * rand(),0,'',''),0,6);

 

$error_open = "<label class='otperror'>";

$error_close = "</label>";

$valid_form = TRUE;

 

 

$form_elements = array('otpclient');

$required = array('otpclient');

 

foreach($required as $require){

$error[$require] = '';

}

 

if(isset($_POST['submit'])){

 

foreach ($form_elements as $element){

$form[$element] = htmlspecialchars($_POST[$element]);

}

if ($form['otpclient']==''){

$error['otpclient'] = $error_open . "Please fill in the OTP!" . $error_close;

$valid_form = FALSE;

}

if( $otpin == $form['otpclient']){

header("Location: " . $redirect);

 

}else{

echo "its not the same";

}

}

 

//Include otp.php file

include ('otp.php');

 

?>

 

in this code the random number entered change when submit is passed ,how to get it to check the input number without changing it

 

Any help or change of thoughts about approaching this will help

your question is bit ambiguous. the above code is for page before showing thank you page? if it is so then you are also telling that you save random number in database, then why are you generating it again? how you are validating or want to validate random number?

Hey Bugcoder!

 

Yes this page is before the thankyou page .

 

It needs to generate a random number and sms it to the client and then save it to a database ,

then when the client inputs the number and press submit it should check the database if the number exist(validate) then redirect to thankyou page

and update the database with the otpin,otpclientinput,name ,surname ,cellphone,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.