tinusstrydom Posted December 22, 2012 Share Posted December 22, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/272278-otp-one-time-password-send-to-clients-cellphone/ Share on other sites More sharing options...
bugcoder Posted December 22, 2012 Share Posted December 22, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/272278-otp-one-time-password-send-to-clients-cellphone/#findComment-1400860 Share on other sites More sharing options...
tinusstrydom Posted December 22, 2012 Author Share Posted December 22, 2012 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, Quote Link to comment https://forums.phpfreaks.com/topic/272278-otp-one-time-password-send-to-clients-cellphone/#findComment-1400862 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.