脚本宝典收集整理的这篇文章主要介绍了php – 如何生成OTP并通过短信将密码发送到移动设备,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我创建OTP并保存在DB中的代码:
if(isset($_POST['generate'])) { $string = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $string_shuffled = str_shuffle($string); $password = substr($string_shuffled,1,7); $password = base64_encode($password); $query = MysqL_query("UPDATE user_login SET password='".$password."' WHERE username = 'ajai sandy' "); $qry_run = MysqL_query($query); }
现在我需要放置这个SMS API代码:
http://LOGin.smsgatewayhub.COM/smsapi/pushsms.aspx?user=abc&pwd=xyz&to=919898123 456&sid=senderid&msg=test%20message&fl=0
事情是第5行代码生成OTP,然后我需要在此之后放置我的SMS API,以便它可以将密码发送到移动设备,然后它应该加密第6行的密码,然后保存在数据库.
if(isset($_POST['generate'])) { $string = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $string_shuffled = str_shuffle($string); $password = substr($string_shuffled,7); file_get_contents("http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user=abc&pwd=$password&to=919898123456&sid=senderid&msg=test%20message&fl=0"); $password = base64_encode($password); $query = MysqL_query("UPDATE user_login SET password='".$password."' WHERE username = 'ajai sandy' "); $qry_run = MysqL_query($query); }
以上是脚本宝典为你收集整理的php – 如何生成OTP并通过短信将密码发送到移动设备全部内容,希望文章能够帮你解决php – 如何生成OTP并通过短信将密码发送到移动设备所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。