您当前的位置:首页 > 网站建设笔记 >

付费阅读系统的扫码免登录支付实现原理

来源:网站程序网0
<form action="buy.php?type=newsinfo&id=15" method="post">
  <div id="billImage"></div>
  <div>扫码免登录支付</div>
  <div>本文章为付费文章,是否支付<b>1元</b>后完整阅读?</div>
  <div>如果您已购买过该文章,<a href="member/login.php?from=..%2F%3Ftype%3Dnewsinfo%26id%3D15">[登录帐号]</a>后即可查看</div>
  <input type="hidden" name="genkey" value="20230419160316941964363095">
  <button>支付1元</button>
</form>
<script src="js/qrcode.min.js"></script>
<script>
var qrcode= new QRCode('billImage', {width:100,height:100,colorDark:'#000000',colorLight:'#ffffff',correctLevel:QRCode.CorrectLevel.H});
qrcode.makeCode('https://www.wangzhanchengxu.com/member/unlogin.php?type=news&id=15&genkey=20230419160316941964363095');
</script>
<script>
function getQueryVariable(variable){
  var query=window.location.search.substring(1);
  var vars=query.split('&');
  for(var i=0;i<vars.length;i++){
    var pair=vars[i].split('=');
    if(pair[0]==variable){
      return pair[1];
    }
  }
  return(false);
}
function news_post(){
  $.post('conn/f.php?action=checknewsbuy&id=15&genkey2=20230419160316941964363095',{genkey:getQueryVariable('genkey')},function(data){
    data=JSON.parse(data);
    if(data.code=='success'){
      window.location.href='./?type=newsinfo&id=15&genkey=20230419160316941964363095';
    }
  });
}
setInterval('news_post()',3000);
</script>

建站咨询

咨询热线

微信咨询

返回顶部