We help IT Professionals succeed at work.

Generate a simple code for mobile number verification

loggindevelop
on
Medium Priority
4,476 Views
Last Modified: 2016-09-17
Hello,

I'm building a social network that will allow users to send SMSs between them, but the mobile number of each user must be first verified. Therefore I need a PHP script to do the following:

1- Once the user has typed his mobile number, the script generates a simple code (like "634928") which will be valid only for that number and not another one and for a concrete time (1 minute, for example).

2- Then that code is sent via SMS through the gateway I use and received by the number's owner. (For this step I just need a variable which takes the verification code, and I'll make it to be sent via SMS).

3- He writes it in a form which will check if the code is valid (the same generated at the beginning) and if it's still within the predefined time (the one set before).

4- If everything is OK a variable called "$verified" will take "yes" as value, if not, the page will ask to check the code.

I hope it's easy to do...

Thanks!
Comment
Watch Question

Chief Digital Officer
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Hello, abijelic,

Thank you for your so fast answer, but I started trying it, exacuting first the MakeRandomCode() function and it gave me an error: max execution time limit exeeded (30 sec). I think there's an error in the code, but I don't know where. Please, could you check everything?

Thanks!
Aleksandar BijelicChief Digital Officer
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you!

Commented:
Hi I am newbie to this field. How to run that above php code.

localhost /otpcode/SendRandomSMScode.php -  when i was run that code its displaying empty.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.