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

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.